Permalink
Browse files

Use coffee-script gem to compilet coffeescript

  • Loading branch information...
1 parent c10f789 commit ac64d51b92a6d19092ea880cad1b30427e92ab8f Anders Törnqvist and Antony Sastre committed with Anders Törnqvist and Antony Sastre Jan 14, 2011
Showing with 8 additions and 5 deletions.
  1. +5 −0 Gemfile.lock
  2. +1 −0 evergreen.gemspec
  3. +2 −5 lib/evergreen/spec.rb
View
5 Gemfile.lock
@@ -3,6 +3,7 @@ PATH
specs:
evergreen (0.4.0)
capybara (~> 0.4.0)
+ coffee-script (~> 2.1)
json_pure (>= 1.0.0)
launchy (>= 0.3.5)
sinatra (>= 1.1)
@@ -25,6 +26,9 @@ GEM
celerity (0.8.2)
childprocess (0.1.3)
ffi (~> 0.6.3)
+ coffee-script (2.1.1)
+ coffee-script-source
+ coffee-script-source (1.0.0)
configuration (1.1.0)
culerity (0.2.12)
diff-lcs (1.1.2)
@@ -74,6 +78,7 @@ PLATFORMS
DEPENDENCIES
capybara (~> 0.4.0)
capybara-envjs (~> 0.4.0)
+ coffee-script (~> 2.1)
evergreen!
json_pure (>= 1.0.0)
launchy (>= 0.3.5)
View
1 evergreen.gemspec
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("launchy", [">= 0.3.5"])
s.add_runtime_dependency("sinatra", [">= 1.1"])
s.add_runtime_dependency("json_pure", [">= 1.0.0"])
+ s.add_runtime_dependency("coffee-script", ["~> 2.1"])
s.add_development_dependency('rspec', ['~> 2.0'])
s.add_development_dependency('capybara-envjs', ['~> 0.4.0'])
View
7 lib/evergreen/spec.rb
@@ -2,8 +2,6 @@
module Evergreen
class Spec
- class CoffeeScriptError < StandardError; end
-
attr_reader :name, :suite
def initialize(suite, name)
@@ -20,10 +18,9 @@ def full_path
end
def read
+ require 'coffee-script'
if full_path =~ /\.coffee$/
- stdout, stderr = Open3.popen3("coffee -p #{full_path}")[1,2].map { |b| b.read }
- raise CoffeeScriptError, stderr unless stderr.empty?
- stdout
+ CoffeeScript.compile File.read(full_path)
else
File.read(full_path)
end

0 comments on commit ac64d51

Please sign in to comment.