Skip to content

Commit 182307c

Browse files
committed
Merge remote-tracking branch 'remotes/origin/staging' into shapeways_printing_updated
Conflicts: blockly/src/turtle/turtle.js dashboard/public/blockly
2 parents 3e94a8f + 26bbd88 commit 182307c

File tree

8,270 files changed

+1699496
-809421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

8,270 files changed

+1699496
-809421
lines changed

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
.dropbox
55
.idea/
66
/.gdrive_session
7+
/chef/.chef/
8+
/crontab
9+
/dashboard/public/blockly
710
/.dropbox.cache
8-
/aws/secrets.key
9-
/aws/secrets.tgz
1011
/aws/secrets/
1112
/aws/solr/
1213
/build-started
@@ -16,4 +17,7 @@
1617
\#*#
1718
/i18n/code.org/crowdin.yaml
1819
/i18n/hourofcode.com/crowdin.yaml
19-
/i18n/curriculum/crowdin.yaml
20+
/i18n/curriculum/crowdin.yaml
21+
/dashboard/config/newrelic.yml
22+
/pegasus/config/newrelic.yml
23+

README.md

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ Many Windows developers have found that setting up an Ubuntu virtual machine is
1414

1515
## Install OS-specific prerequisites
1616

17-
### OS X Mavericks
17+
### OS X Mavericks / Yosemite
1818

19-
1. Install Homebrew: `ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"`
20-
1. `brew install https://raw.github.com/quantiverge/homebrew-binary/pdftk/pdftk.rb enscript gs mysql imagemagick rbenv ruby-build`
21-
1. If it complains about an old version of `X`, run `brew unlink X` and run `brew install X` again
19+
1. Install Homebrew: `ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
20+
1. `brew install https://raw.github.com/quantiverge/homebrew-binary/pdftk/pdftk.rb enscript gs mysql imagemagick rbenv ruby-build coreutils`
21+
1. If it complains about an old version of `<package>`, run `brew unlink <package>` and run `brew install <package>` again
2222
1. Set up MySQL
2323
1. Have launchd start mysql at login: `ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents`
2424
1. Start mysql now: `launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist`
@@ -31,32 +31,23 @@ Many Windows developers have found that setting up an Ubuntu virtual machine is
3131

3232
### Ubuntu 14.04
3333

34-
1. `sudo apt-get install -y aptitude`
3534
1. `sudo aptitude update`
3635
1. `sudo aptitude upgrade`
37-
1. `sudo aptitude install -y git mysql-server mysql-client libmysqlclient-dev libxslt1-dev libssl-dev zlib1g-dev imagemagick libmagickcore-dev libmagickwand-dev nodejs openjdk-7-jre-headless libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev curl`
36+
1. `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`
3837
* **Hit enter and select default options for any configuration popups**
39-
1. `sudo aptitude install npm`
40-
1. `sudo ln -s /usr/bin/nodejs /usr/bin/node`
41-
1. `sudo npm update -g npm`
42-
1. `sudo npm install -g grunt-cli`
4338

4439
## Common setup
4540

4641
1. `git clone https://github.com/code-dot-org/code-dot-org.git`
4742
1. `gem install bundler`
43+
1. `rbenv rehash` (if using rbenv)
4844
1. `cd code-dot-org/aws`
4945
1. `bundle install`
50-
1. `cd ../dashboard`
51-
1. `bundle install`
52-
1. `bundle exec rake db:create db:schema:load seed:all`
53-
1. `cd ../pegasus`
54-
1. `bundle install`
55-
1. `echo CREATE DATABASE pegasus_development | mysql -uroot`
56-
1. `rake db:migrate`
57-
1. `rake seed:migrate`
46+
1. `cd ..`
47+
1. `rake install`
5848

5949
## Organizational Structure
50+
6051
Our code is segmented into four parts:
6152

