Class: PrefetchRspec::Runner
- Inherits:
-
Base
- Object
- Base
- PrefetchRspec::Runner
show all
- Defined in:
- lib/prefetch_rspec.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#color, #cwarn, #drb_uri, #initialize
Class Method Details
.run(args) ⇒ Object
50
51
52
|
# File 'lib/prefetch_rspec.rb', line 50
def self.run(args)
self.new(args).run ? exit(0) : exit(1)
end
|
Instance Method Details
#require_libraries ⇒ Object
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/prefetch_rspec.rb', line 71
def require_libraries
begin
require 'bundler' if options[:bundler]
require 'rspec/core'
rescue LoadError
require 'rubygems'
require 'bundler' if options[:bundler]
require 'rspec/core'
end
end
|
#run(err = STDERR, out = STDOUT) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/prefetch_rspec.rb', line 54
def run(err = STDERR, out = STDOUT)
@drb_service ||= DRb.start_service(nil)
result = nil
begin
result = DRbObject.new_with_uri(drb_uri).run(options[:args], err, out)
@drb_service.stop_service
rescue DRb::DRbConnError => e
@drb_service.stop_service
err.puts "Can't connect to prspecd. Run in normal rspec."
require_libraries
RSpec::Core::Runner.disable_autorun!
result = RSpec::Core::Runner.run(options[:args], err, out)
end
result
end
|