minimart 1.0.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,10 @@ describe Minimart::Cli do
8
8
  Dir.chdir(test_directory)
9
9
  end
10
10
 
11
- after(:each) { Dir.chdir(@pwd) }
11
+ after(:each) do
12
+ Dir.chdir(@pwd)
13
+ Minimart::Configuration.load_deps = false
14
+ end
12
15
 
13
16
  describe '#init' do
14
17
  context 'when a config file option is provided' do
@@ -30,17 +33,19 @@ describe Minimart::Cli do
30
33
  it 'should call the mirroring command with the proper options' do
31
34
  expect(Minimart::Commands::Mirror).to receive(:new).with(
32
35
  'inventory_config' => './inventory.yml',
33
- 'inventory_directory' => './inventory').and_return command_double
36
+ 'inventory_directory' => './inventory',
37
+ "load_deps"=>true).and_return command_double
34
38
 
35
- Minimart::Cli.start %w[mirror]
39
+ Minimart::Cli.start %w[mirror --load_deps true]
36
40
  end
37
41
 
38
42
  it 'should allow users to override the default settings' do
39
43
  expect(Minimart::Commands::Mirror).to receive(:new).with(
40
44
  'inventory_config' => './my-test.yml',
41
- 'inventory_directory' => './test-dir').and_return command_double
45
+ 'inventory_directory' => './test-dir',
46
+ "load_deps"=>true).and_return command_double
42
47
 
43
- Minimart::Cli.start %w[mirror --inventory_config=./my-test.yml --inventory_directory=./test-dir]
48
+ Minimart::Cli.start %w[mirror --load_deps true --inventory_config=./my-test.yml --inventory_directory=./test-dir]
44
49
  end
45
50
 
46
51
  context 'when an error is raised' do
@@ -51,7 +56,7 @@ describe Minimart::Cli do
51
56
  it 'should handle the error' do
52
57
  expect(Minimart::Error).to receive(:handle_exception)
53
58
 
54
- Minimart::Cli.start %w[mirror --inventory_config=./my-test.yml --inventory_directory=./test-dir]
59
+ Minimart::Cli.start %w[mirror --load_deps true --inventory_config=./my-test.yml --inventory_directory=./test-dir]
55
60
  end
56
61
  end
57
62
  end
@@ -50,7 +50,7 @@ describe Minimart::InventoryRequirement::GitRequirement do
50
50
  describe '#requirements' do
51
51
  before(:each) { requirement.fetch_cookbook }
52
52
  subject { requirement.requirements }
53
- it { is_expected.to eq('yum' => '> 3.0.0') }
53
+ it { is_expected.to_not eq('yum' => '> 3.0.0') }
54
54
  end
55
55
 
56
56
  describe '#matching_source?' do
@@ -14,9 +14,6 @@ describe Minimart::Mirror::DependencyGraph do
14
14
  end
15
15
 
16
16
  describe '#add_artifact' do
17
- let(:cookbook_dependencies) do
18
- subject.find_graph_artifact(cookbook).dependencies.map(&:name)
19
- end
20
17
 
21
18
  before(:each) do
22
19
  subject.add_artifact(cookbook)
@@ -26,8 +23,12 @@ describe Minimart::Mirror::DependencyGraph do
26
23
  expect(subject.source_cookbook_added?(cookbook.name, cookbook.version)).to eq true
27
24
  end
28
25
 
29
- it 'should add any possible dependencies to the graph' do
30
- expect(cookbook_dependencies).to include 'yum'
26
+ it 'should not have any dependencies' do
27
+ expect(subject.find_graph_artifact(cookbook).dependencies).to eq []
28
+ end
29
+
30
+ it 'should not add any possible dependencies to the graph' do
31
+ expect(subject.find_graph_artifact(cookbook).dependencies.map(&:name)).to_not include 'yum'
31
32
  end
32
33
 
33
34
  context 'when the cookbook has already been added' do
@@ -43,12 +44,9 @@ describe Minimart::Mirror::DependencyGraph do
43
44
  end
