Class: Guard::RebarDeps
Instance Method Summary collapse
- #directory_name ⇒ Object
- #handle_output(output, suite = nil) ⇒ Object
-
#initialize(watchers = [], options = {}) ⇒ RebarDeps
constructor
A new instance of RebarDeps.
- #run_all ⇒ Object
- #run_on_change(paths = []) ⇒ Object
- #start ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ RebarDeps
Returns a new instance of RebarDeps.
6 7 8 9 |
# File 'lib/guard/rebar-deps.rb', line 6 def initialize(watchers = [], = {}) super [:skip_deps] = true if [:skip_deps].nil? end |
Instance Method Details
#directory_name ⇒ Object
45 46 47 |
# File 'lib/guard/rebar-deps.rb', line 45 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-deps.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 |
#run_all ⇒ Object
15 16 17 18 19 |
# File 'lib/guard/rebar-deps.rb', line 15 def run_all cmd = "rebar get-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-deps.rb', line 21 def run_on_change(paths = []) paths.each do |path| UI.info "changed: #{path}" end cmd = "rebar update-deps" UI.info "#{cmd}" handle_output(`#{cmd}`) end |
#start ⇒ Object
11 12 13 |
# File 'lib/guard/rebar-deps.rb', line 11 def start run_all if [:all_on_start] end |
#title ⇒ Object
41 42 43 |
# File 'lib/guard/rebar-deps.rb', line 41 def title "Rebar Deps: #{directory_name}" end |