Class: SpecRunQueue::SystemRunner
- Inherits:
-
Object
- Object
- SpecRunQueue::SystemRunner
- Defined in:
- lib/spec_run_queue/system_runner.rb
Instance Attribute Summary collapse
-
#notifiers ⇒ Object
readonly
Returns the value of attribute notifiers.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #add_notifier(notifier) ⇒ Object
-
#initialize(options = {}) ⇒ SystemRunner
constructor
A new instance of SystemRunner.
- #rspec_bin ⇒ Object
- #rspec_format ⇒ Object
- #run_spec(instruction) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ SystemRunner
Returns a new instance of SystemRunner.
5 6 7 8 |
# File 'lib/spec_run_queue/system_runner.rb', line 5 def initialize( = {}) @options = @notifiers = [] end |
Instance Attribute Details
#notifiers ⇒ Object (readonly)
Returns the value of attribute notifiers.
3 4 5 |
# File 'lib/spec_run_queue/system_runner.rb', line 3 def notifiers @notifiers end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/spec_run_queue/system_runner.rb', line 3 def @options end |
Instance Method Details
#add_notifier(notifier) ⇒ Object
18 19 20 |
# File 'lib/spec_run_queue/system_runner.rb', line 18 def add_notifier(notifier) @notifiers << notifier end |
#rspec_bin ⇒ Object
10 11 12 |
# File 'lib/spec_run_queue/system_runner.rb', line 10 def rspec_bin .fetch(:rspec_bin, 'rspec') end |
#rspec_format ⇒ Object
14 15 16 |
# File 'lib/spec_run_queue/system_runner.rb', line 14 def rspec_format .fetch(:rspec_format, 'nested') end |
#run_spec(instruction) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/spec_run_queue/system_runner.rb', line 22 def run_spec(instruction) unless sane_instruction?(instruction) $stderr.puts "Insane instruction #{instruction.inspect}" return end begin cmd = "#{rspec_bin} -f #{rspec_format} --drb" cmd << " #{instruction[:target]}" cmd << ":#{instruction[:line]}" if instruction[:line] puts "Running command #{cmd}" output = run_cmd(cmd) output_to_notifiers(output) rescue => e = "Exception #{e.class} occurred, shutting down" output_to_notifiers(, :use_full_message => true) sleep(1) raise e end end |