Class: Guard::RebarCompile
Instance Method Summary collapse
- #directory_name ⇒ Object
- #handle_output(output, suite = nil) ⇒ Object
- #handle_skip_deps ⇒ Object
-
#initialize(watchers = [], options = {}) ⇒ RebarCompile
constructor
A new instance of RebarCompile.
- #run_all ⇒ Object
- #run_on_change(paths = []) ⇒ Object
- #start ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ RebarCompile
Returns a new instance of RebarCompile.
6 7 8 9 |
# File 'lib/guard/rebar-compile.rb', line 6 def initialize(watchers = [], = {}) super [:skip_deps] = true if [:skip_deps].nil? end |
Instance Method Details
#directory_name ⇒ Object
49 50 51 |
# File 'lib/guard/rebar-compile.rb', line 49 def directory_name "#{File.basename(Dir.pwd)}" end |
#handle_output(output, suite = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/guard/rebar-compile.rb', line 30 def handle_output(output, suite = nil) suite = directory_name unless suite if $? == 0 Notifier.notify(suite, title: title, image: :success) UI.info output else Notifier.notify(suite, title: title, image: :failed) UI.error output end end |
#handle_skip_deps ⇒ Object
41 42 43 |
# File 'lib/guard/rebar-compile.rb', line 41 def handle_skip_deps [:skip_deps] ? "skip_deps=true " : "" end |
#run_all ⇒ Object
15 16 17 18 19 |
# File 'lib/guard/rebar-compile.rb', line 15 def run_all cmd = "rebar compile #{handle_skip_deps}" UI.info "#{cmd}" handle_output(`#{cmd}`) end |
#run_on_change(paths = []) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/guard/rebar-compile.rb', line 21 def run_on_change(paths = []) paths.each do |path| UI.info "changed: #{path}" end cmd = "rebar compile #{handle_skip_deps}" UI.info "#{cmd}" handle_output(`#{cmd}`) end |
#start ⇒ Object
11 12 13 |
# File 'lib/guard/rebar-compile.rb', line 11 def start run_all if [:all_on_start] end |
#title ⇒ Object
45 46 47 |
# File 'lib/guard/rebar-compile.rb', line 45 def title "Rebar Compile: #{directory_name}" end |