44
45
 
45
46
  it 'should not add any new dependencies' do
46
- expect(cookbook_dependencies).to_not include 'apt'
47
+ expect(subject.find_graph_artifact(cookbook).dependencies.map(&:name)).to_not include 'apt'
47
48
  end
48
49
 
49
- it 'should leave existing dependencies in place' do
50
- expect(cookbook_dependencies).to include 'yum'
51
- end
52
50
  end
53
51
  end
54
52
 
@@ -93,16 +91,16 @@ describe Minimart::Mirror::DependencyGraph do
93
91
  subject.add_requirement('mysql' => '= 1.0.0')
94
92
  end
95
93
 
96
- it 'should return a resolved mysql version' do
94
+ it 'should not return a resolved mysql version' do
97
95
  expect(subject.resolved_requirements).to include ['mysql', '1.0.0']
98
96
  end
99
97
 
100
- it 'should return a resolved apt version' do
98
+ it 'should not return a resolved apt version' do
101
99
  expect(subject.resolved_requirements).to include ['apt', '2.0.0']
102
100
  end
103
101
 
104
- it 'should return a resolved yum version for the mysql dependency' do
105
- expect(subject.resolved_requirements).to include ['yum', '5.0.0']
102
+ it 'should not return a resolved yum version for the mysql dependency' do
103
+ expect(subject.resolved_requirements).to_not include ['yum', '5.0.0']
106
104
  end
107
105
  end
108
106
 
@@ -113,10 +111,10 @@ describe Minimart::Mirror::DependencyGraph do
113
111
  subject.add_requirement('mysql' => '= 1.0.0')
114
112
  end
115
113
 
116
- it 'should raise an error' do
114
+ it 'should not raise an error' do
117
115
  expect {
118
116
  subject.resolved_requirements
119
- }.to raise_error Minimart::Error::UnresolvedDependency
117
+ }.to_not raise_error
120
118
  end
121
119
  end
122
120
  end
@@ -21,26 +21,31 @@ describe Minimart::Mirror::InventoryBuilder do
21
21
  VCR.use_cassette('location_specific_cookbooks') { e.call }
22
22
  end
23
23
 
24
+ # broken
24
25
  it 'should add the cookbook to the graph' do
25
26
  subject.build!
26
27
  expect(subject.graph.source_cookbook_added?('sample_cookbook', '1.2.3')).to eq true
27
28
  end
28
29
 
30
+ # broken
29
31
  it 'should add the cookbook to the local store' do
30
32
  subject.build!
31
33
  expect(subject.local_store.installed?('sample_cookbook', '1.2.3')).to eq true
32
34
  end
33
35
 
34
- it 'should add any dependencies of the cookbook to the local store' do
36
+ # broken
37
+ it 'should not add any dependencies of the cookbook to the local store' do
35
38
  subject.build!
36
- expect(subject.local_store.installed?('yum', '3.5.1')).to eq true
39
+ expect(subject.local_store.installed?('yum', '3.5.1')).to eq false
37
40
  end
38
41
 
42
+ # broken
39
43
  it 'should clear the git cache' do
40
44
  expect_any_instance_of(Minimart::Download::GitCache).to receive :clear
41
45
  subject.build!
42
46
  end
43
47
 
48
+ # broken
44
49
  it 'should store metadata about downloading the cookbook' do
45
50
  subject.build!
46
51
  metadata = JSON.parse(File.open(File.join(test_directory, 'sample_cookbook-1.2.3', '.minimart.json')).read)
@@ -61,6 +66,7 @@ describe Minimart::Mirror::InventoryBuilder do
61
66
  'commitish' => 'SHA')
62
67
  end
63
68
 
69
+ # broken
64
70
  it 'should raise an error' do
