Skip to content

Commit

Permalink
upgrade coffee-script to 1.6.2
Browse files Browse the repository at this point in the history
test plan:
  - make sure you have the coffee binary from npm:
    `npm install -g coffee-script@1.6.2`
  - run rake js:generate, make sure all coffeescript still compiles
    correctly
  - open a coffeescript file and make sure it still gets automatically
    compiled when saved by guard.
  - rejoice at the arrival of source maps.

Change-Id: I06ce9e83a76be9d4cc0e2b2c80566a0db19f9d7e
Reviewed-on: https://gerrit.instructure.com/18842
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
QA-Review: Stanley Stuart <stanley@instructure.com>
  • Loading branch information
Stanley Stuart committed Mar 22, 2013
1 parent 117adb2 commit 8045a59
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -21,6 +21,7 @@
/exports/
/Gemfile.lock
/log/
/public/app/
/public/assets/
/public/doc/api/
/public/javascripts/compiled/
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -142,7 +142,7 @@ end

group :development, :test do
gem 'coffee-script'
gem 'coffee-script-source', '1.4.0' #pinned so everyone's compiled output matches
gem 'coffee-script-source', '1.6.2' #pinned so everyone's compiled output matches
gem 'parallel', '0.5.16'
end

Expand Down
11 changes: 11 additions & 0 deletions config/initializers/coffee_script_sourcemaps_symlinks.rb
@@ -0,0 +1,11 @@
if Rails.env.development?
app_dir = File.expand_path "#{Rails.root}/public/app"
FileUtils.makedirs(app_dir) unless File.exists?(app_dir)
symlink = File.expand_path "#{Rails.root}/public/app/coffeescripts"
target = File.expand_path "#{Rails.root}/app/coffeescripts"
unless File.symlink?(symlink) && File.readlink(symlink) == target
File.unlink(symlink) if File.exists?(symlink)
File.symlink(target,symlink)
end
end

2 changes: 1 addition & 1 deletion guard/coffeescript.rb
Expand Up @@ -73,7 +73,7 @@ def compile_files(files, watchers, options)
if Canvas::CoffeeScript.coffee_script_binary_is_available?
Parallel.each(directories.map, :in_threads => Parallel.processor_count) do |(directory, scripts)|
FileUtils.mkdir_p(File.expand_path(directory)) if !File.directory?(directory) && !options[:noop]
system('coffee', '-c', '-o', directory, *scripts)
system('coffee', '-m', '-c', '-o', directory, *scripts)
if $?.exitstatus != 0
Formatter.error("Unable to compile coffeescripts in #{directory}")
else
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/js.rake
Expand Up @@ -80,7 +80,7 @@ namespace :js do
Parallel.each(dirs, :in_threads => Parallel.processor_count) do |dir|
destination = coffee_destination(dir)
FileUtils.mkdir_p(destination)
system("coffee -c -o #{destination} #{dir}/*.coffee")
system("coffee -m -c -o #{destination} #{dir}/*.coffee")
raise "Unable to compile coffeescripts in #{dir}" if $?.exitstatus != 0
end
else
Expand Down
Expand Up @@ -7,7 +7,7 @@ define [
module 'PaginatedCollection',
setup: ->
@server = sinon.fakeServer.create()
@collection = new PaginatedCollection null
@collection = new PaginatedCollection null,
params:
multi: ['foos', 'bars']
single: 1
Expand Down
4 changes: 2 additions & 2 deletions spec/coffeescripts/collections/RolesCollectionSpec.coffee
Expand Up @@ -12,7 +12,7 @@ define [
@account_id = null

test "generate the correct url for a collection of roles", 1, ->
roles_collection = new RolesCollection null
roles_collection = new RolesCollection null,
contextAssetString: "account_#{@account_id}"

equal roles_collection.url(), "/api/v1/accounts/#{@account_id}/roles", "roles collection url"
Expand All @@ -23,7 +23,7 @@ define [
role1 = new Role
role2 = new Role

roles_collection = new RolesCollection null
roles_collection = new RolesCollection null,
contextAssetString: "account_#{@account_id}"

roles_collection.fetch success: =>
Expand Down
4 changes: 2 additions & 2 deletions spec/coffeescripts/views/SyllabusViewSpec.coffee
Expand Up @@ -46,7 +46,7 @@ define [
links = "<#{request.url}>; rel=\"first\""
links += ",<#{request.url}>; rel=\"next\"" if more

request.respond 200
request.respond 200,
'Content-Type': 'application/json'
'Link': links
JSON.stringify response
Expand All @@ -61,7 +61,7 @@ define [
links = "<#{request.url}>; rel=\"first\""
links += ",<#{request.url}>; rel=\"next\"" if more

request.respond 200
request.respond 200,
'Content-Type': 'application/json'
'Link': links
JSON.stringify response
Expand Down
2 changes: 1 addition & 1 deletion spec/coffeescripts/xhr/remoteSelectSpec.coffee
Expand Up @@ -3,7 +3,7 @@ define [
'compiled/xhr/RemoteSelect'
'helpers/loadFixture'
], (_, RemoteSelect, loadFixture) ->
module 'RemoteSelect'
module 'RemoteSelect',
setup: ->
@response = [200, { 'Content-Type': 'application/json' }, '[{ "label": "one", "value": 1 }, {"label": "two", "value": 2 }]']
@fixture = loadFixture 'RemoteSelect'
Expand Down

0 comments on commit 8045a59

Please sign in to comment.