Module: Guard::TypeScript::Runner
- Defined in:
- lib/guard/typescript/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 TypeScript file removal by locating the output javascript file and removing it.
-
.run(files, watchers, options = { }) ⇒ Array<Array<String>, Boolean>
The TypeScript runner handles the TypeScript 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/typescript/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 TypeScript file removal by locating the output javascript file and removing it.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/guard/typescript/runner.rb', line 42 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 => 'TypeScript results') end end |
.run(files, watchers, options = { }) ⇒ Array<Array<String>, Boolean>
The TypeScript runner handles the TypeScript compilation, creates nested directories and the output file, writes the result to the console and triggers optional system notifications.
25 26 27 28 29 30 31 |
# File 'lib/guard/typescript/runner.rb', line 25 def run(files, watchers, = { }) notify_start(files, ) changed_files, errors = compile_files(files, watchers, ) notify_result(changed_files, errors, ) [changed_files, errors.empty?] end |