65
71
  expect {
66
72
  subject.build!
@@ -88,9 +94,9 @@ describe Minimart::Mirror::InventoryBuilder do
88
94
  expect(subject.local_store.installed?('sample_cookbook', '1.2.3')).to eq true
89
95
  end
90
96
 
91
- it 'should add any dependencies of the cookbook to the local store' do
97
+ it 'should not add any dependencies of the cookbook to the local store' do
92
98
  subject.build!
93
- expect(subject.local_store.installed?('yum', '3.5.1')).to eq true
99
+ expect(subject.local_store.installed?('yum', '3.5.1')).to eq false
94
100
  end
95
101
 
96
102
  it 'should store metadata about downloading the cookbook' do
@@ -142,16 +148,16 @@ describe Minimart::Mirror::InventoryBuilder do
142
148
  expect(Dir.exists?(File.join(test_directory, 'mysql-5.5.4'))).to eq true
143
149
  end
144
150
 
145
- it 'should add any resolved dependencies to the local store' do
151
+ it 'should not add any resolved dependencies to the local store' do
146
152
  subject.build!
147
- expect(subject.local_store.installed?('yum', '3.5.1')).to eq true
148
- expect(subject.local_store.installed?('yum-mysql-community', '0.1.10')).to eq true
153
+ expect(subject.local_store.installed?('yum', '3.5.1')).to eq false
154
+ expect(subject.local_store.installed?('yum-mysql-community', '0.1.10')).to eq false
149
155
  end
150
156
 
151
- it 'should actually add the dependent cookbooks to the local inventory' do
157
+ it 'should actually not add the dependent cookbooks to the local inventory' do
152
158
  subject.build!
153
- expect(Dir.exists?(File.join(test_directory, 'yum-3.5.1'))).to eq true
154
- expect(Dir.exists?(File.join(test_directory, 'yum-mysql-community-0.1.10'))).to eq true
159
+ expect(Dir.exists?(File.join(test_directory, 'yum-3.5.1'))).to eq false
160
+ expect(Dir.exists?(File.join(test_directory, 'yum-mysql-community-0.1.10'))).to eq false
155
161
  end
156
162
 
157
163
  it 'should store metadata about downloading the cookbook' do
@@ -159,7 +165,7 @@ describe Minimart::Mirror::InventoryBuilder do
159
165
  metadata = JSON.parse(File.open(File.join(test_directory, 'mysql-5.5.4', '.minimart.json')).read)
160
166
  expect(metadata).to include(
161
167
  'source_type' => 'opscode',
162
- 'location' => 'https://supermarket.chef.io/api/v1')
168
+ 'location' => 'https://supermarket.chef.io:443/api/v1')
163
169
  end
164
170
 
165
171
  context 'when a cookbook has already been installed' do
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,8 @@ end
8
8
 
9
9
  begin; require 'pry'; rescue LoadError; end
10
10
 
11
+ require 'dotenv'
12
+ Dotenv.load
11
13
  require 'rspec'
12
14
  require 'vcr'
13
15
  require 'webmock/rspec'
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimart
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
- - Bernie
8
- - Durfee
7
+ - MadGlory
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: git
@@ -17,14 +16,14 @@ dependencies:
17
16
  requirements:
18
17
  - - ~>
19
18
  - !ruby/object:Gem::Version
20
- version: '1.2'
19
+ version: 1.2.6
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - ~>
26
25
  - !ruby/object:Gem::Version
27
- version: '1.2'
26
+ version: 1.2.6
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: minitar
30
29
  requirement: !ruby/object:Gem::Requirement
@@ -207,15 +206,29 @@ dependencies:
207
206
  - - ~>
208
207
  - !ruby/object:Gem::Version
209
208
  version: '2.9'
209
+ - !ruby/object:Gem::Dependency
210
+ name: dotenv
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ! '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
210
223
  description: MiniMart is a RubyGem that makes it simple to build a repository of Chef
211
224
  cookbooks using only static files.
212
- email:
213
- - minimart@cobzilla.com
225
+ email:
214
226
  executables:
215
227
  - minimart
216
228
  extensions: []
217
229
  extra_rdoc_files: []
218
230
  files:
231
+ - .env.test
219
232
  - .gitignore
220
233
  - .rspec
221
234
  - .travis.yml