Giter Club home page Giter Club logo

code-dot-org's Introduction

Travis says: Build Status

Build setup

This document describes how to set up your workstation to develop for Code.org.

Install OS-specific prerequisites

You can do Code.org development using OSX, Ubuntu, or Windows (running Ubuntu in a VM). Setup for Windows is more complicated and relatively few developers use it. Start with the instructions for your platform in the subsections below, followed by the Common Setup section.

OS X Mavericks / Yosemite

  1. Install Homebrew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Run sudo chown -R $(whoami):admin /usr/local/. (Brew assumes it can write to subdirectories of /usr/local/, which not all installs of OSXallow. Running brew as root is discouraged.)
  3. brew install https://raw.github.com/quantiverge/homebrew-binary/pdftk/pdftk.rb enscript gs mysql imagemagick rbenv ruby-build coreutils sqlite phantomjs
  4. If it complains about an old version of <package>, run brew unlink <package> and run brew install <package> again
  5. Set up MySQL
  6. Have launchd start mysql at login: ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
  7. Start mysql now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  8. Set up RBENV, ruby-build, and Ruby 2.2
  9. Add if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi to ~/.profile or whatever profile gets sourced when you start your terminal
  10. source ~/.profile or whatever you changed in the above step. You should only have to do this once.
  11. git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
  12. rbenv install 2.2.3
  13. rbenv global 2.2.3
  14. rbenv rehash
  15. Set up nvm
  16. These steps are now necessary because of problems with the newest versions of node. We want to be on node 0.12.4 and npm 2.10.1.
  17. Install node version manager brew install nvm 1. follow the instructions in the output of the previous command to finish installing nvm
  18. Install the right version of node nvm install v0.12.4
  19. Make that your default version nvm alias default v0.12.4
  20. reinstall node_modules cd apps; rm -rf node_modules && npm install; cd .. (can be skipped if your version of node did not just change)
  21. Check that you have the correct versions of everything:
  22. open a new Terminal window
  23. ruby --version # --> ruby 2.2.3
  24. nvm ls # --> v0.12.4
  25. node --version # --> v0.12.4
  26. npm --version # --> 2.10.1

Ubuntu 14.04

  1. sudo apt-get update
  2. sudo apt-get install -y git mysql-server mysql-client libmysqlclient-dev libxslt1-dev libssl-dev zlib1g-dev imagemagick libmagickcore-dev libmagickwand-dev openjdk-7-jre-headless libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev curl pdftk libsqlite3-dev phantomjs
  • Hit enter and select default options for any configuration popups
  1. Upgrade npm to 2.0. If npm -v says less than 2.0,
  • sudo add-apt-repository ppa:chris-lea/node.js
  • sudo apt-get update
  • sudo apt-get install nodejs
  1. Either A. Install Ruby 2.2 from OS packages; B. Setup rbenv; or C. Setup rvm
    • A. OS packages (from the Brightbox Ubuntu PPA):
      • sudo apt-get install software-properties-common
      • sudo apt-add-repository ppa:brightbox/ruby-ng
      • sudo apt-get update
      • sudo apt-get install ruby2.2 ruby2.2-dev
    • B. rbenv: (instructions)
      1. Install rbenv and ruby-build
      2. rbenv install 2.2.3
      3. rbenv global 2.2.3
      4. rbenv rehash
    • C. rvm. A few folks have had more luck with rvm vs rbenv on linux.
      1. Install rvm from https://rvm.io/
      2. rvm install 2.2.3
  2. Install Node.js 0.12.4 and npm 2.10.1
  3. Option A - nodesource repository 1. curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash - 1. sudo apt-get install -y nodejs
  4. Option B - Manual install 1. Nodejs.org
  5. Check that you have the correct versions of everything:
  6. open a new Terminal window
  7. ruby --version # --> ruby 2.2.3
  8. node --version # --> v0.12.4
  9. npm --version # --> 2.10.1

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.

  • Option A: Use VMWare Player and an Ubuntu 14.04 iso image
  • Option B: Use vagrant (install):
    1. First clone the code.org git repo to get the provided Vagrantfile (you will be able to skip step 1 of the common setup instructions): git clone https://github.com/code-dot-org/code-dot-org.git
    2. cd code-dot-org
    3. vagrant up
    4. vagrant ssh
    5. Goto step 2 of the common setup instructions
  • Option C: Use AWS EC2: launch Ubuntu 14.04 AMI

Common setup

  1. git clone https://github.com/code-dot-org/code-dot-org.git
  2. sudo gem install bundler -v 1.10.6
  3. rbenv rehash (if using rbenv)
  4. cd code-dot-org/aws
  5. bundle install
  6. cd ..
  7. rake install
  8. rake install:hooks (recommended, to install precommit linting hooks)
  9. rake build
  10. sudo chown -R $(whoami) $HOME/.npm (do we still need this step when using nvm?)

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:3000/

Building Javascript (apps, blockly-core, and shared) (optional)

The studio.code.org default dashboard install includes a static build of blockly and of the shared js, but if you want to make modifications to these you'll want to enable building them in the build:

Enabling Apps Builds

You'll need to do this once:

  1. OS X:
  2. Install the Java 8 JDK
  3. cd code-dot-org
  4. To build apps/blocky-core, edit locals.yml to add:
  5. Add build_apps: true
  6. Add build_blockly_core: true (if you want to build blockly core -- not necessary if you only want to make changes to apps)
  7. Add use_my_apps: true
  8. To build shared js, edit locals.yml to add:
  9. Add build_shared_js: true
  10. Add use_my_shared_js: true
  11. rake install

This configures your system to build apps/blockly-core/shared whenever you run rake build and to use the versions that you build yourself.

Building

  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:apps, rake build:blockly_core and rake build:shared 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.

Alternatively, you can run: rake build:core_and_apps_dev, which will build blockly core and the apps bundle without running tests and without localization.

Contributing

We'd love to have you join our group of contributors! Please e-mail your areas of interest and your availability to Alice ([email protected]), and we’ll be happy to match you with a project. You can start setting up with these next steps.

  1. 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.

  2. 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.

  3. Get your build setup, following this README. Fork our repo and make sure to merge our staging branch in WEEKLY as we do update frequently.

Submitting Contributions

Please check your PR against our tests before submitting.

Code style

Running rake lint locally will find most Ruby warnings. For other languages see the style guide.

Manually

We support recent versions of Firefox, Chrome, IE9, iOS Safari and the Android browsers (full list of supported browsers and versions). 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 apps or 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:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.