bundler_ext 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 58fa76105a9f07c591192a8fe4b9ad433429fc68
4
- data.tar.gz: d5892b331e740da469c0ad159cdb817e29059e35
2
+ SHA256:
3
+ metadata.gz: 231e9a2fab9c5f11cd70a494ac3be9b6dfa7d4b06a9426f416d2acaf511f6cd1
4
+ data.tar.gz: 81eafc716126fdbcc6ecec515283970b9b7442dba2a94f8c02eaf47b8aba5c4a
5
5
  SHA512:
6
- metadata.gz: 5d4e8bfcc04b6bb3e6f73441a6e43c5a3fdf8e566668d496fcbf56c4ad82bf7243786ac5db11e143c59536d853447e01768537c9e89883347d18b3511db52e8a
7
- data.tar.gz: 2489f94d3473cec5065664bd493c75181a58b3cb1c14840346c9e740a62c31de82ff8e9da3d2c7bdf2ef4ca296b0917e60c48c573cfb4772457119170e67f5b5
6
+ metadata.gz: 4bd7ffbb8314041170c0ea1d0d43b12683c2da415ade6b4d22613ff705f40ccee253b84bc2410fd88273af214f69e23111f43fdc39f3b130de2b7017e7bd39c4
7
+ data.tar.gz: a5478231a4f88594a43086e07a723bbde6e38cc519c774d91d71ba479d162f686a2c246b83842c4ce60b802c4bc08f40de5a784dcf8523e997d3bea0867dde49
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --colour
2
- --format nested
2
+ --format documentation
data/CHANGELOG CHANGED
@@ -1,3 +1,28 @@
1
+ ====== version 0.4.2 =========
2
+
3
+ Vít Ondruch (2020-09-16)
4
+ - Fix Bundler 1.8.1+ test failures
5
+
6
+ Ewoud Kohl van Wijngaarden (2022-07-12)
7
+ - Update test suite to rspec 3
8
+ - Correct expectations for modern Bundler output
9
+ - Add CI using GitHub Actions
10
+
11
+ ====== version 0.4.1 =========
12
+
13
+ Lukas Zapletal (2014-06-09)
14
+ - Fix loading of namespaced gems
15
+ - Add BEXT_VERBOSE environment variable
16
+
17
+ ====== version 0.4.0 =========
18
+
19
+ Mo Morsi (2013-12-19)
20
+ - Refactored into smaller modules
21
+ - Drop linux_admin dependency
22
+ - Add BundlerExt#system_setup analogous to Bundler#setup
23
+ - Update README
24
+ - Improve test coverage
25
+
1
26
  ====== version 0.3.2 =========
2
27
 
3
28
  Mo Morsi (2013-11-19)
@@ -1,3 +1,3 @@
1
1
  module BundlerExt
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -4,19 +4,19 @@ require 'bundler_ext'
4
4
  describe BundlerExt do
5
5
  describe "#runtime" do
6
6
  it "returns handle to runtime instance" do
7
- described_class.runtime.should be_an_instance_of(BundlerExt::Runtime)
8
- described_class.runtime.should == described_class.runtime
7
+ expect(described_class.runtime).to be_an_instance_of(BundlerExt::Runtime)
8
+ expect(described_class.runtime).to eq(described_class.runtime)
9
9
  end
10
10
  end
11
11
 
12
12
  describe "#system_require" do
13
13
  it "sets up runtime env" do
14
- described_class.runtime.should_receive(:setup_env)
14
+ expect(described_class.runtime).to receive(:setup_env)
15
15
  described_class.system_require('spec/fixtures/Gemfile.in')
16
16
  end
17
17
 
18
18
  it "parses specified gemfile" do
19
- BundlerExt::Gemfile.should_receive(:parse).
19
+ expect(BundlerExt::Gemfile).to receive(:parse).
20
20
  with('spec/fixtures/Gemfile.in', *['mygroups']).
21
21
  and_call_original
22
22
  described_class.system_require('spec/fixtures/Gemfile.in', 'mygroups')
@@ -24,52 +24,52 @@ describe BundlerExt do
24
24
 
25
25
  context "System.activate? is true" do
26
26
  it "activates system dependencies" do
27
- BundlerExt::Gemfile.should_receive(:parse).
27
+ expect(BundlerExt::Gemfile).to receive(:parse).
28
28
  and_return({'rails' => {:files => []}})
29
- BundlerExt::System.should_receive(:activate?).and_return(true)
30
- BundlerExt::System.should_receive(:activate!).with('rails')
29
+ expect(BundlerExt::System).to receive(:activate?).and_return(true)
30
+ expect(BundlerExt::System).to receive(:activate!).with('rails')
31
31
  described_class.system_require('my_gemfile')
32
32
  end
33
33
  end
34
34
 
35
35
  it "requires dependency files" do
36
36
  files = ['rails-includes']
37
- BundlerExt::Gemfile.should_receive(:parse).
37
+ expect(BundlerExt::Gemfile).to receive(:parse).
38
38
  and_return({'rails' => {:files => files}})
39
- described_class.runtime.should_receive(:system_require).with(files)
39
+ expect(described_class.runtime).to receive(:system_require).with(files)
40
40
  described_class.system_require('my_gemfile')
41
41
  end
42
42
  end
43
43
 
44
44
  describe "#system_setup" do
45
45
  it "sets up gemfile env" do
46
- BundlerExt::Gemfile.should_receive(:setup_env).
46
+ expect(BundlerExt::Gemfile).to receive(:setup_env).
47
47
  with('spec/fixtures/Gemfile.in').at_least(:once)
48
- described_class.runtime.should_receive(:clear) # stub out clear
48
+ expect(described_class.runtime).to receive(:clear) # stub out clear
49
49
  described_class.system_setup('spec/fixtures/Gemfile.in')
50
50
  end
51
51
 
52
52
  it "sets runtime gemfile" do
53
- described_class.runtime.should_receive(:clear) # stub out clear
53
+ expect(described_class.runtime).to receive(:clear) # stub out clear
54
54
  described_class.system_setup('spec/fixtures/Gemfile.in')
55
- described_class.runtime.gemfile.to_s.should == 'spec/fixtures/Gemfile.in'
55
+ expect(described_class.runtime.gemfile.to_s).to eq('spec/fixtures/Gemfile.in')
56
56
  end
57
57
 
58
58
  it "sets up runtime env" do
59
- described_class.runtime.should_receive(:clear) # stub out clear
60
- described_class.runtime.should_receive(:setup_env)
59
+ expect(described_class.runtime).to receive(:clear) # stub out clear
60
+ expect(described_class.runtime).to receive(:setup_env)
61
61
  described_class.system_setup('spec/fixtures/Gemfile.in')
62
62
  end
63
63
 
64
64
  it "clears runtime" do
65
- described_class.runtime.should_receive(:clear) # stub out clear
66
- described_class.runtime.should_receive(:setup_env)
65
+ expect(described_class.runtime).to receive(:clear) # stub out clear
66
+ expect(described_class.runtime).to receive(:setup_env)
67
67
  described_class.system_setup('spec/fixtures/Gemfile.in')
68
68
  end
69
69
 
70
70
  it "parses specified gemfile" do
71
- described_class.runtime.should_receive(:clear) # stub out clear
72
- BundlerExt::Gemfile.should_receive(:parse).
71
+ expect(described_class.runtime).to receive(:clear) # stub out clear
72
+ expect(BundlerExt::Gemfile).to receive(:parse).
73
73
  with('spec/fixtures/Gemfile.in', *['mygroups']).
74
74
  and_call_original
75
75
  described_class.system_setup('spec/fixtures/Gemfile.in', 'mygroups')
@@ -77,21 +77,21 @@ describe BundlerExt do
77
77
 
78
78
  context "System.activate? is true" do
79
79
  it "activates system dependencies" do
80
- described_class.runtime.should_receive(:clear) # stub out clear
81
- BundlerExt::Gemfile.should_receive(:parse).
80
+ expect(described_class.runtime).to receive(:clear) # stub out clear
81
+ expect(BundlerExt::Gemfile).to receive(:parse).
82
82
  and_return({'rails' => {:dep => ::Gem::Dependency.new('rails')}})
83
- BundlerExt::System.should_receive(:activate?).and_return(true)
84
- BundlerExt::System.should_receive(:activate!).with('rails')
83
+ expect(BundlerExt::System).to receive(:activate?).and_return(true)
84
+ expect(BundlerExt::System).to receive(:activate!).with('rails')
85
85
  described_class.system_setup('spec/fixtures/Gemfile.in')
86
86
  end
87
87
  end
88
88
 
89
89
  it "adds dependency specs to runtime" do
90
90
  dep = ::Gem::Dependency.new('rails')
91
- described_class.runtime.should_receive(:clear) # stub out clear
92
- BundlerExt::Gemfile.should_receive(:parse).
91
+ expect(described_class.runtime).to receive(:clear) # stub out clear
92
+ expect(BundlerExt::Gemfile).to receive(:parse).
93
93
  and_return({'rails' => {:dep => dep}})
94
- described_class.runtime.should_receive(:add_spec).with(dep.to_spec())
94
+ expect(described_class.runtime).to receive(:add_spec).with(dep.to_spec())
95
95
  described_class.system_setup('spec/fixtures/Gemfile.in')
96
96
  end
97
97
  end
@@ -12,7 +12,7 @@ module BundlerExt
12
12
 
13
13
  it "sets BUNDLE_GEMFILE env varialbe" do
14
14
  described_class.setup_env('Gemfile.custom')
15
- ENV['BUNDLE_GEMFILE'].should == 'Gemfile.custom'
15
+ expect(ENV['BUNDLE_GEMFILE']).to eq('Gemfile.custom')
16
16
  end
17
17
  end
18
18
 
@@ -26,39 +26,39 @@ module BundlerExt
26
26
  end
27
27
 
28
28
  it "converts specified groups to symbols" do
29
- described_class.parse_env(['development', 'test'])[:groups].should == [:development, :test]
29
+ expect(described_class.parse_env(['development', 'test'])[:groups]).to eq([:development, :test])
30
30
  end
31
31
 
32
32
  it "retrieves extra groups from BUNDLER_EXT_GROUPS env variable" do
33
33
  ENV['BUNDLER_EXT_GROUPS'] = 'development test'
34
34
  env = described_class.parse_env([])
35
- env[:groups].should == [:development, :test]
36
- env[:extra_groups].should == 'development test'
35
+ expect(env[:groups]).to eq([:development, :test])
36
+ expect(env[:extra_groups]).to eq('development test')
37
37
  end
38
38
 
39
39
  it "retrieves extra groups from BEXT_GROUPS env variable" do
40
40
  ENV['BEXT_GROUPS'] = 'development test'
41
41
  env = described_class.parse_env([])
42
- env[:groups].should == [:development, :test]
43
- env[:extra_groups].should == 'development test'
42
+ expect(env[:groups]).to eq([:development, :test])
43
+ expect(env[:extra_groups]).to eq('development test')
44
44
  end
45
45
 
46
46
  context "groups == [:all] and no extra groups specified" do
47
47
  it "sets all_groups true" do
48
- described_class.parse_env([:all])[:all_groups].should be_true
48
+ expect(described_class.parse_env([:all])[:all_groups]).to be true
49
49
  end
50
50
  end
51
51
 
52
52
  context "groups != [:all]" do
53
53
  it "sets all_groups false" do
54
- described_class.parse_env([:dev])[:all_groups].should be_false
54
+ expect(described_class.parse_env([:dev])[:all_groups]).to be false
55
55
  end
56
56
  end
57
57
 
58
58
  context "extra groups specified" do
59
59
  it "sets all_groups false" do
60
60
  ENV['BEXT_GROUPS'] = 'development'
61
- described_class.parse_env([:all])[:all_groups].should be_false
61
+ expect(described_class.parse_env([:all])[:all_groups]).to be false
62
62
  end
63
63
  end
64
64
  end
@@ -72,8 +72,8 @@ module BundlerExt
72
72
  context "dep.current_platform? is false" do
73
73
  it "returns false" do
74
74
  @env[:all_groups] = true
75
- @dep.should_receive(:current_platform?).and_return(false)
76
- described_class.dependency_in_env?(@dep, @env).should be_false
75
+ expect(@dep).to receive(:current_platform?).and_return(false)
76
+ expect(described_class.dependency_in_env?(@dep, @env)).to be false
77
77
  end
78
78
  end
79
79
 
@@ -81,15 +81,15 @@ module BundlerExt
81
81
  it "returns false" do
82
82
  @env[:all_groups] = false
83
83
  @env[:groups] << :dev
84
- described_class.dependency_in_env?(@dep, @env).should be_false
84
+ expect(described_class.dependency_in_env?(@dep, @env)).to be false
85
85
  end
86
86
  end
87
87
 
88
88
  context ":all_groups and dep.current_platform? are true" do
89
89
  it "returns true" do
90
90
  @env[:all_groups] = true
91
- @dep.should_receive(:current_platform?).and_return(true)
92
- described_class.dependency_in_env?(@dep, @env).should be_true
91
+ expect(@dep).to receive(:current_platform?).and_return(true)
92
+ expect(described_class.dependency_in_env?(@dep, @env)).to be true
93
93
  end
94
94
  end
95
95
 
@@ -97,8 +97,8 @@ module BundlerExt
97
97
  it "returns true" do
98
98
  @env[:groups] << :dev
99
99
  @dep.groups << :dev
100
- @dep.should_receive(:current_platform?).and_return(true)
101
- described_class.dependency_in_env?(@dep, @env).should be_true
100
+ expect(@dep).to receive(:current_platform?).and_return(true)
101
+ expect(described_class.dependency_in_env?(@dep, @env)).to be true
102
102
  end
103
103
  end
104
104
  end
@@ -107,15 +107,15 @@ module BundlerExt
107
107
  context "dependency in env" do
108
108
  it "returns dependency autorequires" do
109
109
  dep = Bundler::Dependency.new 'rake', '1.0.0', 'require' => [:foo]
110
- described_class.should_receive(:dependency_in_env?).and_return(true)
111
- described_class.files_for_dependency(dep, {}).should == [:foo]
110
+ expect(described_class).to receive(:dependency_in_env?).and_return(true)
111
+ expect(described_class.files_for_dependency(dep, {})).to eq([:foo])
112
112
  end
113
113
 
114
114
  context "autorequires is nil" do
115
115
  it("returns depenency name") do
116
116
  dep = Bundler::Dependency.new 'rake', '1.0.0'
117
- described_class.should_receive(:dependency_in_env?).and_return(true)
118
- described_class.files_for_dependency(dep, {}).should == ['rake']
117
+ expect(described_class).to receive(:dependency_in_env?).and_return(true)
118
+ expect(described_class.files_for_dependency(dep, {})).to eq(['rake'])
119
119
  end
120
120
  end
121
121
  end
@@ -123,8 +123,8 @@ module BundlerExt
123
123
  context "dependency not in env" do
124
124
  it "returns empty array" do
125
125
  dep = Bundler::Dependency.new 'rake', '1.0.0'
126
- described_class.should_receive(:dependency_in_env?).and_return(false)
127
- described_class.files_for_dependency(dep, {}).should == []
126
+ expect(described_class).to receive(:dependency_in_env?).and_return(false)
127
+ expect(described_class.files_for_dependency(dep, {})).to eq([])
128
128
  end
129
129
  end
130
130
  end
@@ -134,7 +134,7 @@ module BundlerExt
134
134
  ENV['BUNDLE_GEMFILE'] = 'spec/fixtures/Gemfile.in'
135
135
  @dep = Bundler::Dependency.new 'rake', '1.0.0'
136
136
  @gemfile = Bundler::Dsl.evaluate 'spec/fixtures/Gemfile.in', nil, true
137
- @gemfile.should_receive(:dependencies).and_return([@dep])
137
+ expect(@gemfile).to receive(:dependencies).and_return([@dep])
138
138
  end
139
139
 
140
140
  after(:each) do
@@ -142,14 +142,13 @@ module BundlerExt
142
142
  end
143
143
 
144
144
  it "returns gemfile dependencies with files" do
145
- described_class.should_receive(:files_for_dependency).and_return([:files])
146
- described_class.process(@gemfile, {}).should ==
147
- {'rake' => {:dep => @dep, :files => [:files]}}
145
+ expect(described_class).to receive(:files_for_dependency).and_return([:files])
146
+ expect(described_class.process(@gemfile, {})).to eq({'rake' => {:dep => @dep, :files => [:files]}})
148
147
  end
149
148
 
150
149
  it "does not return gemfile dependencies without files" do
