/code-dot-org

The code powering code.org and studio.code.org

Primary LanguageJavaScript

Build setup

Windows note: use an Ubuntu VM

Many Windows developers have found that setting up an Ubuntu virtual machine is less painful than getting Ruby and other prerequisites running on Windows.

Install OS-specific prerequisites

OS X Mavericks / Yosemite

  1. Install Homebrew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. brew install https://raw.github.com/quantiverge/homebrew-binary/pdftk/pdftk.rb enscript gs mysql imagemagick rbenv ruby-build coreutils
  3. If it complains about an old version of <package>, run brew unlink <package> and run brew install <package> again
  4. Set up MySQL
  5. Have launchd start mysql at login: ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
  6. Start mysql now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  7. Set up RBENV and Ruby 2.0
  8. Add if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi to ~/.profile
  9. source ~/.profile
  10. rbenv install 2.0.0-p451
  11. rbenv global 2.0.0-p451
  12. rbenv rehash

Ubuntu 14.04

  1. sudo aptitude update
  2. sudo aptitude upgrade
  3. sudo aptitude install -y git mysql-server mysql-client libmysqlclient-dev libxslt1-dev libssl-dev zlib1g-dev imagemagick libmagickcore-dev libmagickwand-dev nodejs npm openjdk-7-jre-headless libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev curl pdftk
  • Hit enter and select default options for any configuration popups

Common setup

  1. git clone https://github.com/code-dot-org/code-dot-org.git
  2. gem install bundler
  3. rbenv rehash (if using rbenv)
  4. cd code-dot-org/aws
  5. bundle install
  6. cd ..
  7. rake install

Organizational Structure

Our code is segmented into four parts:

  • Blockly Core is the visual programming language platform used for the interactive tutorials.
  • Blockly includes apps—blockly puzzles built based on Blockly Core.
  • Dashboard, is the tutorial platform which organizes blockly levels into tutorials.
  • Pegasus is the main site which also includes the teacher dashboard (support for teachers to track student progress).

Running Dashboard

  1. cd code-dot-org
  2. rake build:dashboard (Generally, do this after each pull)
  3. bin/dashboard-server
  4. Visit http://localhost.studio.code.org:3000/

Running Pegasus

  1. cd code-dot-org
  2. rake build:pegasus (Generally, do this after each pull)
  3. bin/pegasus-server
  4. Visit http://localhost.code.org:9393/

Building Blockly and Blockly-core (optional)

The learn.code.org default dashboard install includes a static build of blockly, but if you want to make modifications to blockly or blockly-core you'll want to enable building them in the build:

Enabling Blockly Builds

You'll need to do this once:

  1. OS X:
  2. Install the Java 8 JDK
  3. Install XQuartz (NOTE: This is required to build the Canvas dependency).
  4. cd code-dot-org
  5. Edit locals.yml
  6. Add build_blockly: true
  7. Add build_blockly_core: true
  8. Add use_my_blockly: true
  9. rake install

This configures your system to build blockly (and blockly-core) whenever you run rake build and to use the version of blockly that you build yourself.

Building Blockly and Blockly-Core

  1. cd code-dot-org
  2. rake build

This will build everything you have set to build in locals.yml.

You can use rake build:blockly and rake build:blockly_core to build a specific project.

You can also set build_dashboard: false and/or build_pegasus: false in locals.yml if you don't need to build these frequently. They default to true.

Contributing

We'd love to have you join our group of contributors!

Before You Push

Anyone who would like to contribute to code.org projects must read and sign the Contributor License Agreement. We can't accept pull requests from contributors who haven't yet signed the CLA.

Getting Started Contributing

HipChat room

Join our community development HipChat room for help getting set up, picking a task, etc. We're happy to have you!

If you want to make sure you get our attention, include an @all (everyone) or @here (everyone currently in the room) in your message.

Contribution ideas

We maintain a Pivotal Tracker board with volunteer-friendly bug tasks, project ideas and small infrastructure/code quality opportunities here: https://www.pivotaltracker.com/n/projects/1192642

If you'd like to grab a task, have ideas for projects or want to discuss an item, email brian@code.org for a board invite.

Submitting Contributions

Testing your changes

Manually

We support recent versions of Firefox, Chrome, IE9, iOS Safari and the Android browsers. Be sure to try your feature out in IE9, iOS and Android if it's a risk. BrowserStack live or Sauce Labs manual let you run manual tests in these browsers remotely.

Unit tests

For dashboard changes, be sure to test your changes using rake test. For blockly changes, see our grunt testing instructions.

UI tests

Our continuous integration server regularly runs a suite of UI tests using Selenium / Cucumber which run against many browsers via BrowserStack Automate, and can also be run locally using chromedriver. See the README in that folder for instructions.

If your changes might affect level paths, blockly UI, or critical path site logic, be sure to test your changes with a local UI test.

Submitting your Pull Request

Contributors should follow the GitHub fork-and-pull model to submit pull requests into this repository.

  1. On your fork, you'll either push to your own finished branch or checkout a new branch for your feature before you start your feature
    • git checkout -b branch_name
  2. Develop the new feature and push the changes to your fork and branch
    • git add YYY
    • git commit -m "ZZZ"
    • git push origin branch_name
  3. Go to the code-dot-org GitHub page
  4. For your submission to be reviewed
    • Click on the "Pull Request" link, look over and confirm your diff
    • Submit a pull request for your branch to be merged into staging
    • For bonus points, include screenshots in the description. Command + Ctrl + Shift + 4 in OS X lets you copy a screen selection to your clipboard, which GitHub will let you paste right into the description
  5. After your pull request is merged into staging, you can review your changes on the following sites: