Confirmed users
176
edits
Leo McArdle (talk | contribs) (Add development setup docs) |
Leo McArdle (talk | contribs) (Added more documentation) |
||
| Line 24: | Line 24: | ||
<pre> | <pre> | ||
git clone https://github.com/discourse/discourse.git | [host]$ git clone https://github.com/discourse/discourse.git -b tests-passed | ||
</pre> | </pre> | ||
| Line 30: | Line 30: | ||
<pre> | <pre> | ||
cd discourse | [host]$ cd discourse | ||
</pre> | </pre> | ||
| Line 36: | Line 36: | ||
<pre> | <pre> | ||
vagrant up | [host]$ vagrant up | ||
</pre> | </pre> | ||
| Line 44: | Line 44: | ||
<pre> | <pre> | ||
vagrant ssh | [host]$ vagrant ssh | ||
</pre> | </pre> | ||
| Line 50: | Line 50: | ||
<pre> | <pre> | ||
cd /vagrant | [vagrant]$ cd /vagrant | ||
</pre> | </pre> | ||
| Line 56: | Line 56: | ||
<pre> | <pre> | ||
bundle install | [vagrant]$ bundle install | ||
</pre> | </pre> | ||
| Line 62: | Line 62: | ||
<pre> | <pre> | ||
bundle exec rake db:migrate | [vagrant]$ bundle exec rake db:migrate | ||
</pre> | </pre> | ||
Create an admin user: | Create an admin user: | ||
<pre> | <pre> | ||
bundle exec rake admin:create | [vagrant]$ bundle exec rake admin:create | ||
</pre> | </pre> | ||
| Line 84: | Line 84: | ||
(replacing <code><username></code> with the admin username) | (replacing <code><username></code> with the admin username) | ||
=== Stopping the development environment === | |||
To stop the server, kill it with <code>^C</code> | |||
Exit the VM and stop it: | |||
<pre> | |||
[vagrant]$ exit | |||
[host]$ vagrant halt | |||
</pre> | |||
=== Updating the development environment === | |||
You should regularly pull in changes from upstream, do this with: | |||
<pre> | |||
[host]$ git pull origin tests-passed | |||
</pre> | |||
After every update, you'll need to update the installed gems and run the db migrations: | |||
<pre> | |||
[host]$ vagrant up | |||
[host]$ vagrant ssh | |||
[vagrant]$ cd /vagrant | |||
[vagrant]$ bundle install | |||
[vagrant]$ bundle exec rake db:migrate | |||
</pre> | |||
=== Using the development environment === | |||
Discourse can now be worked on in your favourite editor, outside of the VM, and the changes will reflect themselves inside: | |||
<pre> | |||
[host]$ cd discourse | |||
[host]$ atom . | |||
</pre> | |||
Modifying the Rails app (changing <code>.rb</code> files) will require you to kill and restart the server: | |||
<pre> | |||
[vagrant]$ ^C | |||
[vagrant]$ bundle exec rails s -b 0.0.0.0 | |||
</pre> | |||
Modifying the Ember app (changing <code>.js</code>, <code>.hbs</code> or <code>.css</code>) files only requires a page refresh. Occasionally the temporary files folder needs to be wiped, so if something isn't working as expected try: | |||
<pre> | |||
[vagrant]$ ^C | |||
[vagrant]$ rm -rf tmp | |||
[vagrant]$ bundle exec rails s -b 0.0.0.0 | |||
</pre> | |||
Most of development work within Mozilla is done on plugins. To keep your code clean we suggest cloning plugins into separate directories, and then linking to them in the <code>discourse/plugins</code> directory. | |||
A method which works for one developer is: | |||
<pre> | |||
[host]$ git clone https://github.com/LeoMcA/discourse-mozillians.git | |||
[host]$ mkdir discourse/plugins/discourse-mozillians | |||
[host]$ sudo mount -o bind ~/Projects/discourse-mozillians ~/Projects/discourse/plugins/discourse-mozillians | |||
</pre> | |||