isolate-scenarios 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -19
- data/Gemfile +11 -0
- data/Gemfile.lock +23 -0
- data/{IsolateScenarios → Isolate} +0 -0
- data/README.rdoc +40 -28
- data/Rakefile +5 -13
- data/isolate-scenarios.gemspec +35 -29
- data/lib/isolate/scenarios.rb +26 -6
- data/lib/isolate/scenarios/cli.rb +13 -7
- data/lib/isolate/scenarios/extensions.rb +27 -0
- data/spec/spec_helper.rb +1 -1
- metadata +62 -28
- data/lib/isolate/scenarios/now.rb +0 -2
- data/lib/isolate/scenarios/sandbox.rb +0 -43
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
isolate (2.1.2)
|
6
|
+
jeweler (1.5.0.pre2)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.8.7)
|
11
|
+
rspec (1.3.0)
|
12
|
+
thor (0.14.0)
|
13
|
+
yard (0.6.0)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
isolate (~> 2.1.2)
|
20
|
+
jeweler (~> 1.5.0.pre2)
|
21
|
+
rspec (~> 1.3.0)
|
22
|
+
thor (~> 0.14.0)
|
23
|
+
yard (~> 0.6.0)
|
File without changes
|
data/README.rdoc
CHANGED
@@ -12,24 +12,31 @@ You need the gem first:
|
|
12
12
|
|
13
13
|
gem install isolate-scenarios
|
14
14
|
|
15
|
-
Now head over to your project. There are two additions you'll need. First, you need an
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
15
|
+
Now head over to your project. There are two additions you'll need. First, you need an Isolate file, which describes your gem dependencies, as well as the gem you'll want to test different versions of:
|
16
|
+
|
17
|
+
# These are dependencies that don't need to vary
|
18
|
+
# See isolate documentation for more detail: http://github.com/jbarnette/isolate
|
19
|
+
gem 'puppet', '= 0.24.8'
|
20
|
+
gem 'facter', '>= 1.5.4'
|
21
|
+
gem 'highline', '>= 1.5.0'
|
22
|
+
gem 'builder', '>= 2.1.2'
|
23
|
+
|
24
|
+
# This is the gem we'll be testing different versions of.
|
25
|
+
# It's similar to the normal `gem` usage, except you don't give a version as a second argument,
|
26
|
+
# And it recognizes two additional options, :scenarios and :default_scenario
|
27
|
+
gem 'activesupport', :scenarios => %w{
|
28
|
+
2.1.2
|
29
|
+
2.2.3
|
30
|
+
2.3.5
|
31
|
+
2.3.8
|
32
|
+
3.0.0.beta4
|
33
|
+
},
|
34
|
+
# The value of :scenarios is a list of version strings
|
35
|
+
|
36
|
+
:default_scenario => '2.3.8'
|
37
|
+
# The value of default_scenario will be used when you don't
|
38
|
+
# explicitly specify a scenario to run. If you don't specify this,
|
39
|
+
# the last scenario is used.
|
33
40
|
|
34
41
|
To verify this is setup, you can use 'isolate-scenarios list' to show them:
|
35
42
|
|
@@ -37,25 +44,28 @@ To verify this is setup, you can use 'isolate-scenarios list' to show them:
|
|
37
44
|
* 2.1.2
|
38
45
|
* 2.2.3
|
39
46
|
* 2.3.5
|
40
|
-
* 2.3.8
|
47
|
+
* 2.3.8 (default)
|
41
48
|
* 3.0.0.beta4
|
42
49
|
|
43
|
-
Next, you'll need to update your test suite's helper, typically spec/spec_helper.rb or test/test_helper.rb. You need to place
|
50
|
+
Next, you'll need to update your test suite's helper, typically spec/spec_helper.rb or test/test_helper.rb. You need to place these lines as soon as you can in the file:
|
44
51
|
|
45
|
-
require 'isolate/scenarios
|
52
|
+
require 'isolate/scenarios'
|
53
|
+
require 'isolate/now'
|
54
|
+
|
55
|
+
Technically this is a third task, but you may also to add isolate-scenarios as a development dependency (http://docs.rubygems.org/read/chapter/20#dependencies) of your library. This will vary depending on how you manage your gem's dependencies.
|
46
56
|
|
47
57
|
Now, when you run your tests, it will default to using the last version you specified. For example:
|
48
58
|
|
49
59
|
$ rake spec
|
50
60
|
(in shadow_puppet)
|
51
|
-
Activating scenario: activesupport-3.
|
61
|
+
Activating default scenario: activesupport-2.3.8
|
52
62
|
# omitted
|
53
63
|
|
54
64
|
If you want to test against a specific scenario, you can specify it as an environment variable:
|
55
65
|
|
56
|
-
$ rake spec
|
66
|
+
$ rake spec ISOLATE_ACTIVESUPPORT_SCENARIO=3.0.0.beta4
|
57
67
|
(in shadow_puppet)
|
58
|
-
Activating scenario: activesupport-
|
68
|
+
Activating scenario: activesupport-3.0.0.beta4
|
59
69
|
# omitted
|
60
70
|
|
61
71
|
This is cool and all, but we still would love to test all the scenarios in one shot. 'isolate-scenarios rake' lets you just do that. This will iterate over each scenario, and invoke rake with any args you pass it.
|
@@ -75,14 +85,16 @@ This is cool and all, but we still would love to test all the scenarios in one s
|
|
75
85
|
# omitted
|
76
86
|
|
77
87
|
(in shadow_puppet)
|
78
|
-
Activating scenario: activesupport-2.3.8
|
88
|
+
Activating (default) scenario: activesupport-2.3.8
|
79
89
|
# omitted
|
80
90
|
|
81
|
-
|
91
|
+
(in shadow_puppet)
|
92
|
+
Activating scenario: activesupport-3.0.0.beta4
|
93
|
+
# omitted
|
82
94
|
|
83
|
-
|
95
|
+
== Limitations
|
84
96
|
|
85
|
-
|
97
|
+
While you can define multiple gems with scenarios, using `isolate-scenarios rake` will not try to test different combinations of the gem versions at this time.
|
86
98
|
|
87
99
|
There can be a bit of redudancy in gem dependency, ie you might specify them in your Rakefile via jeweler, or in Gemfile, or in Isolate, etc. isolate-scenarios doesn't try to reduce that redudancy at all yet.
|
88
100
|
|
data/Rakefile
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require "bundler/setup"
|
2
3
|
require 'rake'
|
3
4
|
|
4
5
|
begin
|
5
6
|
require 'jeweler'
|
6
7
|
Jeweler::Tasks.new do |gem|
|
7
8
|
gem.name = "isolate-scenarios"
|
8
|
-
gem.version = "0.0
|
9
|
+
gem.version = "0.1.0"
|
9
10
|
gem.summary = %Q{Tool for testing libraries using different senarios of gem versions}
|
10
11
|
gem.description = %Q{Tool for testing libraries using different senarios of gem versions}
|
11
12
|
gem.email = "josh@technicalpickles.com"
|
12
13
|
gem.homepage = "http://github.com/technicalpickles/isolate-scenarios"
|
13
14
|
gem.authors = ["Joshua Nichols"]
|
14
|
-
gem.add_dependency "thor"
|
15
|
-
gem.add_dependency "isolate"
|
16
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
17
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
16
|
end
|
19
17
|
Jeweler::GemcutterTasks.new
|
@@ -33,16 +31,10 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
33
31
|
spec.rcov = true
|
34
32
|
end
|
35
33
|
|
36
|
-
task :spec
|
34
|
+
task :spec
|
37
35
|
|
38
36
|
task :default => :spec
|
39
37
|
|
40
|
-
require '
|
41
|
-
Rake::
|
42
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
43
|
-
|
44
|
-
rdoc.rdoc_dir = 'rdoc'
|
45
|
-
rdoc.title = "isolate-scenarios #{version}"
|
46
|
-
rdoc.rdoc_files.include('README*')
|
47
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
38
|
+
require 'yard'
|
39
|
+
YARD::Rake::YardocTask.new do |t|
|
48
40
|
end
|
data/isolate-scenarios.gemspec
CHANGED
@@ -5,45 +5,45 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{isolate-scenarios}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Nichols"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-31}
|
13
13
|
s.default_executable = %q{isolate-scenarios}
|
14
14
|
s.description = %q{Tool for testing libraries using different senarios of gem versions}
|
15
15
|
s.email = %q{josh@technicalpickles.com}
|
16
16
|
s.executables = ["isolate-scenarios"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
|
19
|
+
"README.rdoc"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
23
|
+
".gitignore",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"Isolate",
|
27
|
+
"LICENSE",
|
28
|
+
"README.rdoc",
|
29
|
+
"Rakefile",
|
30
|
+
"bin/isolate-scenarios",
|
31
|
+
"isolate-scenarios.gemspec",
|
32
|
+
"lib/isolate-scenarios.rb",
|
33
|
+
"lib/isolate/scenarios.rb",
|
34
|
+
"lib/isolate/scenarios/cli.rb",
|
35
|
+
"lib/isolate/scenarios/extensions.rb",
|
36
|
+
"spec/isolate-scenarios_spec.rb",
|
37
|
+
"spec/spec.opts",
|
38
|
+
"spec/spec_helper.rb"
|
38
39
|
]
|
39
40
|
s.homepage = %q{http://github.com/technicalpickles/isolate-scenarios}
|
40
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
41
41
|
s.require_paths = ["lib"]
|
42
42
|
s.rubygems_version = %q{1.3.6}
|
43
43
|
s.summary = %q{Tool for testing libraries using different senarios of gem versions}
|
44
44
|
s.test_files = [
|
45
45
|
"spec/isolate-scenarios_spec.rb",
|
46
|
-
|
46
|
+
"spec/spec_helper.rb"
|
47
47
|
]
|
48
48
|
|
49
49
|
if s.respond_to? :specification_version then
|
@@ -51,18 +51,24 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.specification_version = 3
|
52
52
|
|
53
53
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
54
|
-
s.add_runtime_dependency(%q<thor>, ["
|
55
|
-
s.add_runtime_dependency(%q<isolate>, ["
|
56
|
-
s.add_development_dependency(%q<rspec>, ["
|
54
|
+
s.add_runtime_dependency(%q<thor>, ["~> 0.14.0"])
|
55
|
+
s.add_runtime_dependency(%q<isolate>, ["~> 2.1.2"])
|
56
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
|
57
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.0.pre2"])
|
57
59
|
else
|
58
|
-
s.add_dependency(%q<thor>, ["
|
59
|
-
s.add_dependency(%q<isolate>, ["
|
60
|
-
s.add_dependency(%q<rspec>, ["
|
60
|
+
s.add_dependency(%q<thor>, ["~> 0.14.0"])
|
61
|
+
s.add_dependency(%q<isolate>, ["~> 2.1.2"])
|
62
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
63
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre2"])
|
61
65
|
end
|
62
66
|
else
|
63
|
-
s.add_dependency(%q<thor>, ["
|
64
|
-
s.add_dependency(%q<isolate>, ["
|
65
|
-
s.add_dependency(%q<rspec>, ["
|
67
|
+
s.add_dependency(%q<thor>, ["~> 0.14.0"])
|
68
|
+
s.add_dependency(%q<isolate>, ["~> 2.1.2"])
|
69
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
70
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.0.pre2"])
|
66
72
|
end
|
67
73
|
end
|
68
74
|
|
data/lib/isolate/scenarios.rb
CHANGED
@@ -1,12 +1,32 @@
|
|
1
1
|
require 'isolate'
|
2
|
-
require 'isolate/scenarios/
|
2
|
+
require 'isolate/scenarios/extensions'
|
3
3
|
require 'isolate/scenarios/cli'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
Isolate::Entry.class_eval do
|
6
|
+
include Isolate::Scenarios::Entry
|
7
|
+
end
|
8
|
+
|
9
|
+
Isolate::Sandbox.class_eval do
|
10
|
+
include Isolate::Scenarios::Entry
|
11
|
+
end
|
12
|
+
|
13
|
+
Isolate::Events.watch(Isolate::Sandbox, :activating) do |sandbox|
|
14
|
+
sandbox.entries.each do |entry|
|
15
|
+
if entry.scenarios
|
16
|
+
selected_scenario_version = if ENV[entry.scenario_env_variable]
|
17
|
+
entry.scenarios.detect do |scenario|
|
18
|
+
ENV[entry.scenario_env_variable] == "#{entry.name}-#{scenario}"
|
19
|
+
end
|
20
|
+
elsif entry.default_scenario
|
21
|
+
entry.default_scenario
|
22
|
+
else
|
23
|
+
entry.scenarios.last
|
24
|
+
end
|
25
|
+
|
26
|
+
if selected_scenario_version
|
27
|
+
puts "Activating#{' default' if entry.default_scenario == selected_scenario_version} scenario: #{entry.name}-#{selected_scenario_version}"
|
28
|
+
entry.update(selected_scenario_version)
|
29
|
+
end
|
10
30
|
end
|
11
31
|
end
|
12
32
|
end
|
@@ -6,11 +6,15 @@ module Isolate
|
|
6
6
|
|
7
7
|
desc "list", "list scenarios"
|
8
8
|
def list
|
9
|
-
sandbox = Isolate::
|
9
|
+
sandbox = Isolate::Sandbox.new
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
sandbox.entries_with_scenarios.each do |entry|
|
12
|
+
puts "#{entry.name}:"
|
13
|
+
|
14
|
+
entry.scenarios.each do |scenario|
|
15
|
+
is_default_scenario = scenario == entry.default_scenario
|
16
|
+
puts "* #{scenario} #{'(default)' if is_default_scenario}"
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
@@ -18,10 +22,12 @@ module Isolate
|
|
18
22
|
def rake(*)
|
19
23
|
ARGV.delete('rake')
|
20
24
|
|
21
|
-
sandbox = Isolate::
|
25
|
+
sandbox = Isolate::Sandbox.new
|
22
26
|
|
23
|
-
sandbox.
|
24
|
-
|
27
|
+
sandbox.entries_with_scenarios.each do |entry|
|
28
|
+
entry.scenarios.each do |scenario|
|
29
|
+
system "rake #{entry.scenario_env_variable}=#{entry.name}-#{scenario} #{ARGV.join(' ')}"
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Isolate
|
2
|
+
module Scenarios
|
3
|
+
# Extension to Isolate::Entry to be scenario friendly
|
4
|
+
module Entry
|
5
|
+
def scenarios
|
6
|
+
options[:scenarios]
|
7
|
+
end
|
8
|
+
|
9
|
+
def default_scenario
|
10
|
+
options[:default_scenario]
|
11
|
+
end
|
12
|
+
|
13
|
+
def scenario_env_variable
|
14
|
+
"ISOLATE_#{name.upcase.gsub('-', '_')}_SCENARIO"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Extension to Isolate::Sandbox to be scenario friendly
|
19
|
+
module Sandbox
|
20
|
+
def entries_with_scenarios
|
21
|
+
entries.select do |entry|
|
22
|
+
entry.scenarios
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'bundler/setup'
|
3
4
|
require 'spec'
|
4
5
|
require 'spec/autorun'
|
5
6
|
|
6
7
|
require 'isolate-scenarios'
|
7
|
-
Isolate::Scenarios.now!
|
8
8
|
|
9
9
|
Spec::Runner.configure do |config|
|
10
10
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.2
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joshua Nichols
|
@@ -14,47 +14,80 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-08-31 00:00:00 -04:00
|
18
18
|
default_executable: isolate-scenarios
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
|
-
- -
|
24
|
+
- - ~>
|
26
25
|
- !ruby/object:Gem::Version
|
27
26
|
segments:
|
28
27
|
- 0
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
- 14
|
29
|
+
- 0
|
30
|
+
version: 0.14.0
|
31
|
+
name: thor
|
32
|
+
requirement: *id001
|
33
|
+
prerelease: false
|
32
34
|
- !ruby/object:Gem::Dependency
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 2
|
42
|
+
- 1
|
43
|
+
- 2
|
44
|
+
version: 2.1.2
|
33
45
|
name: isolate
|
46
|
+
requirement: *id002
|
34
47
|
prerelease: false
|
35
|
-
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
type: :development
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
36
51
|
requirements:
|
37
|
-
- -
|
52
|
+
- - ~>
|
38
53
|
- !ruby/object:Gem::Version
|
39
54
|
segments:
|
55
|
+
- 1
|
56
|
+
- 3
|
40
57
|
- 0
|
41
|
-
version:
|
42
|
-
type: :runtime
|
43
|
-
version_requirements: *id002
|
44
|
-
- !ruby/object:Gem::Dependency
|
58
|
+
version: 1.3.0
|
45
59
|
name: rspec
|
60
|
+
requirement: *id003
|
46
61
|
prerelease: false
|
47
|
-
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
type: :development
|
64
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
48
65
|
requirements:
|
49
|
-
- -
|
66
|
+
- - ~>
|
50
67
|
- !ruby/object:Gem::Version
|
51
68
|
segments:
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
version:
|
69
|
+
- 0
|
70
|
+
- 6
|
71
|
+
- 0
|
72
|
+
version: 0.6.0
|
73
|
+
name: yard
|
74
|
+
requirement: *id004
|
75
|
+
prerelease: false
|
76
|
+
- !ruby/object:Gem::Dependency
|
56
77
|
type: :development
|
57
|
-
version_requirements:
|
78
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 1
|
84
|
+
- 5
|
85
|
+
- 0
|
86
|
+
- pre2
|
87
|
+
version: 1.5.0.pre2
|
88
|
+
name: jeweler
|
89
|
+
requirement: *id005
|
90
|
+
prerelease: false
|
58
91
|
description: Tool for testing libraries using different senarios of gem versions
|
59
92
|
email: josh@technicalpickles.com
|
60
93
|
executables:
|
@@ -67,7 +100,9 @@ extra_rdoc_files:
|
|
67
100
|
files:
|
68
101
|
- .document
|
69
102
|
- .gitignore
|
70
|
-
-
|
103
|
+
- Gemfile
|
104
|
+
- Gemfile.lock
|
105
|
+
- Isolate
|
71
106
|
- LICENSE
|
72
107
|
- README.rdoc
|
73
108
|
- Rakefile
|
@@ -76,8 +111,7 @@ files:
|
|
76
111
|
- lib/isolate-scenarios.rb
|
77
112
|
- lib/isolate/scenarios.rb
|
78
113
|
- lib/isolate/scenarios/cli.rb
|
79
|
-
- lib/isolate/scenarios/
|
80
|
-
- lib/isolate/scenarios/sandbox.rb
|
114
|
+
- lib/isolate/scenarios/extensions.rb
|
81
115
|
- spec/isolate-scenarios_spec.rb
|
82
116
|
- spec/spec.opts
|
83
117
|
- spec/spec_helper.rb
|
@@ -86,8 +120,8 @@ homepage: http://github.com/technicalpickles/isolate-scenarios
|
|
86
120
|
licenses: []
|
87
121
|
|
88
122
|
post_install_message:
|
89
|
-
rdoc_options:
|
90
|
-
|
123
|
+
rdoc_options: []
|
124
|
+
|
91
125
|
require_paths:
|
92
126
|
- lib
|
93
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Isolate
|
2
|
-
module Scenarios
|
3
|
-
class Sandbox
|
4
|
-
attr_accessor :gem_to_vary, :versions
|
5
|
-
|
6
|
-
def current_scenario
|
7
|
-
if ENV['ISOLATE_SCENARIO']
|
8
|
-
scenario = versions.detect do |version|
|
9
|
-
ENV['ISOLATE_SCENARIO']== "#{gem_to_vary}-#{version}"
|
10
|
-
end
|
11
|
-
scenario || raise("No scenario defined for #{ENV['ISOLATE_SCENARIO']}")
|
12
|
-
else
|
13
|
-
versions.last
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def initialize
|
18
|
-
file = "IsolateScenarios"
|
19
|
-
instance_eval IO.read(file), file, 1
|
20
|
-
end
|
21
|
-
|
22
|
-
def baseline(&block)
|
23
|
-
@baseline_sandbox = Isolate::Sandbox.new(&block)
|
24
|
-
end
|
25
|
-
|
26
|
-
def gem_version_scenario(gem, *versions)
|
27
|
-
@gem_to_vary = gem
|
28
|
-
@versions = versions.flatten
|
29
|
-
end
|
30
|
-
|
31
|
-
def activate
|
32
|
-
puts "Activating scenario: #{gem_to_vary}-#{current_scenario}"
|
33
|
-
|
34
|
-
@baseline_sandbox ||= Isolate::Sandbox.new
|
35
|
-
@baseline_sandbox.gem gem_to_vary, current_scenario
|
36
|
-
|
37
|
-
@baseline_sandbox.activate(Isolate.env)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|