Class: Alloy::Chore::CoffeeScript

Inherits:
Object
  • Object
show all
Defined in:
lib/alloy/chore/coffee_script.rb

Class Method Summary collapse

Class Method Details

.runObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/alloy/chore/coffee_script.rb', line 6

def self.run
  puts "Compiling CoffeeScript".blue

  failed = false
  paths = `find app -name '*.coffee'`.split("\n")

  paths.each do |path|
    out_dir = path.gsub(/^app/, 'Resources').gsub(/\/[\w-]*\.coffee$/,"")
    unless system "coffee -c -b -o #{out_dir} #{path}"
      puts "Compilation failed: #{path}".red
      failed = true
    end
  end

  puts "Successfully compiled CoffeeScript".green unless failed
  not failed
end