151
- described_class.should_receive(:files_for_dependency).and_return([])
152
- described_class.process(@gemfile, {}).should == {}
150
+ expect(described_class).to receive(:files_for_dependency).and_return([])
151
+ expect(described_class.process(@gemfile, {})).to eq({})
153
152
  end
154
153
  end
155
154
 
@@ -164,26 +163,26 @@ module BundlerExt
164
163
  end
165
164
 
166
165
  it "sets up env for gemfile" do
167
- described_class.should_receive(:setup_env).with(@gemfile)
166
+ expect(described_class).to receive(:setup_env).with(@gemfile)
168
167
  described_class.parse(@gemfile)
169
168
  end
170
169
 
171
170
  it "retrieves env configured by gemfile" do
172
- described_class.should_receive(:parse_env).with([:test]).and_call_original
171
+ expect(described_class).to receive(:parse_env).with([:test]).and_call_original
173
172
  described_class.parse(@gemfile, :test)
174
173
  end
175
174
 
176
175
  it "evaluates gemfile with bundler dsl" do
177
- Bundler::Dsl.should_receive(:evaluate).with(@gemfile, nil, true).and_call_original
176
+ expect(Bundler::Dsl).to receive(:evaluate).with(@gemfile, nil, true).and_call_original
178
177
  described_class.parse(@gemfile, :test)
179
178
  end
180
179
 
181
180
  it "processes gemfile / returns results" do
182
181
  env = Object.new
183
182
  gemfile = Object.new
184
- described_class.should_receive(:parse_env).and_return(env)
185
- Bundler::Dsl.should_receive(:evaluate).and_return(gemfile)
186
- described_class.should_receive(:process).with(gemfile, env)
183
+ expect(described_class).to receive(:parse_env).and_return(env)
184
+ expect(Bundler::Dsl).to receive(:evaluate).and_return(gemfile)
185
+ expect(described_class).to receive(:process).with(gemfile, env)
187
186
  described_class.parse(@gemfile, :test)
188
187
  end
189
188
  end
@@ -24,89 +24,90 @@ end
24
24
  describe "with no group passed in" do
25
25
  it "should return nothing to require" do
26
26
  libs = BundlerExt::Gemfile.parse(@gemfile)
27
- libs.should be_an(Hash)
28
- libs.keys.should_not include('deltacloud-client')
29
- libs.keys.should_not include('vcr')
27
+ expect(libs).to be_an(Hash)
28
+ expect(libs.keys).to_not include('deltacloud-client')
29
+ expect(libs.keys).to_not include('vcr')
30
30
  end
31
31
  end
32
32
  describe "with :all passed in" do
33
33
  it "should return the list of system libraries in all groups to require" do
34
34
  libs = BundlerExt::Gemfile.parse(@gemfile, :all)
35
- libs.should be_an(Hash)
36
- libs.keys.should include('deltacloud-client')
37
- libs['deltacloud-client'][:files].should == ['deltacloud']
38
- libs.keys.should include('vcr')
35
+ expect(libs).to be_an(Hash)
36
+ expect(libs.keys).to include('deltacloud-client')
37
+ expect(libs['deltacloud-client'][:files]).to eq(['deltacloud'])
38
+ expect(libs.keys).to include('vcr')
39
39
  end
40
40
  end
41
41
  describe "with group passed in" do
42
42
  it "should not return any deps that are not in the 'development' group" do
43
43
  libs = BundlerExt::Gemfile.parse(@gemfile,'development')
44
- libs.should be_an(Hash)
45
- libs.keys.should_not include('deltacloud-client')
44
+ expect(libs).to be_an(Hash)
45
+ expect(libs.keys).to_not include('deltacloud-client')
46
46
  end
47
47
  it "should return only deps that are in the :test group" do
48
48
  libs = BundlerExt::Gemfile.parse(@gemfile, :test)
49
- libs.should be_an(Hash)
50
- libs.keys.should_not include('deltacloud-client')
51
- libs.keys.should include('vcr')
49
+ expect(libs).to be_an(Hash)
50
+ expect(libs.keys).to_not include('deltacloud-client')
51
+ expect(libs.keys).to include('vcr')
52
52
  end
53
53
  it "should return deps from both the :default and :test groups" do
54
54
  libs = BundlerExt::Gemfile.parse(@gemfile, :default, :test)
55
- libs.should be_an(Hash)
56
- libs.keys.should include('deltacloud-client')
57
- libs.keys.should include('vcr')
55
+ expect(libs).to be_an(Hash)
56
+ expect(libs.keys).to include('deltacloud-client')
57
+ expect(libs.keys).to include('vcr')
58
58
  end
59
59
  end
60
60
  it "should only return deps for the current platform" do
61
61
  libs = BundlerExt::Gemfile.parse(@gemfile)
62
- libs.should be_an(Hash)
62
+ expect(libs).to be_an(Hash)
63
63
  if RUBY_VERSION < "1.9"
64
- libs.keys.should_not include('cinch')
64
+ expect(libs.keys).to_not include('cinch')
65
65
  else
66
- libs.keys.should_not include('fastercsv')
66
+ expect(libs.keys).to_not include('fastercsv')
67
67
  end
68
68
  end
69
69
  end
70
70
  describe "#system_require" do
71
71
  it "strict mode should fail loading non existing gem" do
72
- expect { BundlerExt.system_require(@gemfile, :fail) }.to raise_error
72
+ expect { BundlerExt.system_require(@gemfile, :fail) }.
73
+ to raise_error(RuntimeError, 'Gem loading error: cannot load such file -- not_existing_gem')
73
74
  end
74
75
 
75
76
  it "non-strict mode should load the libraries in the gemfile" do
76
77
  ENV['BEXT_NOSTRICT'] = 'true'
77
78
  BundlerExt.system_require(@gemfile)
