class Guard::Cane
Defines the guard, which is automatically seen by Guard
Constants
- DEFAULTS
- FAILED
- SUCCESS
Attributes
last_result[R]
options[R]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/guard/cane.rb, line 15 def initialize(options = {}) super options @options = DEFAULTS.merge(options) end
Public Instance Methods
build_command(paths)
click to toggle source
# File lib/guard/cane.rb, line 54 def build_command(paths) command = [] command << (options[:command] || "cane") if paths.any? joined_paths = paths.join(',') command << "--all '{#{joined_paths}}'" end command << options[:cli] command.compact.join(" ") end
cane(paths = [])
click to toggle source
# File lib/guard/cane.rb, line 36 def cane(paths = []) command = build_command(paths) Compat::UI.info "Running Cane: #{command}" result = system command if result Compat::UI.notify(*SUCCESS) if last_result == false else Compat::UI.notify(*FAILED) end @last_result = result result end
run_all()
click to toggle source
# File lib/guard/cane.rb, line 27 def run_all cane end
run_on_modifications(paths)
click to toggle source
# File lib/guard/cane.rb, line 31 def run_on_modifications(paths) passed = cane paths run_all if options[:all_after_pass] && passed end
start()
click to toggle source
# File lib/guard/cane.rb, line 21 def start Compat::UI.info "Guard::Cane is running" run_all if options[:run_all_on_start] end