Class: Guard::Spork::Runner
- Inherits:
-
Object
- Object
- Guard::Spork::Runner
- Defined in:
- lib/guard/spork/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#spork_instances ⇒ Object
readonly
Returns the value of attribute spork_instances.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #kill_global_sporks ⇒ Object
- #kill_sporks(type = nil) ⇒ Object
- #launch_sporks(action, type = nil) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/guard/spork/runner.rb', line 9 def initialize(={}) [:wait] ||= 30 # seconds [:retry_delay] ||= 2 * [:wait] # seconds [:test_unit_port] ||= 8988 [:cucumber_port] ||= 8990 [:rspec_port] ||= 8989 [:minitest_port] ||= 8988 [:rspec_env] ||= {} [:test_unit_env] ||= {} [:cucumber_env] ||= {} [:minitest_env] ||= {} [:minitest] ||= false [:aggressive_kill] = true unless [:aggressive_kill] == false [:foreman] ||= false [:quiet] ||= false @options = initialize_spork_instances end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/guard/spork/runner.rb', line 6 def @options end |
#spork_instances ⇒ Object (readonly)
Returns the value of attribute spork_instances.
7 8 9 |
# File 'lib/guard/spork/runner.rb', line 7 def spork_instances @spork_instances end |
Class Method Details
.windows? ⇒ Boolean
50 51 52 |
# File 'lib/guard/spork/runner.rb', line 50 def self.windows? ENV['OS'] == 'Windows_NT' end |
Instance Method Details
#kill_global_sporks ⇒ Object
44 45 46 47 48 |
# File 'lib/guard/spork/runner.rb', line 44 def kill_global_sporks if [:aggressive_kill] kill_pids self.class.spork_instance_class.spork_pids end end |
#kill_sporks(type = nil) ⇒ Object
38 39 40 41 42 |
# File 'lib/guard/spork/runner.rb', line 38 def kill_sporks(type = nil) alive = find_instances(type).select(&:alive?) Compat::UI.debug "Killing Spork servers with PID: #{alive.map(&:pid).join(', ')}" alive.each(&:stop) end |
#launch_sporks(action, type = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/guard/spork/runner.rb', line 28 def launch_sporks(action, type = nil) instances = find_instances(type) Compat::UI.info "#{action.capitalize}ing Spork for #{instances.join(', ')}", :reset => true if [:notify_on_start] Notifier.notify "#{action.capitalize}ing #{instances.join(', ')}", :title => "Spork", :image => :success end instances.each(&:start) verify_launches(action, instances) end |