78
- defined?(Gem).should be_true
79
+ expect(defined?(Gem)).to be_truthy
79
80
  end
80
81
 
81
82
  it "non-strict mode should load the libraries in the gemfile" do
82
83
  ENV['BUNDLER_EXT_NOSTRICT'] = 'true'
83
84
  BundlerExt.system_require(@gemfile)
84
- defined?(Gem).should be_true
85
+ expect(defined?(Gem)).to be_truthy
85
86
  end
86
87
 
87
88
  it "non-strict mode should load the libraries in the gemfile" do
88
89
  ENV['BEXT_NOSTRICT'] = 'true'
89
90
  BundlerExt.system_require(@gemfile, :fail)
90
- defined?(Gem).should be_true
91
+ expect(defined?(Gem)).to be_truthy
91
92
  end
92
93
 
93
94
  it "non-strict mode should load the libraries in the gemfile" do
94
95
  ENV['BUNDLER_EXT_NOSTRICT'] = 'true'
95
96
  BundlerExt.system_require(@gemfile, :fail)
96
- defined?(Gem).should be_true
97
+ expect(defined?(Gem)).to be_truthy
97
98
  end
98
99
  it "non-strict mode should load the libraries using env var list" do
99
100
  ENV['BEXT_GROUPS'] = 'test development blah'
100
101
  ENV['BEXT_NOSTRICT'] = 'true'
101
102
  BundlerExt.system_require(@gemfile)
102
- defined?(Gem::Command).should be_true
103
+ expect(defined?(Gem)).to be_truthy
103
104
  end
104
105
 
105
106
  it "non-strict mode should load the libraries using env var list" do
106
107
  ENV['BUNLDER_EXT_GROUPS'] = 'test development blah'
107
108
  ENV['BEXT_NOSTRICT'] = 'true'
108
109
  BundlerExt.system_require(@gemfile)
109
- defined?(Gem::Command).should be_true
110
+ expect(defined?(Gem)).to be_truthy
110
111
  end
111
112
 
112
113
  unless skip_system
@@ -120,11 +121,11 @@ end
120
121
  gems = BundlerExt::Gemfile.parse(@gemfile, :all)
121
122
  gems.each { |gem,gdep|
122
123
  version = rand(100)
123
- BundlerExt::System.should_receive(:system_name_for).with(gem).
124
+ expect(BundlerExt::System).to receive(:system_name_for).with(gem).
124
125
  and_return(gem)
125
- BundlerExt::System.should_receive(:system_version_for).with(gem).
126
+ expect(BundlerExt::System).to receive(:system_version_for).with(gem).
126
127
  and_return(version)
127
- BundlerExt::System.should_receive(:gem).with(gem, "=#{version}")
128
+ expect(BundlerExt::System).to receive(:gem).with(gem, "=#{version}")
128
129
  }
129
130
  BundlerExt.system_require(@gemfile, :all)
130
131
  end
@@ -134,7 +135,7 @@ end
134
135
  ENV['BEXT_PKG_PREFIX'] = 'rubygem-'
135
136
  gems = BundlerExt::Gemfile.parse(@gemfile, :all)
136
137
  gems.each { |gem,gdep|
137
- BundlerExt::System.should_receive(:system_version_for).with("rubygem-#{gem}").
138
+ expect(BundlerExt::System).to receive(:system_version_for).with("rubygem-#{gem}").
138
139
  and_return('0')
139
140
  }
140
141
  BundlerExt.system_require(@gemfile, :all)
@@ -6,14 +6,14 @@ module BundlerExt
6
6
  describe "#gemfile" do
7
7
  it "gets/sets bext_gemfile" do
8
8
  runtime = described_class.new
9
- runtime.gemfile('Gemfile.in').should == 'Gemfile.in'
10
- runtime.gemfile.should == 'Gemfile.in'
9
+ expect(runtime.gemfile('Gemfile.in')).to eq('Gemfile.in')
10
+ expect(runtime.gemfile).to eq('Gemfile.in')
11
11
  end
12
12
 
13
13
  it "defaults to Bundler.default_gemfile" do
14
- Bundler.should_receive(:default_gemfile).and_return('DefaultGemfile')
14
+ expect(Bundler).to receive(:default_gemfile).and_return('DefaultGemfile')
15
15
  runtime = described_class.new
16
- runtime.gemfile.should == 'DefaultGemfile'
16
+ expect(runtime.gemfile).to eq('DefaultGemfile')
17
17
  end
18
18
  end
19
19
 
@@ -21,7 +21,7 @@ module BundlerExt
21
21
  it "returns directory name of gemfile" do
22
22
  runtime = described_class.new
23
23
  runtime.gemfile(Pathname.new('spec/fixtures/Gemfile.in'))
24
- runtime.root.to_s.should == File.expand_path('spec/fixtures')
24
+ expect(runtime.root.to_s).to eq(File.expand_path('spec/fixtures'))
25
25
  end
26
26
  end
27
27
 
@@ -30,9 +30,9 @@ module BundlerExt
30
30
  runtime = described_class.new
31
31
  runtime.gemfile(Pathname.new('spec/fixtures/Gemfile.in'))
32
32
  bundler = runtime.bundler
33
- bundler.should be_an_instance_of(Bundler::Runtime)
34
- bundler.root.to_s.should == File.expand_path('spec/fixtures')
35
- runtime.bundler.should == bundler
33
+ expect(bundler).to be_an_instance_of(Bundler::Runtime)
34
+ expect(bundler.root.to_s).to eq(File.expand_path('spec/fixtures'))
35
+ expect(runtime.bundler).to eq(bundler)
36
36
  end
37
37
  end
38
38
 
