Skip to content

Commit

Permalink
Finish Node.js conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
erithmetic committed Nov 10, 2011
1 parent 48b4c58 commit 9913ee3
Show file tree
Hide file tree
Showing 15 changed files with 20,204 additions and 271 deletions.
13 changes: 13 additions & 0 deletions Cakefile
@@ -1,4 +1,5 @@
path = require 'path'
fs = require 'fs'

rails_root = __dirname

Expand All @@ -8,6 +9,18 @@ node_paths = [
path.resolve(rails_root, 'vendor', 'assets', 'javascripts')
].join(':')

task 'build', ->
console.log 'Browserifying...'
browserify = require 'dkastner-browserify'
b = browserify()
b.require('jquery-browserify')
b.require('dkastner-http-browserify')
b.alias('jquery', 'jquery-browserify')
b.alias('http', 'dkastner-http-browserify')
b.addEntry('app/assets/javascripts/application.js')
fs.writeFileSync('public/javascripts/application.js', b.bundle())
console.log 'Done'

task 'examples', 'Run Jasmine examples', ->
child = require 'child_process'
child_env = process.env
Expand Down
238 changes: 111 additions & 127 deletions Gemfile.lock
@@ -1,160 +1,144 @@
GEM
remote: http://rubygems.org/
specs:
aaronh-chronic (0.3.9)
abstract (1.0.0)
actionmailer (3.0.5)
actionpack (= 3.0.5)
mail (~> 2.2.15)
actionpack (3.0.5)
activemodel (= 3.0.5)
activesupport (= 3.0.5)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.5)
activesupport (= 3.0.5)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.5)
activemodel (= 3.0.5)
activesupport (= 3.0.5)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.5)
activemodel (= 3.0.5)
activesupport (= 3.0.5)
activesupport (3.0.5)
arel (2.0.10)
bson_ext (1.3.1)
builder (2.1.2)
capybara (1.0.0.beta1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.4)
childprocess (0.1.9)
actionmailer (3.1.0.rc8)
actionpack (= 3.1.0.rc8)
mail (~> 2.3.0)
actionpack (3.1.0.rc8)
activemodel (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.2)
rack-cache (~> 1.0.3)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.0.beta.15)
activemodel (3.1.0.rc8)
activesupport (= 3.1.0.rc8)
bcrypt-ruby (~> 3.0.0)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.0.rc8)
activemodel (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.0.rc8)
activemodel (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
activesupport (3.1.0.rc8)
multi_json (~> 1.0)
ansi (1.4.0)
arel (2.2.1)
bcrypt-ruby (3.0.1)
builder (3.0.0)
childprocess (0.2.2)
ffi (~> 1.0.6)
configuration (1.2.0)
crack (0.1.8)
cucumber (0.10.5)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.4.0)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
cucumber-rails (0.5.1)
capybara (>= 1.0.0.beta1)
cucumber (>= 0.10.3)
nokogiri (>= 1.4.4)
rack-test (>= 0.5.7)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
fakeweb (1.3.0)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
multi_json (~> 1.0)
ffi (1.0.9)
gherkin (2.4.0)
json (>= 1.4.6)
heroku (2.2.4)
launchy (>= 0.3.2)
rest-client (~> 1.6.1)
term-ansicolor (~> 1.0.5)
hike (1.2.1)
hoptoad_notifier (2.4.11)
activesupport
builder
httparty (0.7.7)
crack (= 0.1.8)
i18n (0.6.0)
jasmine (1.0.2.1)
json_pure (>= 1.4.3)
jasmine (1.1.2)
jasmine-core (>= 1.1.0)
rack (>= 1.1)
rspec (>= 1.3.1)
selenium-webdriver (>= 0.1.3)
json (1.5.1)
json_pure (1.5.1)
launchy (0.4.0)
configuration (>= 0.0.5)
rake (>= 0.8.1)
mail (2.2.19)
activesupport (>= 2.3.6)
jasmine-core (1.1.0)
json (1.6.1)
json_pure (1.6.1)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
nokogiri (1.4.4)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
mime-types (1.17.2)
multi_json (1.0.3)
nodeify (0.0.1)
execjs
rails (~> 3.1.0.rc8)
sandbox
sprockets
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.0.3)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-test (0.5.7)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.0.5)
actionmailer (= 3.0.5)
actionpack (= 3.0.5)
activerecord (= 3.0.5)
activeresource (= 3.0.5)
activesupport (= 3.0.5)
rails (3.1.0.rc8)
actionmailer (= 3.1.0.rc8)
actionpack (= 3.1.0.rc8)
activerecord (= 3.1.0.rc8)
activeresource (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
bundler (~> 1.0)
railties (= 3.0.5)
railties (3.0.5)
actionpack (= 3.0.5)
activesupport (= 3.0.5)
railties (= 3.1.0.rc8)
railties (3.1.0.rc8)
actionpack (= 3.1.0.rc8)
activesupport (= 3.1.0.rc8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
thor (~> 0.14.4)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rest-client (1.6.3)
mime-types (>= 1.16)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rdoc (3.11)
json (~> 1.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
rspec-mocks (2.7.0)
rubyzip (0.9.4)
selenium-webdriver (0.2.1)
childprocess (>= 0.1.7)
ffi (>= 1.0.7)
sandbox (0.1.1)
sass (3.1.10)
sass-rails (3.1.0.rc.7)
actionpack (~> 3.1.0.rc6)
railties (~> 3.1.0.rc6)
sass (>= 3.1.4)
selenium-webdriver (2.10.0)
childprocess (>= 0.2.1)
ffi (= 1.0.9)
json_pure
rubyzip
term-ansicolor (1.0.5)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.4)
thor (0.14.6)
timecop (0.3.5)
treetop (1.4.9)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.27)
watchr (0.7)
xpath (0.1.4)
nokogiri (~> 1.3)
turn (0.8.3)
ansi
tzinfo (0.3.31)
uglifier (1.0.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)

PLATFORMS
ruby

DEPENDENCIES
aaronh-chronic
bson_ext (>= 1.0.9)
capybara
cucumber
cucumber-rails
fakeweb
heroku
hoptoad_notifier
httparty
jasmine
rails (= 3.0.5)
rspec
rspec-rails
timecop
watchr
nodeify
rails (= 3.1.0.rc8)
sass-rails (~> 3.1.0.rc)
sqlite3
turn
uglifier
2 changes: 1 addition & 1 deletion app/assets/javascripts/controllers/hoot-bar-controller.js
@@ -1,4 +1,4 @@
var $ = require('jquery-browserify');
var $ = require('jquery');

var HootBarController = module.exports = function(indexController) {
this.indexController = indexController;
Expand Down
10 changes: 5 additions & 5 deletions app/assets/javascripts/views/route-view.js
Expand Up @@ -38,16 +38,16 @@ RouteView.prototype.toggleDirections = function() {
$('#routing').toggle();
};

RouteView.prototype.updateSegmentEmissions = function(emissionEstimate) {
RouteView.prototype.updateSegmentEmissions = function(impacts) {
var output;
var value = NumberFormatter.kilogramsToPounds(emissionEstimate.value(), 4);
if(emissionEstimate.methodology) {
output = '<a href="' + emissionEstimate.methodology + '">' + value + ' lbs CO₂</a>';
var value = NumberFormatter.kilogramsToPounds(impacts.carbon, 4);
if(impacts.methodology) {
output = '<a href="' + impacts.methodology + '">' + value + ' lbs CO₂</a>';
} else {
output = value.toString() + ' lbs CO₂';
}

$('#' + this.mode + '_segment_' + emissionEstimate.emitter.index + ' span.emissions').html(output);
$('#' + this.mode + '_segment_' + impacts.subject.index + ' span.emissions').html(output);
};

RouteView.prototype.updateTotalEmissions = function() {
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/index.html.erb
Expand Up @@ -7,7 +7,7 @@
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<meta charset="utf-8" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?libraries=geometry&sensor=false"></script>
<%= javascript_include_tag :application %>
<script type="text/javascript" src="/javascripts/application.js"></script>
<%= hoptoad_javascript_notifier %>
<script type="text/javascript">
var _gaq = _gaq || [];
Expand Down
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -8,22 +8,22 @@
"files": ["lib"],
"dependencies": {
"async": "*",
"http-browserify": "*",
"jasmine-node": "*",
"jasmine-jquery": "*",
"jquery": "*",
"cm1-route": "http://github.com/brighterplanet/cm1-route/raw/master/cm1-route.tar.gz",
"dkastner-http-browserify": "*",
"jquery-browserify": "*",
"jquery-placeholdize": "*",
"jquery.ui.core": "*",
"jquery.ui.widget": "*",
"jquery.ui.position": "*",
"jquery.ui.dialog": "*",
"jquery.effects.core": "*",
"jquery.effects.drop": "*",
"jquery.effects.slide": "*",
"cm1-route": "http://github.com/brighterplanet/native-route/raw/master/cm1-route.tar.gz",
"querystring": "*"
"socket.io-client": "*"
},
"devDependencies": {
"browserify": "*",
"dkastner-browserify": "*",
"coffee-script": "*",
"fakeweb": "*",
"jsdom": "*",
"sinon": "*",
Expand Down

0 comments on commit 9913ee3

Please sign in to comment.