6253
* Blockly Core is the visual programming language platform used for the interactive tutorials.
@@ -70,36 +61,57 @@ Our code is segmented into four parts:
7061
* [Teacher Dashboard](http://code.org/teacher-dashboard)
7162

7263
## Running Dashboard
73-
1. `cd code-dot-org/dashboard`
74-
2. `bundle exec rails server`
75-
3. Note: after major code updates (or if something seems broken), run `bundle exec rake db:migrate seed:all`
76-
4. Visit [http://localhost.studio.code.org:3000/](http://localhost.studio.code.org:3000/)
64+
65+
1. `cd code-dot-org`
66+
2. `rake build:dashboard` (Generally, do this after each pull)
67+
3. `bin/dashboard-server`
68+
4. Visit [http://localhost.studio.code.org:3000/](http://localhost.studio.code.org:3000/)
7769

7870
## Running Pegasus
7971

80-
1. `cd code-dot-org/pegasus`
81-
2. `./up`
82-
3. Note: after major code updates (or if something seems broken), run `rake db:migrate seed:migrate`
72+
1. `cd code-dot-org`
73+
2. `rake build:pegasus` (Generally, do this after each pull)
74+
3. `bin/pegasus-server`
8375
4. Visit [http://localhost.code.org:9393/](http://localhost.code.org:9393/)
8476

8577
## Building Blockly and Blockly-core (optional)
8678

87-
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:
79+
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:
80+
81+
### Enabling Blockly Builds
82+
83+
You'll need to do this once:
84+
85+
1. OS X:
86+
1. Install the [Java 8 JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
87+
1. Install [XQuartz](http://xquartz.macosforge.org/trac) (NOTE: This is required to build the Canvas dependency).
88+
1. `cd code-dot-org`
89+
1. Edit `locals.yml`
90+
1. Add `build_blockly: true`
91+
1. Add `build_blockly_core: true`
92+
1. Add `use_my_blockly: true`
93+
1. `rake install`
8894

89-
1. `cd code-dot-org/dashboard`
90-
1. `bundle exec rake 'blockly:dev[../blockly]'`
91-
* This symlinks to dashboard reference the dev version of blockly
92-
1. Follow the blockly build instructions at `blockly/README` or blockly-core build instructions at `blockly-core/README`
95+
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.
96+
97+
### Building Blockly and Blockly-Core
98+
99+
1. `cd code-dot-org`
100+
1. `rake build`
101+
102+
This will build everything you have set to build in `locals.yml`.
103+
104+
You can use `rake build:blockly` and `rake build:blockly_core` to build a specific project.
105+
106+
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`.
93107

94108
## Contributing
95109

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

98112
### Before You Push
99113

100-
Anyone who would like to contribute to **[code.org](https://github.com/code-dot-org/)** projects **must read and sign the Contribution License Agreement**. We aren't able to accept any pull requests from contributors who haven't signed the CLA first.
101-
102-
For the time being—email [[email protected]](mailto:[email protected]) to get an electronic CLA to sign (takes less than a minute).
114+
Anyone who would like to contribute to **[code.org](https://github.com/code-dot-org/)** projects **must read and sign the [Contributor License Agreement](https://na2.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=8eb90665-c9f7-4b06-81a5-11d12020f251)**. We can't accept pull requests from contributors who haven't yet signed the CLA.
103115

104116
### Getting Started Contributing
105117

@@ -145,7 +157,7 @@ Contributors should follow the GitHub [fork-and-pull model](https://help.github.
145157
- `git push origin branch_name`
146158
3. Go to the code-dot-org GitHub page
147159
- [https://github.com/code-dot-org/code-dot-org](https://github.com/code-dot-org/code-dot-org)
148-
4. For your submissinon to be reviewed
160+
4. For your submission to be reviewed
149161
- Click on the "Pull Request" link, look over and confirm your diff
150162
- Submit a pull request for your branch to be merged into staging
151163
- 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

Rakefile

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
require_relative './deployment'
2+
require 'os'
23
require 'cdo/hip_chat'
34
require 'cdo/rake_utils'
45

6+
def create_pegasus_db()
7+
db = URI.parse CDO.pegasus_db_writer
8+
command = [
9+
'mysql',
10+
"--user=#{db.user}",
11+
"--host=#{db.host}",
12+
]
13+
command << "--execute=\"CREATE DATABASE IF NOT EXISTS #{CDO.pegasus_db_name}\""
14+
command << "--password=#{db.password}" unless db.password.nil?
15+
system command.join(' ')
16+
end
17+
518
def with_retries(count=5)
619
begin
720
yield if block_given?
@@ -23,19 +36,16 @@ end
2336
namespace :build do
2437

2538
task :configure do
26-
if CDO.chef_managed && !(rack_env?(:production) && CDO.name =='daemon')
39+
if CDO.chef_managed && !(rack_env?(:production) && CDO.name =='daemon') && !rack_env?(:test) && !rack_env?(:staging)
2740
HipChat.log 'Applying <b>chef</b> profile...'
2841
RakeUtils.sudo 'chef-client'
2942
end
3043

31-
Dir.chdir(aws_dir) do
32-
unless CDO.chef_managed
44+
unless CDO.chef_managed
45+
Dir.chdir(aws_dir) do
3346
HipChat.log 'Installing <b>aws</b> bundle...'
3447
RakeUtils.bundle_install
3548
end
36-
37-
HipChat.log 'Configuring <b>aws</b>...'
38-
RakeUtils.rake
3949
end
4050
end
4151

@@ -81,8 +91,6 @@ namespace :build do
8191
RakeUtils.bundle_install
8292

8393
if CDO.daemon || rack_env?(:levelbuilder)
84-
RakeUtils.rake 'db:create' unless rack_env?(:production)
85-
8694
HipChat.log 'Migrating <b>dashboard</b> database...'
8795
RakeUtils.rake 'db:migrate'
8896

@@ -98,8 +106,9 @@ namespace :build do
98106
HipChat.log 'Starting <b>dashboard</b>.'
99107
RakeUtils.start_service CDO.dashboard_unicorn_name unless rack_env?(:development)
100108

101-
# report deployment to honeybadger
102-
RakeUtils.system 'rake', "honeybadger:deploy TO=#{rack_env} REVISION=`git rev-parse HEAD`"
109+
if rack_env?(:production)
110+
RakeUtils.system 'rake', "honeybadger:deploy TO=#{rack_env} REVISION=`git rev-parse HEAD`"
111+
end
103112
end
104113
end
105114

@@ -163,44 +172,50 @@ task :build => ['build:all']
163172
##################################################################################################
164173

165174
namespace :install do
175+
176+
task :blockly do
177+
if rack_env?(:development) && !CDO.chef_managed
178+
Dir.chdir(blockly_dir) do
179+
blockly_build = CDO.use_my_blockly ? blockly_dir('build/package') : 'blockly-package'
180+
RakeUtils.ln_s blockly_build, dashboard_dir('public','blockly')
181+
end
182+
183+
if OS.linux?
184+
RakeUtils.sudo_ln_s '/usr/bin/nodejs', '/usr/bin/node'
185+
RakeUtils.sudo 'npm', 'update', '-g', 'npm'
186+
RakeUtils.sudo 'npm', 'install', '-g', 'grunt-cli'
187+
elsif OS.mac?
188+
RakeUtils.system 'brew install node'
189+
RakeUtils.system 'npm', 'update', '-g', 'npm'
190+
RakeUtils.system 'npm', 'install', '-g', 'grunt-cli'
191+
end
192+
end
193+
end
166194

167195
task :dashboard do
168-
unless CDO.chef_managed
169-
Dir.chdir(aws_dir) { RakeUtils.rake }
196+
if rack_env?(:development) && !CDO.chef_managed
170197
Dir.chdir(dashboard_dir) do
171198
RakeUtils.bundle_install
172-
unless rack_env?(:production)
173-
RakeUtils.rake 'db:create'
174-
RakeUtils.rake 'db:schema:load'
175-
end
176-
RakeUtils.sudo_ln_s dashboard_dir('config/init.d'), File.join('/etc/init.d', CDO.dashboard_unicorn_name)
177-
RakeUtils.sudo 'update-rc.d', CDO.dashboard_unicorn_name, 'defaults'
178-
RakeUtils.sudo_ln_s dashboard_dir('config/logrotate'), File.join('/etc/logrotate.d', CDO.dashboard_unicorn_name)
179-
RakeUtils.sudo 'service', CDO.dashboard_unicorn_name, 'start'
199+
RakeUtils.rake 'db:create'
200+
RakeUtils.rake 'db:schema:load'
180201
end
181202
end
182203
end
183204

184205
task :pegasus do
185-
unless CDO.chef_managed
186-
Dir.chdir(aws_dir) { RakeUtils.rake }
206+
if rack_env?(:development) && !CDO.chef_managed
187207
Dir.chdir(pegasus_dir) do
188208
RakeUtils.bundle_install
189-
unless rack_env?(:production)
190-
RakeUtils.system 'echo', "'CREATE DATABASE IF NOT EXISTS #{CDO.pegasus_db_name}'", '|', 'mysql', '-uroot'
191-
RakeUtils.rake 'db:migrate'
192-
RakeUtils.rake 'seed:migrate'
193-
end
194-
RakeUtils.sudo_ln_s dashboard_dir('config/init.d'), File.join('/etc/init.d', CDO.pegasus_unicorn_name)
195-
RakeUtils.sudo 'update-rc.d', CDO.pegasus_unicorn_name, 'defaults'
196-
RakeUtils.sudo 'service', CDO.pegasus_unicorn_name, 'start'
209+
create_pegasus_db
210+
RakeUtils.rake 'db:migrate'
211+
RakeUtils.rake 'seed:migrate'
197212
end
198213
end
199214
end
200215

201216
tasks = []
202217
#tasks << :blockly_core if CDO.build_blockly_core
203-
#tasks << :blockly if CDO.build_blockly
218+
tasks << :blockly if CDO.build_blockly
204219
tasks << :dashboard if CDO.build_dashboard
205220
tasks << :pegasus if CDO.build_pegasus
206221
task :all => tasks

aws/.gitignore

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,3 @@
1212
/.website-ci-built
1313
/.websites-built
1414
/.websites-test-built
15-
/bashrc
16-
/crontab
17-
/crontab.installed
18-
/dashboard_unicorn.rb.pid
19-
/pegasus_unicorn.rb.pid
20-
/postfix/main.cf
21-
/postfix/sasl_password
22-
/postfix/sasl_password.db
23-
/profile
24-
/varnish.config
25-
/varnish.secret
26-
/varnish.vcl

0 commit comments

Comments
 (0)