@@ -40,8 +40,8 @@ module BundlerExt
40
40
  it "returns handle to bundler rubygems integration" do
41
41
  runtime = described_class.new
42
42
  rubygems = runtime.rubygems
43
- rubygems.should be_an_instance_of(Bundler::RubygemsIntegration)
44
- runtime.rubygems.should == rubygems
43
+ expect(rubygems).to be_an_instance_of(Bundler::RubygemsIntegration)
44
+ expect(runtime.rubygems).to eq(rubygems)
45
45
  end
46
46
  end
47
47
 
@@ -55,76 +55,76 @@ module BundlerExt
55
55
  it "assigns env home variable to BEXT_HOME" do
56
56
  ENV['BEXT_HOME'] = '/home/foo'
57
57
  described_class.new.setup_env
58
- ENV['HOME'].should == '/home/foo'
58
+ expect(ENV['HOME']).to eq('/home/foo')
59
59
  end
60
60
 
61
61
  it "assigns env home variable to BUNDLER_EXT_HOME" do
62
62
  ENV['BUNDLER_EXT_HOME'] = '/home/foo'
63
63
  described_class.new.setup_env
64
- ENV['HOME'].should == '/home/foo'
64
+ expect(ENV['HOME']).to eq('/home/foo')
65
65
  end
66
66
  end
67
67
 
68
68
  describe "::namespaced_file" do
69
69
  context "file does not include '-'" do
70
70
  it "returns nil" do
71
- described_class.namespaced_file('foobar').should be_nil
71
+ expect(described_class.namespaced_file('foobar')).to be_nil
72
72
  end
73
73
  end
74
74
 
75
75
  context "file responds to :name" do
76
76
  it "returns file name in path format" do
77
77
  file = Pathname.new 'foo-bar'
78
- file.should_receive(:name).and_return('foo-bar')
79
- described_class.namespaced_file(file).should == 'foo/bar'
78
+ expect(file).to receive(:name).and_return('foo-bar')
79
+ expect(described_class.namespaced_file(file)).to eq('foo/bar')
80
80
  end
81
81
  end
82
82
 
83
83
  it "returns file in path format" do
84
- described_class.namespaced_file("foo-bar").should == 'foo/bar'
84
+ expect(described_class.namespaced_file("foo-bar")).to eq('foo/bar')
85
85
  end
86
86
  end
87
87
 
88
88
  describe "#system_require" do
89
89
  it "requires files" do
90
90
  runtime = described_class.new
91
- runtime.should_receive(:require).with('file1')
91
+ expect(runtime).to receive(:require).with('file1')
92
92
  runtime.system_require(['file1'])
93
93
  end
94
94
 
95
95
  context "LoadError when requiring file" do
96
96
  it "requires namespaced file" do
97
- described_class.should_receive(:namespaced_file).with('file1').
97
+ expect(described_class).to receive(:namespaced_file).with('file1').
98
98
  and_return('namespaced_file1')
99
99
  runtime = described_class.new
100
- runtime.should_receive(:require).with('file1').and_call_original
101
- runtime.should_receive(:require).with('namespaced_file1')
100
+ expect(runtime).to receive(:require).with('file1').and_call_original
101
+ expect(runtime).to receive(:require).with('namespaced_file1')
102
102
  runtime.system_require(['file1'])
103
103
  end
104
104
 
105
105
  context "LoadError when requiring namespaced file" do
106
106
  it "outputs strict error" do
107
107
  expected = 'Gem loading error: cannot load such file -- namespaced_file1'
108
- Output.should_receive(:strict_err).with(expected)
108
+ expect(Output).to receive(:strict_err).with(expected)
109
109
 
110
- described_class.should_receive(:namespaced_file).with('file1').
110
+ expect(described_class).to receive(:namespaced_file).with('file1').
111
111
  and_return('namespaced_file1')
112
112
  runtime = described_class.new
113
- runtime.should_receive(:require).with('file1').and_call_original
114
- runtime.should_receive(:require).with('namespaced_file1').and_call_original
113
+ expect(runtime).to receive(:require).with('file1').and_call_original
114
+ expect(runtime).to receive(:require).with('namespaced_file1').and_call_original
115
115
  runtime.system_require(['file1'])
116
116
  end
117
117
  end
118
118
 
119
119
  context "namespaced file is nil" do
120
120
  it "outputs strict error" do
121
- expected = 'Gem loading error: cannot load such file -- file1'
122
- Output.should_receive(:strict_err).with(expected)
121
+ expected = /^Gem loading error: cannot load such file -- file1($|\nDid you mean\? )/
122
+ expect(Output).to receive(:strict_err).with(expected)
123
123
 
124
- described_class.should_receive(:namespaced_file).with('file1').
124
+ expect(described_class).to receive(:namespaced_file).with('file1').
125
125
  and_return(nil)
126
126
  runtime = described_class.new
127
- runtime.should_receive(:require).with('file1').and_call_original
127
+ expect(runtime).to receive(:require).with('file1').and_call_original
128
128
  runtime.system_require(['file1'])
129
129
  end
130
130
  end
@@ -134,14 +134,14 @@ module BundlerExt
134
134
  describe "clear" do
135
135
  it "cleans bundler load path" do
136
136
  runtime = described_class.new
137
- runtime.bundler.should_receive(:clean_load_path)
137
+ expect(runtime.bundler).to receive(:clean_load_path)
138
138
  runtime.clear
139
139
  end
140
140
  end
141
141
 
142
142
  describe "add_spec" do
143
143
  around(:each) do |spec|
144
- orig = $LOAD_PATH
144
+ orig = $LOAD_PATH.dup
145
145
  spec.run
146
146
 
147
147
  # XXX need to restore this way else we'll get an err:
