Module: Js2coffee
- Defined in:
- lib/js2coffee.rb,
lib/js2coffee/version.rb,
lib/js2coffee/watcher.rb,
lib/js2coffee/compiler.rb,
lib/js2coffee/js_compiler.rb,
lib/js2coffee/path_helper.rb,
lib/js2coffee/coffee_compiler.rb
Defined Under Namespace
Classes: CoffeeCompiler, Compiler, JsCompiler, PathHelper, Watcher
Constant Summary
collapse
- VERSION =
[1, 0, 1]
Class Method Summary
collapse
Class Method Details
.compile(coffee, options = {}) ⇒ Object
20
21
22
23
|
# File 'lib/js2coffee.rb', line 20
def self.compile(coffee, options={})
output = $script_extname == 'coffee' ? CoffeeCompiler.compile(coffee, options) : JsCompiler.compile(coffee, options)
pretty_print(output.to_s)
end
|
.compile_file(file, options = {}) ⇒ Object
.pretty_print(output) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/js2coffee.rb', line 25
def self.pretty_print(output)
unless output.empty?
token = CodeRay.scan(output, :js)
print $stdout.tty? ? token.terminal : token.text
end
end
|
.send_notify(message) ⇒ Object
36
37
38
|
# File 'lib/js2coffee.rb', line 36
def self.send_notify(message)
`notify-send '#{message}' -t 1000` if system 'which notify-send &>/dev/null'
end
|
.watch! ⇒ Object
32
33
34
|
# File 'lib/js2coffee.rb', line 32
def self.watch!
Watcher.instance
end
|
.watch_file(file) ⇒ Object