Permalink
Browse files

compile coffee in spec

  • Loading branch information...
1 parent 5379c43 commit d432ef03f835cceee5362e17b02f37f0f4570674 @le0pard le0pard committed Mar 18, 2013
Showing with 7 additions and 12 deletions.
  1. +1 −12 Rakefile
  2. +6 −0 spec/spec_helper.rb
View
@@ -12,7 +12,6 @@ end
require 'bundler/gem_tasks'
require 'rspec/core'
require 'rspec/core/rake_task'
-require 'coffee-script'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb'].sort_by do|n|
@@ -22,15 +21,5 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
end
end
-namespace :coffee do
- desc 'compile coffee files'
- task :compile do
- Dir["#{File.expand_path(File.join(File.dirname(__FILE__), "lib"))}/**/*.coffee"].each do |coffee|
- File.open(coffee.gsub(/\.coffee$/, ""), 'w') {|f| f.write(CoffeeScript.compile(File.read(coffee))) }
- end
- puts "Coffee files compiled"
- end
-end
-
-task :default => ["coffee:compile", :spec]
+task :default => :spec
View
@@ -8,6 +8,7 @@
require "v8"
require "cgi"
require "active_support/core_ext/hash/slice"
+require 'coffee-script'
def jscontext
@context ||= V8::Context.new
@@ -96,6 +97,11 @@ def draw_routes
jscontext[:log] = lambda {|arg| puts arg.inspect}
end
config.before(:all) do
+ # compile all js files begin
+ Dir["#{File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))}/**/*.coffee"].each do |coffee|
+ File.open(coffee.gsub(/\.coffee$/, ""), 'w') {|f| f.write(CoffeeScript.compile(File.read(coffee))) }
+ end
+ # compile all js files end
draw_routes
end
end

0 comments on commit d432ef0

Please sign in to comment.