@@ -150,28 +150,28 @@ module BundlerExt
150
150
  orig.each { |o| $LOAD_PATH << o }
151
151
  end
152
152
 
153
+ # XXX needed to require rubygems/ext/builder in with Bundler 1.8.1+.
154
+ let!(:runtime) { described_class.new.tap {|c| c.rubygems} }
155
+
153
156
  it "marks spec as loaded" do
154
157
  spec = Gem::Specification.new
155
- runtime = described_class.new
156
- runtime.rubygems.should_receive(:mark_loaded).with(spec)
158
+ expect(runtime.rubygems).to receive(:mark_loaded).with(spec)
157
159
  runtime.add_spec(spec)
158
160
  end
159
161
 
160
162
  it "adds spec load paths not already on LOAD_PATH to it" do
161
163
  $LOAD_PATH.clear
162
164
  spec = Gem::Specification.new :load_paths => ['foo']
163
- runtime = described_class.new
164
165
  runtime.add_spec(spec)
165
- $LOAD_PATH.should include(*spec.load_paths)
166
+ expect($LOAD_PATH).to eq(spec.load_paths)
166
167
  end
167
168
 
168
169
  it "skips paths already on the $LOAD_PATH" do
169
170
  spec = Gem::Specification.new :load_paths => ['foo']
170
171
  $LOAD_PATH.clear
171
172
  $LOAD_PATH << spec.load_paths.first
172
- runtime = described_class.new
173
173
  runtime.add_spec(spec)
174
- $LOAD_PATH.size.should == 1
174
+ expect($LOAD_PATH.size).to eq(1)
175
175
  end
176
176
  end
177
177
  end # describe Runtime
@@ -12,64 +12,64 @@ module BundlerExt
12
12
  it "sets pkg_prefix from BEXT_PKG_PREFIX env variable" do
13
13
  ENV['BEXT_PKG_PREFIX'] = 'rubygem-'
14
14
  described_class.parse_env
15
- described_class.pkg_prefix.should == 'rubygem-'
15
+ expect(described_class.pkg_prefix).to eq('rubygem-')
16
16
  end
17
17
 
18
18
  it "defaults to blank pkg_prefix" do
19
19
  described_class.parse_env
20
- described_class.pkg_prefix.should == ''
20
+ expect(described_class.pkg_prefix).to eq('')
21
21
  end
22
22
 
23
23
  it "sets activate_versions from BEXT_ACTIVATE_VERSIONS env variable" do
24
24
  ENV['BEXT_ACTIVATE_VERSIONS'] = 'true'
25
25
  described_class.parse_env
26
- described_class.activate_versions.should == 'true'
26
+ expect(described_class.activate_versions).to eq('true')
27
27
  end
28
28
  end
29
29
 
30
30
  describe "#activate?" do
31
31
  context "activate_versions is false" do
32
32
  it "returns false" do
33
- described_class.activate?.should be_false
33
+ expect(described_class.activate?).to be_nil
34
34
  end
35
35
  end
36
36
 
37
37
  context "not an rpm system" do
38
38
  it "returns false" do
39
39
  ENV['BEXT_ACTIVATE_VERSIONS'] = 'true'
40
- described_class.should_receive(:is_rpm_system?).and_return(false)
41
- described_class.activate?.should be_false
40
+ expect(described_class).to receive(:is_rpm_system?).and_return(false)
41
+ expect(described_class.activate?).to be false
42
42
  end
43
43
  end
44
44
 
45
45
  it "returns true" do
46
46
  ENV['BEXT_ACTIVATE_VERSIONS'] = 'true'
47
- described_class.should_receive(:is_rpm_system?).and_return(true)
48
- described_class.activate?.should be_true
47
+ expect(described_class).to receive(:is_rpm_system?).and_return(true)
48
+ expect(described_class.activate?).to be true
49
49
  end
50
50
  end
51
51
 
52
52
  describe "#system_name_for" do
53
53
  it "returns package name with package prefix" do
54
54
  ENV['BEXT_PKG_PREFIX'] = 'rubygem-'
55
- described_class.system_name_for('rails').should == 'rubygem-rails'
55
+ expect(described_class.system_name_for('rails')).to eq('rubygem-rails')
56
56
  end
57
57
  end
58
58
 
59
59
  describe "#is_rpm_system?" do
60
60
  context "/usr/bin/rpm is not an executable file" do
61
61
  it "returns false" do
62
- File.should_receive(:executable?).
62
+ expect(File).to receive(:executable?).
63
63
  with(described_class.rpm_cmd).and_return(false)
64
- described_class.is_rpm_system?.should be_false
64
+ expect(described_class.is_rpm_system?).to be false
65
65
  end
66
66
  end
67
67
 
68
68
  context "/usr/bin/rpm is an executable file" do
69
69
  it "returns true" do
70
- File.should_receive(:executable?).
70
+ expect(File).to receive(:executable?).
71
71
  with(described_class.rpm_cmd).and_return(true)
72
- described_class.is_rpm_system?.should be_true
72
+ expect(described_class.is_rpm_system?).to be true
73
73
  end
74
74
  end
75
75
  end
@@ -83,55 +83,51 @@ module BundlerExt
83
83
 
84
84
  it "gets/sets rpm command" do
85
85
  described_class.rpm_cmd '/bin/rpm'
86
- described_class.rpm_cmd.should == '/bin/rpm'
86
+ expect(described_class.rpm_cmd).to eq('/bin/rpm')
87
87
  end
88
88
 
89
89
  it "defaults to /usr/bin/rpm" do
90
- described_class.rpm_cmd.should == '/usr/bin/rpm'
90
+ expect(described_class.rpm_cmd).to eq('/usr/bin/rpm')
91
91
  end
