lib/guard/delayed.rb in guard-delayed-0.2.1 vs lib/guard/delayed.rb in guard-delayed-0.3.0
- old
+ new
@@ -1,10 +1,10 @@
require 'guard'
-require 'guard/guard'
+require 'guard/plugin'
module Guard
- class Delayed < Guard
+ class Delayed < Plugin
# Allowable options are:
# :environment defaults to 'test'
# :min_priority e.g. 2
# :max_priority e.g. 10
@@ -13,13 +13,13 @@
# :identifier A numeric identifier for the worker.
# :monitor Start monitor process.
# :sleep-delay N Amount of time to sleep in seconds when no jobs are found
# :prefix NAME String to be prefixed to worker process names
- def initialize(watchers = [], options = {})
+ def initialize(options = {})
@options = options
- super(watchers, options)
+ super
end
def start
run_cmd("stop")
UI.info "Starting up delayed_job..."
@@ -65,9 +65,10 @@
run_cmd('restart')
end
def cmd
command = "script/delayed_job"
+ command = "#{@options[:root]}/script/delayed_job" if @options[:root]
command = "export RAILS_ENV=#{@options[:environment]}; #{command}" if @options[:environment]
command
end
def run_cmd(parameters)