Skip to content

Commit 1623143

Browse files
committed
Merge remote-tracking branch 'origin/staging' into staging
Conflicts: dashboard/config/videos.csv
2 parents 0e5bcd2 + dc9c4ae commit 1623143

File tree

6,798 files changed

+476374
-254454
lines changed

Some content is hidden

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

6,798 files changed

+476374
-254454
lines changed

README.md

Lines changed: 38 additions & 25 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`
@@ -33,27 +33,18 @@ Many Windows developers have found that setting up an Ubuntu virtual machine is
3333

3434
1. `sudo aptitude update`
3535
1. `sudo aptitude upgrade`
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 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`
3737
* **Hit enter and select default options for any configuration popups**
38-
1. `sudo aptitude install npm`
39-
1. `sudo ln -s /usr/bin/nodejs /usr/bin/node`
40-
1. `sudo npm update -g npm`
41-
1. `sudo npm install -g grunt-cli`
4238

4339
## Common setup
4440

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

5849
## Organizational Structure
5950

@@ -72,25 +63,47 @@ Our code is segmented into four parts:
7263
## Running Dashboard
7364

7465
1. `cd code-dot-org`
75-
2. `rake build:dashboard`
66+
2. `rake build:dashboard` (Generally, do this after each pull)
7667
3. `bin/dashboard-server`
7768
4. Visit [http://localhost.studio.code.org:3000/](http://localhost.studio.code.org:3000/)
7869

7970
## Running Pegasus
8071

8172
1. `cd code-dot-org`
82-
2. `rake build:pegasus`
73+
2. `rake build:pegasus` (Generally, do this after each pull)
8374
3. `bin/pegasus-server`
8475
4. Visit [http://localhost.code.org:9393/](http://localhost.code.org:9393/)
8576

8677
## Building Blockly and Blockly-core (optional)
8778

88-
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`
94+
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.
89105

90-
1. `cd code-dot-org/dashboard`
91-
1. `bundle exec rake 'blockly:dev[../blockly]'`
92-
* This symlinks to dashboard reference the dev version of blockly
93-
1. Follow the blockly build instructions at `blockly/README` or blockly-core build instructions at `blockly-core/README`
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`.
94107

95108
## Contributing
96109

@@ -146,7 +159,7 @@ Contributors should follow the GitHub [fork-and-pull model](https://help.github.
146159
- `git push origin branch_name`
147160
3. Go to the code-dot-org GitHub page
148161
- [https://github.com/code-dot-org/code-dot-org](https://github.com/code-dot-org/code-dot-org)
149-
4. For your submissinon to be reviewed
162+
4. For your submission to be reviewed
150163
- Click on the "Pull Request" link, look over and confirm your diff
151164
- Submit a pull request for your branch to be merged into staging
152165
- 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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require_relative './deployment'
2+
require 'os'
23
require 'cdo/hip_chat'
34
require 'cdo/rake_utils'
45

@@ -178,6 +179,16 @@ namespace :install do
178179
blockly_build = CDO.use_my_blockly ? blockly_dir('build/package') : 'blockly-package'
179180
RakeUtils.ln_s blockly_build, dashboard_dir('public','blockly')
180181
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
181192
end
182193
end
183194

bin/activity-monitor

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/usr/bin/env ruby
2-
require 'csv'
3-
require_relative '../deployment'
2+
# including dashboard environment doesn't work if not in the dashboard dir
3+
Dir.chdir(File.expand_path('../../dashboard', __FILE__))
4+
require_relative '../dashboard/config/environment'
45
require 'cdo/only_one'
56
require 'cdo/hip_chat'
67
require 'cdo/user_agent_parser'
78

9+
810
FiveMinutes = 5 * 60 * 1000
911
OneHour = 60 * 60 * 1000
1012
OneDay = 24 * OneHour
@@ -37,7 +39,8 @@ HardLevelAttemptsPerHour = {
3739
1108 => 10,
3840
1110 => 10,
3941
1430 => 10,
40-
1434 => 10
42+
1434 => 10,
43+
1441 => 10
4144
}
4245

4346
MinimumAttemptsPerHour = 5
@@ -141,6 +144,26 @@ class Monitor
141144

142145
end
143146

147+
BrowserToBrowserStack = {
148+
'IE 11.0' => {os: 'Windows', os_version: '8.1', browser: 'IE', browser_version: '11.0'},
149+
'IE 10.0' => {os: 'Windows', os_version: '7', browser: 'IE', browser_version: '10.0'},
150+
'IE 9.0' => {os: 'Windows', os_version: '7', browser: 'IE', browser_version: '9.0'},
151+
'Chrome' => {os: 'Windows', os_version: '8.1', browser: 'Chrome', browser_version: '39.0'},
152+
'Firefox' => {os: 'Windows', os_version: '8.1', browser: 'Firefox', browser_version: '33.0'},
153+
'Safari' => {os: 'OS X', os_version: 'Yosemite', browser: 'Safari', browser_version: '8.0'},
154+
'Android' => {os: 'android', os_version: '4.4', device: 'Samsung Galaxy S5'},
155+
'Mobile Safari' => {os: 'ios', os_version: '8.0', device: 'iPad Air'},
156+
'Opera Mini' => {os: 'opera', device: 'Samsung Galaxy Tab'}
157+
}
158+
159+
def browserstack_url(browser, destination_url)
160+
params = BrowserToBrowserStack[browser]
161+
return nil unless params
162+
163+
# eg: http://www.browserstack.com/start#os=Windows&os_version=7&browser=IE&browser_version=11.0&zoom_to_fit=true&full_screen=true&autofit=true&url=studio.code.org&resolution=2048x1536&speed=1
164+
"http://www.browserstack.com/start#" + URI.encode_www_form(params.merge(resolution: '2048x1536', url: destination_url))
165+
end
166+
144167
def main()
145168
now = DateTime.now.new_offset(0)
146169

@@ -164,12 +187,18 @@ def main()
164187
rate = starts == 0 ? 1.0 : finishes.to_f / starts.to_f
165188

166189
if status == :fail
167-
log_string =
168-
"<b>#{i[:browser]}</b> hasn't passed <b><a href=\"http://learn.code.org/levels/#{i[:level]}\">level #{i[:level]}</a></b> despite <b>#{i[:starts]}</b> attempts in the last #{hours} hour(s)."
190+
level_url = "http://learn.code.org/levels/#{i[:level]}"
191+
192+
log_string = %Q[<b>#{i[:browser]}</b> hasn't passed <b><a href="#{level_url}">level #{i[:level]}</a></b> despite <b>#{i[:starts]}</b> attempts in the last #{hours} hour(s)]
193+
sl = Level.find(i[:level]).script_levels.first
194+
if sl
195+
level_url = "http://studio.code.org/s/#{sl.script.id}/level/#{sl.id}"
196+
end
197+
log_string += %Q[ <a href="#{browserstack_url(i[:browser], level_url) || level_url}">&#x2708; Repro It</a>]
169198
HipChat.developers log_string, color:'red', notify:1
170199
HipChat.log log_string, color:'red'
171200
end
172-
end
201+
end
173202
end
174203

175204
main if only_one_running?(__FILE__)

bin/force-gsheet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env ruby
2-
require '../deployment'
2+
require File.expand_path('../../deployment', __FILE__)
33
require 'cdo/db'
44

55
def main()

bin/upload-logs-to-s3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require_relative '../deployment'
33

44
def upload_logs(application)
55
raise 'Unknown application.' unless ['dashboard', 'pegasus'].include? application
6-
system "aws s3 sync #{deploy_dir(application, 'log')} s3://cdo-logs/hosts/#{CDO.name}/#{application} --exclude .gitignore"
6+
system "aws s3 sync #{deploy_dir(application, 'log')} s3://cdo-logs/hosts/#{CDO.name}/#{application} --exclude .gitignore 2>&1 > #{deploy_dir(application, 'log', 'uploads-logs-to-s3.log')}"
77
end
88

99
def main

0 commit comments

Comments
 (0)