Skip to content

Commit

Permalink
add coffeescripts compile and jasmine test on compiled coffee
Browse files Browse the repository at this point in the history
  • Loading branch information
siuying committed Mar 23, 2012
1 parent f04381f commit 2d75c8b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 72 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ gem 'sprockets'
gem 'jasmine-headless-webkit', :git => 'git://github.com/johnbintz/jasmine-headless-webkit.git', :branch => 'master'

gem 'guard-rake'
gem 'guard-coffeescript'
gem 'guard-sprockets2'
gem 'guard-jasmine-headless-webkit'

Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ GEM
guard (1.0.1)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-coffeescript (0.5.6)
coffee-script (>= 2.2.0)
guard (>= 0.8.3)
guard-jasmine-headless-webkit (0.3.2)
guard (>= 0.4.0)
jasmine-headless-webkit (>= 0.7.0)
Expand Down Expand Up @@ -83,6 +86,7 @@ PLATFORMS

DEPENDENCIES
coffee-script
guard-coffeescript
guard-jasmine-headless-webkit
guard-rake
guard-sprockets2
Expand Down
11 changes: 10 additions & 1 deletion Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@ require 'rubygems'
require 'bundler/setup'
require './sprockets_helper'

guard 'coffeescript', :output => 'app/javascripts/compiled' do
watch(%r{^app/coffeescripts/.*\.coffee$})
end

guard 'coffeescript', :output => 'spec/javascripts/compiled' do
watch(%r{^spec/coffeescripts/.*\.coffee$})
end

guard 'sprockets2',
:sprockets => SprocketsHelper.environment,
:precompile => [/\w+\.(?!js|css|scss|coffee).+/, /application.(css|js)$/ ],
:digest => false,
:gz => false do
watch(%r{^app/(images|javascripts|stylesheets)/.+$})
watch("config/assets.yml")
end

guard 'jasmine-headless-webkit' do
watch(%r{^spec/(.+)_spec\.(js\.coffee|js|coffee)}) { |m| newest_js_file("spec/#{m[1]}_spec.#{m[2]}") }
watch(%r{^lib/(.+)\.(js\.coffee|js)|coffee}) { |m| newest_js_file("spec/lib/#{m[1]}_spec.#{m[2]}") }
watch(%r{spec/spec_helper\.(js\.coffee|js|coffee)}) { "spec" }
end
end
Empty file added app/coffeescripts/.gitignore
Empty file.
Empty file.
Empty file added spec/coffeescripts/.gitignore
Empty file.
Empty file.
75 changes: 4 additions & 71 deletions spec/javascripts/support/jasmine.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,7 @@
# src_files
#
# Return an array of filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# src_files:
# - lib/source1.js
# - lib/source2.js
# - dist/**/*.js
#
src_dir: app/javascripts
src_files:
- public/assets/application.js
- "**/*.js"

# stylesheets
#
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# stylesheets:
# - css/style.css
# - stylesheets/*.css
#
stylesheets:
- public/assets/application.css

# helpers
#
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
# Default: ["helpers/**/*.js"]
#
# EXAMPLE:
#
# helpers:
# - helpers/**/*.js
#
helpers:

# spec_files
#
# Return an array of filepaths relative to spec_dir to include.
# Default: ["**/*[sS]pec.js"]
#
# EXAMPLE:
#
# spec_files:
# - **/*[sS]pec.js
#
spec_dir: spec/javascripts
spec_files:

# src_dir
#
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
# Default: project root
#
# EXAMPLE:
#
# src_dir: public
#
src_dir:

# spec_dir
#
# Spec directory path. Your spec_files must be returned relative to this path.
# Default: spec/javascripts
#
# EXAMPLE:
#
# spec_dir: spec/javascripts
#
spec_dir:
- "**/*[sS]pec.js"

0 comments on commit 2d75c8b

Please sign in to comment.