92
92
  end
93
93
 
94
94
  describe "#system_version_for" do
95
95
  context "rpm system" do
96
96
  it "uses rpm_cmd to retrieve version" do
97
- described_class.should_receive(:is_rpm_system?).and_return(true)
98
- described_class.should_receive(:`).
97
+ expect(described_class).to receive(:is_rpm_system?).and_return(true)
98
+ expect(described_class).to receive(:`).
99
99
  with("#{described_class.rpm_cmd} -qi rails").
100
100
  and_return("Name: rails\nVersion : 1.0.0 \nAnything")
101
- described_class.system_version_for('rails').should == '1.0.0'
101
+ expect(described_class.system_version_for('rails')).to eq('1.0.0')
102
102
  end
103
103
  end
104
104
 
105
105
  it "returns nil" do
106
- described_class.should_receive(:is_rpm_system?).and_return(false)
107
- described_class.system_version_for('rails').should be_nil
106
+ expect(described_class).to receive(:is_rpm_system?).and_return(false)
107
+ expect(described_class.system_version_for('rails')).to be_nil
108
108
  end
109
109
  end
110
110
 
111
111
  describe "#activate!" do
112
112
  it "activates system version of gem" do
113
- described_class.should_receive(:system_name_for).
113
+ expect(described_class).to receive(:system_name_for).
114
114
  with('rails').and_return('rubygem-rake')
115
- described_class.should_receive(:system_version_for).
115
+ expect(described_class).to receive(:system_version_for).
116
116
  with('rubygem-rake').and_return('1.2.3')
117
- described_class.should_receive(:gem).
117
+ expect(described_class).to receive(:gem).
118
118
  with('rails', '=1.2.3')
119
119
  described_class.activate!('rails')
120
120
  end
121
121
 
122
122
  it "gracefully handles load errors" do
123
- described_class.should_receive(:gem).and_raise(LoadError)
124
- lambda{
125
- described_class.activate!('rails')
126
- }.should_not raise_error
123
+ expect(described_class).to receive(:gem).and_raise(LoadError)
124
+ expect { described_class.activate!('rails') }.not_to raise_error
127
125
  end
128
126
 
129
127
  it "gracefully handles bad requirement errors" do
130
- described_class.should_receive(:gem).
128
+ expect(described_class).to receive(:gem).
131
129
  and_raise(Gem::Requirement::BadRequirementError)
132
- lambda{
133
- described_class.activate!('rails')
134
- }.should_not raise_error
130
+ expect { described_class.activate!('rails') }.not_to raise_error
135
131
  end
136
132
  end
137
133
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Guiditta
8
8
  - Mo Morsi
9
9
  - Lukas Zapletal
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-25 00:00:00.000000000 Z
13
+ date: 2022-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -28,18 +28,38 @@ dependencies:
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rspec
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '3'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '3'
43
+ - !ruby/object:Gem::Dependency
44
+ name: rake
31
45
  requirement: !ruby/object:Gem::Requirement
32
46
  requirements:
33
47
  - - ">="
34
48
  - !ruby/object:Gem::Version
35
- version: 1.3.0
49
+ version: '12'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '14'
36
53
  type: :development
37
54
  prerelease: false
38
55
  version_requirements: !ruby/object:Gem::Requirement
39
56
  requirements:
40
57
  - - ">="
41
58
  - !ruby/object:Gem::Version
42
- version: 1.3.0
59
+ version: '12'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '14'
43
63
  description: Simple library leveraging the Bundler Gemfile DSL to load gems already
44
64
  on the system and managed by the systems package manager (like yum/apt)
45
65
  email:
@@ -57,7 +77,6 @@ files:
57
77
  - lib/bundler_ext/gemfile.rb
58
78
  - lib/bundler_ext/output.rb
59
79
  - lib/bundler_ext/runtime.rb
60
- - lib/bundler_ext/setup.rb
61
80
  - lib/bundler_ext/system.rb
62
81
  - lib/bundler_ext/version.rb
63
82
  - spec/bundler_ext/bundler_ext_spec.rb
@@ -71,7 +90,7 @@ homepage: https://github.com/bundlerext/bundler_ext
71
90
  licenses:
72
91
  - MIT
73
92
  metadata: {}
74
- post_install_message:
93
+ post_install_message:
75
94
  rdoc_options: []
76
95
  require_paths:
77
96
  - lib
@@ -88,17 +107,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
107
  requirements:
89
108
  - Install the linux_admin gem and set BEXT_ACTIVATE_VERSIONS to true to activate rpm/deb
90
109
  installed gems
91
- rubyforge_project:
92
- rubygems_version: 2.4.8
93
- signing_key:
110
+ rubygems_version: 3.1.6
111
+ signing_key:
94
112
  specification_version: 4
95
113
  summary: Load system gems via Bundler DSL
96
114
  test_files:
115
+ - spec/bundler_ext/bundler_ext_spec.rb
97
116
  - spec/bundler_ext/gemfile_spec.rb
98
- - spec/bundler_ext/system_spec.rb
99
- - spec/bundler_ext/runtime_spec.rb
100
117
  - spec/bundler_ext/integration_spec.rb
101
- - spec/bundler_ext/bundler_ext_spec.rb
118
+ - spec/bundler_ext/runtime_spec.rb
119
+ - spec/bundler_ext/system_spec.rb
102
120
  - spec/fixtures/Gemfile.in
103
121
  - spec/spec_helper.rb
104
122
  - ".rspec"
@@ -1,2 +0,0 @@
1
- gemfile = ENV['BEXT_GEMFILE'] || 'Gemfile.in'
2
- BundlerExt.system_setup gemfile, :all