Module: Guard::CoffeeScript::Runner
- Defined in:
- lib/guard/coffeescript/runner.rb
Class Attribute Summary collapse
-
.last_run_failed ⇒ Object
Returns the value of attribute last_run_failed.
Class Method Summary collapse
-
.remove(files, watchers, options = { }) ⇒ Object
The remove function deals with CoffeeScript file removal by locating the output javascript file and removing it.
-
.run(files, watchers, options = { }) ⇒ Array<Array<String>, Boolean>
The CoffeeScript runner handles the CoffeeScript compilation, creates nested directories and the output file, writes the result to the console and triggers optional system notifications.
Class Attribute Details
.last_run_failed ⇒ Object
Returns the value of attribute last_run_failed.
8 9 10 |
# File 'lib/guard/coffeescript/runner.rb', line 8 def last_run_failed @last_run_failed end |
Class Method Details
.remove(files, watchers, options = { }) ⇒ Object
The remove function deals with CoffeeScript file removal by locating the output javascript file and removing it.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/guard/coffeescript/runner.rb', line 43 def remove(files, watchers, = { }) removed_files = [] directories = detect_nested_directories(watchers, files, ) directories.each do |directory, scripts| scripts.each do |file| javascript = javascript_file_name(file, directory) if File.exists?(javascript) FileUtils.remove_file(javascript) removed_files << javascript end end end if removed_files.length > 0 = "Removed #{ removed_files.join(', ') }" Formatter.success() Formatter.notify(, :title => 'CoffeeScript results') end end |
.run(files, watchers, options = { }) ⇒ Array<Array<String>, Boolean>
The CoffeeScript runner handles the CoffeeScript compilation, creates nested directories and the output file, writes the result to the console and triggers optional system notifications.
26 27 28 29 30 31 32 |
# File 'lib/guard/coffeescript/runner.rb', line 26 def run(files, watchers, = { }) notify_start(files, ) changed_files, errors = compile_files(files, watchers, ) notify_result(changed_files, errors, ) [changed_files, errors.empty?] end |