Skip to content

Commit 4c3521f

Browse files
authored
Merge pull request #16 from WilliamMayor/master
Add CodeGuild instructions
2 parents f06df07 + 687d6c9 commit 4c3521f

File tree

4 files changed

+82
-1
lines changed

4 files changed

+82
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.swp
2+
.vagrant

CODEGUILD.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# micro:edit
2+
3+
An online Python editor for the micro:bit.
4+
5+
This file is for students on the [Villiers Park](http://www.villierspark.org.uk/) Computer Science Course. Although the rest of you are allowed to read it too :)
6+
7+
## Making Changes
8+
9+
If you want to build new features into the editor you'll need a local copy of the code to change, as well as a way to test your changes. Here's how:
10+
11+
You'll need to make sure you've got [git](https://git-scm.com/), [VirtualBox](https://www.virtualbox.org/), and [Vagrant](https://www.vagrantup.com/) installed. They're all free and pretty easy to install.
12+
13+
Then you'll need to fork this repo (so you'll need a GitHub account, if you don't already have one). This is easy, just click the "Fork" button in the top right of this page.
14+
15+
You'll now have your own copy of the repository stored in your own account. You can make whatever changes you'd like to this copy; it's yours.
16+
17+
To make changes you'll need to clone your fork. This might require running something like this on the command line:
18+
19+
$ git clone https://github.com/YOUR_USERNAME/PythonEditor
20+
21+
This will have downloaded the repo to your computer. Let's now get vagrant up and running by doing:
22+
23+
$ cd PythonEditor
24+
$ vagrant up
25+
26+
This one might take a while, but when it's done there will be a virtual machine running on your computer with all the code inside. We can connect to the virtual machine like this:
27+
28+
$ vagrant ssh
29+
30+
And now we can serve the website locally:
31+
32+
$ cd /vagrant
33+
$ ./show.sh
34+
35+
If you now open this link: http://192.168.33.10:8000 you should see the editor. Except this one is running on your machine, so changes we make here will be seen on the website.
36+
37+
You can now edit the code and see the changes you make alter the local copy of the website. Start by changing something small to see if it works. Then think of a minor bugfix/improvement you can make and try that. When you're confident about making larger changes, go for it!
38+
39+
40+
## Sharing Changes
41+
42+
When you're done making changes you'll want to have them included in the CodeGuild version of the website (not just your own), and then maybe even the official BBC version. So first push your changes up to your fork:
43+
44+
$ git add CHANGED_FILE CHANGED_FILE
45+
$ git commit -m 'DESCRIPTION_OF_CHANGES'
46+
$ git push origin master
47+
48+
If you don't know what the `git add` or `git commit` instructions are doing, ask around!
49+
50+
Now your fork will have the changes, let's make a pull request to the main repo to have them included in the main site. You'll need to open your fork on the GitHub website and click the "New Pull Request" button. Hopefully you'll see a green bit of text that says "Able to merge", if so, click the "Create pull request" button, provide a description of the work you've done and alick "Create pull request" again. If instead you see a red error message, you'll have to fix the problems it talks about before your work can be merged.
51+
52+
53+
## Improvements
54+
55+
- Add a simulator to the editor
56+
- Here's an example of a micro:bit simulator running Python: https://tools.withcode.uk/create/
57+
- Here's the source code: https://github.com/pddring/createwithcode
58+
- Let's add this simulator into this editor
59+
- Make the website nicer
60+
- Make these instructions nicer

Vagrantfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
Vagrant.configure("2") do |config|
4+
config.vm.box = "ubuntu/trusty64"
5+
config.vm.network "private_network", ip: "192.168.33.10"
6+
config.vm.provision "shell", inline: <<-SHELL
7+
add-apt-repository ppa:jonathonf/python-3.6
8+
apt-get update
9+
apt-get upgrade --assume-yes
10+
apt-get install --assume-yes \
11+
git \
12+
vim \
13+
python3.6
14+
apt-get autoremove --assume-yes
15+
SHELL
16+
config.vm.provision "shell", privileged: false, inline: <<-SHELL
17+
cd /vagrant
18+
git submodule update --init --recursive
19+
SHELL
20+
end

show.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
echo "http://localhost:8000/editor.html"
3-
python3 -m http.server
3+
python3 -m http.server --bind 0.0.0.0

0 commit comments

Comments
 (0)