Class: Rake::CoffeeTask
- Inherits:
-
TaskLib
- Object
- TaskLib
- Rake::CoffeeTask
- Defined in:
- lib/rake_coffee.rb
Instance Attribute Summary collapse
-
#compile_opts ⇒ Object
Returns the value of attribute compile_opts.
-
#lint_opts ⇒ Object
Returns the value of attribute lint_opts.
-
#test_cmd ⇒ Object
Returns the value of attribute test_cmd.
-
#test_coverage_cmd ⇒ Object
Returns the value of attribute test_coverage_cmd.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize {|_self| ... } ⇒ CoffeeTask
constructor
A new instance of CoffeeTask.
Constructor Details
#initialize {|_self| ... } ⇒ CoffeeTask
Returns a new instance of CoffeeTask.
13 14 15 16 17 18 19 20 |
# File 'lib/rake_coffee.rb', line 13 def initialize @test_cmd = "mocha" @test_coverage_cmd = "istanbul cover _mocha" @lint_opts = "" @compile_opts = "--bare" yield self if block_given? define end |
Instance Attribute Details
#compile_opts ⇒ Object
Returns the value of attribute compile_opts.
10 11 12 |
# File 'lib/rake_coffee.rb', line 10 def compile_opts @compile_opts end |
#lint_opts ⇒ Object
Returns the value of attribute lint_opts.
10 11 12 |
# File 'lib/rake_coffee.rb', line 10 def lint_opts @lint_opts end |
#test_cmd ⇒ Object
Returns the value of attribute test_cmd.
10 11 12 |
# File 'lib/rake_coffee.rb', line 10 def test_cmd @test_cmd end |
#test_coverage_cmd ⇒ Object
Returns the value of attribute test_coverage_cmd.
10 11 12 |
# File 'lib/rake_coffee.rb', line 10 def test_coverage_cmd @test_coverage_cmd end |
Instance Method Details
#define ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rake_coffee.rb', line 22 def define task :default => :test coffee_files = ::Rake::FileList["**/*.coffee"] js_files = coffee_files.ext("js") desc "compile CoffeeScript files" task :compile => js_files rule ".js" => ".coffee" do |t| sh "coffeelint #{lint_opts} #{t.source}" sh "coffee --compile #{compile_opts} #{t.source}" end desc "run unit test" task :test => :compile do sh test_cmd end desc "push to a shared repository" task :push => :test do sh "git push" end desc "run unit test with coverage report" task :cov => :compile do sh test_coverage_cmd end end |