lib/guard/cane.rb in guard-cane-0.2.0 vs lib/guard/cane.rb in guard-cane-0.2.1
- old
+ new
@@ -1,28 +1,27 @@
-require 'guard'
-require 'guard/guard'
+require 'guard/compat/plugin'
module Guard
# Defines the guard, which is automatically seen by Guard
- class Cane < Guard
+ class Cane < Plugin
DEFAULTS = {
run_all_on_start: true
}
SUCCESS = ["Passed", { title: "Cane", image: :success }]
FAILED = ["Failed", { title: "Cane", image: :failed }]
attr_reader :last_result, :options
- def initialize(watchers = [], options = {})
- super
+ def initialize(options = {})
+ super options
@options = DEFAULTS.merge(options)
end
def start
- UI.info "Guard::Cane is running"
+ Compat::UI.info "Guard::Cane is running"
run_all if options[:run_all_on_start]
end
def run_all
@@ -35,17 +34,17 @@
end
def cane(paths = [])
command = build_command(paths)
- UI.info "Running Cane: #{command}"
+ Compat::UI.info "Running Cane: #{command}"
result = system command
if result
- Notifier.notify(*SUCCESS) if last_result == false
+ Compat::UI.notify(*SUCCESS) if last_result == false
else
- Notifier.notify(*FAILED)
+ Compat::UI.notify(*FAILED)
end
@last_result = result
result