Class: Ti::Compiler::CoffeeScripts
- Inherits:
-
Object
- Object
- Ti::Compiler::CoffeeScripts
show all
- Extended by:
- Utils
- Defined in:
- lib/ti/compiler/coffee_scripts.rb
Class Method Summary
collapse
Methods included from Utils
append_to_router, base_location, create_directories, create_new_file, create_with_template, error, get_app_name, log, remove_directories, remove_files, templates, touch, underscore
Class Method Details
.compile(files, compile_to_location, options = {}) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/ti/compiler/coffee_scripts.rb', line 25
def compile(files, compile_to_location, options={})
coffee_options = []
options.each { |k,v| coffee_options << "--#{k.to_s}" if v} unless options.empty?
system("coffee -p #{coffee_options.join(' ')} #{files} > #{compile_to_location}")
log "Your CoffeeScripts have been compiled to: #{compile_to_location}"
end
|
.compile_all! ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/ti/compiler/coffee_scripts.rb', line 8
def compile_all!
coffeefile = File.read(base_location.join('Coffeefile')).split("\n").compact.delete_if { |l| l.include?("#") }
files = coffeefile.collect { |a| Dir.glob(coffeefile) }.flatten!.uniq
if files.nil?
log "There are no files to compile."
exit(0)
end
compile_main
compile_location = "Resources/#{underscore(get_app_name).downcase}.js"
compile(files.join(' '), base_location.join(compile_location), :join => true, :bare => true)
end
|
.compile_main ⇒ Object
21
22
23
|
# File 'lib/ti/compiler/coffee_scripts.rb', line 21
def compile_main
compile("app/app.coffee", base_location.join("Resources/app.js"), :bare => true)
end
|