Module: Guard::CoffeeScript::Runner
- Defined in:
- lib/guard/coffeescript/runner.rb
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 Method Details
.remove(files, watchers, options = { }) ⇒ Object
The remove function deals with CoffeeScript file removal by locating the output javascript file and removing it.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/guard/coffeescript/runner.rb', line 41 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.
24 25 26 27 28 29 30 |
# File 'lib/guard/coffeescript/runner.rb', line 24 def run(files, watchers, = { }) notify_start(files, ) changed_files, errors = compile_files(files, watchers, ) notify_result(changed_files, errors, ) [changed_files, errors.empty?] end |