Class: Qspec::CommandLine
- Inherits:
-
RSpec::Core::CommandLine
- Object
- RSpec::Core::CommandLine
- Qspec::CommandLine
- Includes:
- Manager, SporkHelper
- Defined in:
- lib/qspec/command_line.rb
Constant Summary
Constants included from Manager
Manager::DEFAULT_ELAPSED_TIME, Manager::TIME_LOG_NAME
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#ipc ⇒ Object
readonly
Returns the value of attribute ipc.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(options) ⇒ CommandLine
constructor
A new instance of CommandLine.
- #process ⇒ Object
- #run(err, out) ⇒ Object
Methods included from SporkHelper
#connect_spork, #create_port_file, #remove_port_file, #runnning_ports, #start_spork_workers
Methods included from Manager
Constructor Details
#initialize(options) ⇒ CommandLine
Returns a new instance of CommandLine.
9 10 11 12 13 14 15 |
# File 'lib/qspec/command_line.rb', line 9 def initialize() @config = Config.new() @ipc = IPC.from_config(@config) @id = ENV['qspec_id'] super() end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/qspec/command_line.rb', line 7 def config @config end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/qspec/command_line.rb', line 7 def id @id end |
#ipc ⇒ Object (readonly)
Returns the value of attribute ipc.
7 8 9 |
# File 'lib/qspec/command_line.rb', line 7 def ipc @ipc end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/qspec/command_line.rb', line 7 def output @output end |
Instance Method Details
#process ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/qspec/command_line.rb', line 29 def process success = true while f = ipc.lpop("to_run_#{id}") @configuration.add_formatter(Qspec::Formatters::RedisFormatterFactory.build(id, f)) begin load File.(f) @configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter| begin GC.disable if @config['no_gc'] @configuration.run_hook(:before, :suite) success &&= @world.example_groups.ordered.all? {|g| g.run(reporter)} ensure @configuration.run_hook(:after, :suite) GC.enable if @config['no_gc'] GC.start if @config['no_gc'] end end ensure @world.example_groups.clear @configuration.reset # formatter, reporter end end success ? 0 : @configuration.failure_exit_code end |
#run(err, out) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/qspec/command_line.rb', line 17 def run(err, out) @configuration.error_stream = err @output = @configuration.output_stream ||= out @options.configure(@configuration) if @id process else start_worker end end |