Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rspec 3.x support... #14

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lib/torquespec/daemon.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def initialize(opts={})
Dir.chdir( dir ) do
RSpec::Core::Runner.disable_autorun! # avoid a bunch of at_exit finalizer errors
@options = RSpec::Core::ConfigurationOptions.new( opts['argv'].to_a )
@options.parse_options
if (@options.respond_to?(:parse_options))
@options.parse_options
else
@options.options
end

@configuration = RSpec::configuration
@world = RSpec::world
Expand Down Expand Up @@ -76,6 +80,8 @@ def torquespec_before_alls
eval_before_alls(new) # v 2.3
elsif respond_to?(:run_before_all_hooks)
run_before_all_hooks(new) # 2.7
elsif respond_to?(:run_before_context_hooks)
run_before_context_hooks(new)
else
raise "Unknown method to run before(:all) hooks"
end
Expand All @@ -86,6 +92,8 @@ def torquespec_after_alls
eval_after_alls(new) # v 2.3
elsif respond_to?(:run_after_all_hooks)
run_after_all_hooks(new) # 2.7
elsif respond_to?(:run_after_context_hooks)
run_after_context_hooks(new) # 3.0
else
raise "Unknown method to run after(:all) hooks"
end
Expand Down Expand Up @@ -118,7 +126,11 @@ def run_remotely(reporter)
end

def deploy_paths
[ DeploymentDescriptor.new( {}, display_name, true ).path ]
if respond_to?(:display_name)
[ DeploymentDescriptor.new( {}, display_name, true ).path ]
else
[ DeploymentDescriptor.new( {}, description, true ).path ]
end
end

end
Expand Down
19 changes: 14 additions & 5 deletions lib/torquespec/torquespec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@ def deploy(*descriptors, &block)
return @deploy_paths if @deploy_paths
descriptors += [block.call].flatten if block
i = descriptors.size > 1 ? 0 : nil
@deploy_paths = descriptors.map do |descriptor|
DeploymentDescriptor.new(descriptor,
"#{self.display_name}#{i&&i-=1}",
descriptors.last==descriptor && descendants.any? {|x| x.is_a?(TorqueSpec::Daemon::Client)}
).path
if respond_to?(:display_name)
@deploy_paths = descriptors.map do |descriptor|
DeploymentDescriptor.new(descriptor,
"#{self.display_name}#{i&&i-=1}",
descriptors.last==descriptor && descendants.any? {|x| x.is_a?(TorqueSpec::Daemon::Client)}
).path
end
else
@deploy_paths = descriptors.map do |descriptor|
DeploymentDescriptor.new(descriptor,
"#{self.description}#{i&&i-=1}",
descriptors.last==descriptor && descendants.any? {|x| x.is_a?(TorqueSpec::Daemon::Client)}
).path
end
end
end
end
Expand Down