berkshelf 3.0.0.beta6 → 3.0.0.beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/berksfile.feature +2 -0
- data/features/commands/apply.feature +1 -1
- data/features/commands/contingent.feature +5 -3
- data/features/commands/install.feature +40 -40
- data/features/commands/list.feature +42 -20
- data/features/commands/outdated.feature +60 -16
- data/features/commands/show.feature +51 -8
- data/features/commands/update.feature +43 -15
- data/features/commands/upload.feature +4 -1
- data/features/commands/vendor.feature +27 -0
- data/features/json_formatter.feature +20 -8
- data/features/lockfile.feature +192 -71
- data/generator_files/CHANGELOG.md.erb +5 -0
- data/lib/berkshelf/berksfile.rb +166 -139
- data/lib/berkshelf/cli.rb +33 -30
- data/lib/berkshelf/cookbook_generator.rb +1 -0
- data/lib/berkshelf/dependency.rb +64 -14
- data/lib/berkshelf/downloader.rb +7 -10
- data/lib/berkshelf/errors.rb +59 -11
- data/lib/berkshelf/formatters/human_readable.rb +23 -36
- data/lib/berkshelf/formatters/json.rb +25 -29
- data/lib/berkshelf/installer.rb +111 -122
- data/lib/berkshelf/locations/git_location.rb +22 -9
- data/lib/berkshelf/locations/mercurial_location.rb +20 -5
- data/lib/berkshelf/locations/path_location.rb +22 -7
- data/lib/berkshelf/lockfile.rb +435 -203
- data/lib/berkshelf/resolver.rb +4 -2
- data/lib/berkshelf/source.rb +10 -1
- data/lib/berkshelf/version.rb +1 -1
- data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +3 -4
- data/spec/fixtures/lockfiles/2.0.lock +17 -0
- data/spec/fixtures/lockfiles/blank.lock +0 -0
- data/spec/fixtures/lockfiles/default.lock +18 -10
- data/spec/fixtures/lockfiles/empty.lock +3 -0
- data/spec/unit/berkshelf/berksfile_spec.rb +31 -74
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +4 -0
- data/spec/unit/berkshelf/installer_spec.rb +4 -7
- data/spec/unit/berkshelf/lockfile_parser_spec.rb +124 -0
- data/spec/unit/berkshelf/lockfile_spec.rb +140 -163
- metadata +11 -6
- data/features/licenses.feature +0 -79
- data/features/step_definitions/lockfile_steps.rb +0 -57
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-02-
|
15
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: addressable
|
@@ -354,7 +354,6 @@ files:
|
|
354
354
|
- features/config.feature
|
355
355
|
- features/help.feature
|
356
356
|
- features/json_formatter.feature
|
357
|
-
- features/licenses.feature
|
358
357
|
- features/lockfile.feature
|
359
358
|
- features/resolver.feature
|
360
359
|
- features/step_definitions/berksfile_steps.rb
|
@@ -366,11 +365,11 @@ files:
|
|
366
365
|
- features/step_definitions/filesystem_steps.rb
|
367
366
|
- features/step_definitions/gem_steps.rb
|
368
367
|
- features/step_definitions/json_steps.rb
|
369
|
-
- features/step_definitions/lockfile_steps.rb
|
370
368
|
- features/step_definitions/utility_steps.rb
|
371
369
|
- features/support/aruba.rb
|
372
370
|
- features/support/env.rb
|
373
371
|
- generator_files/Berksfile.erb
|
372
|
+
- generator_files/CHANGELOG.md.erb
|
374
373
|
- generator_files/Gemfile.erb
|
375
374
|
- generator_files/README.md.erb
|
376
375
|
- generator_files/Thorfile.erb
|
@@ -448,7 +447,10 @@ files:
|
|
448
447
|
- spec/fixtures/cookbooks/example_cookbook/README.md
|
449
448
|
- spec/fixtures/cookbooks/example_cookbook/metadata.rb
|
450
449
|
- spec/fixtures/cookbooks/example_cookbook/recipes/default.rb
|
450
|
+
- spec/fixtures/lockfiles/2.0.lock
|
451
|
+
- spec/fixtures/lockfiles/blank.lock
|
451
452
|
- spec/fixtures/lockfiles/default.lock
|
453
|
+
- spec/fixtures/lockfiles/empty.lock
|
452
454
|
- spec/spec_helper.rb
|
453
455
|
- spec/support/chef_api.rb
|
454
456
|
- spec/support/chef_server.rb
|
@@ -479,6 +481,7 @@ files:
|
|
479
481
|
- spec/unit/berkshelf/locations/git_location_spec.rb
|
480
482
|
- spec/unit/berkshelf/locations/mercurial_location_spec.rb
|
481
483
|
- spec/unit/berkshelf/locations/path_location_spec.rb
|
484
|
+
- spec/unit/berkshelf/lockfile_parser_spec.rb
|
482
485
|
- spec/unit/berkshelf/lockfile_spec.rb
|
483
486
|
- spec/unit/berkshelf/logger_spec.rb
|
484
487
|
- spec/unit/berkshelf/mercurial_spec.rb
|
@@ -536,7 +539,6 @@ test_files:
|
|
536
539
|
- features/config.feature
|
537
540
|
- features/help.feature
|
538
541
|
- features/json_formatter.feature
|
539
|
-
- features/licenses.feature
|
540
542
|
- features/lockfile.feature
|
541
543
|
- features/resolver.feature
|
542
544
|
- features/step_definitions/berksfile_steps.rb
|
@@ -548,7 +550,6 @@ test_files:
|
|
548
550
|
- features/step_definitions/filesystem_steps.rb
|
549
551
|
- features/step_definitions/gem_steps.rb
|
550
552
|
- features/step_definitions/json_steps.rb
|
551
|
-
- features/step_definitions/lockfile_steps.rb
|
552
553
|
- features/step_definitions/utility_steps.rb
|
553
554
|
- features/support/aruba.rb
|
554
555
|
- features/support/env.rb
|
@@ -566,7 +567,10 @@ test_files:
|
|
566
567
|
- spec/fixtures/cookbooks/example_cookbook/README.md
|
567
568
|
- spec/fixtures/cookbooks/example_cookbook/metadata.rb
|
568
569
|
- spec/fixtures/cookbooks/example_cookbook/recipes/default.rb
|
570
|
+
- spec/fixtures/lockfiles/2.0.lock
|
571
|
+
- spec/fixtures/lockfiles/blank.lock
|
569
572
|
- spec/fixtures/lockfiles/default.lock
|
573
|
+
- spec/fixtures/lockfiles/empty.lock
|
570
574
|
- spec/spec_helper.rb
|
571
575
|
- spec/support/chef_api.rb
|
572
576
|
- spec/support/chef_server.rb
|
@@ -597,6 +601,7 @@ test_files:
|
|
597
601
|
- spec/unit/berkshelf/locations/git_location_spec.rb
|
598
602
|
- spec/unit/berkshelf/locations/mercurial_location_spec.rb
|
599
603
|
- spec/unit/berkshelf/locations/path_location_spec.rb
|
604
|
+
- spec/unit/berkshelf/lockfile_parser_spec.rb
|
600
605
|
- spec/unit/berkshelf/lockfile_spec.rb
|
601
606
|
- spec/unit/berkshelf/logger_spec.rb
|
602
607
|
- spec/unit/berkshelf/mercurial_spec.rb
|
data/features/licenses.feature
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
Feature: Installing cookbooks with specific licenses
|
2
|
-
Background:
|
3
|
-
* the Berkshelf API server's cache is empty
|
4
|
-
* the Chef Server is empty
|
5
|
-
* the cookbook store is empty
|
6
|
-
* I have a Berksfile pointing at the local Berkshelf API with:
|
7
|
-
"""
|
8
|
-
cookbook 'fake', '1.0.0'
|
9
|
-
"""
|
10
|
-
|
11
|
-
Scenario: when licenses is defined
|
12
|
-
Given the cookbook store has the cookbooks:
|
13
|
-
| fake | 1.0.0 | mit |
|
14
|
-
And I have a Berkshelf config file containing:
|
15
|
-
"""
|
16
|
-
{ "allowed_licenses": ["mit"] }
|
17
|
-
"""
|
18
|
-
When I successfully run `berks install`
|
19
|
-
Then the output should not contain:
|
20
|
-
"""
|
21
|
-
is not in your list of allowed licenses
|
22
|
-
"""
|
23
|
-
|
24
|
-
Scenario: when a license is not listed
|
25
|
-
Given the cookbook store has the cookbooks:
|
26
|
-
| fake | 1.0.0 | mit |
|
27
|
-
And I have a Berkshelf config file containing:
|
28
|
-
"""
|
29
|
-
{ "allowed_licenses": ["apache2"] }
|
30
|
-
"""
|
31
|
-
When I successfully run `berks install`
|
32
|
-
Then the output should contain:
|
33
|
-
"""
|
34
|
-
'mit' is not in your list of allowed licenses
|
35
|
-
"""
|
36
|
-
|
37
|
-
Scenario: when raise_license_exception is defined
|
38
|
-
Given the cookbook store has the cookbooks:
|
39
|
-
| fake | 1.0.0 | mit |
|
40
|
-
And I have a Berkshelf config file containing:
|
41
|
-
"""
|
42
|
-
{ "allowed_licenses": ["mit"], "raise_license_exception": true }
|
43
|
-
"""
|
44
|
-
When I successfully run `berks install`
|
45
|
-
Then the output should not contain:
|
46
|
-
"""
|
47
|
-
is not in your list of allowed licenses
|
48
|
-
"""
|
49
|
-
|
50
|
-
Scenario: when raise_license_exception is defined and a license is not listed
|
51
|
-
Given the cookbook store has the cookbooks:
|
52
|
-
| fake | 1.0.0 | mit |
|
53
|
-
And I have a Berkshelf config file containing:
|
54
|
-
"""
|
55
|
-
{ "allowed_licenses": ["apache2"], "raise_license_exception": true }
|
56
|
-
"""
|
57
|
-
When I run `berks install`
|
58
|
-
Then the output should contain:
|
59
|
-
"""
|
60
|
-
'mit' is not in your list of allowed licenses
|
61
|
-
"""
|
62
|
-
And the exit status should be "LicenseNotAllowed"
|
63
|
-
|
64
|
-
Scenario: when the cookbook is a path location
|
65
|
-
Given the cookbook store has the cookbooks:
|
66
|
-
| fake | 0.1.0 | mit |
|
67
|
-
And I have a Berksfile pointing at the local Berkshelf API with:
|
68
|
-
"""
|
69
|
-
cookbook 'fake', path: '../../tmp/berkshelf/cookbooks/fake-0.1.0'
|
70
|
-
"""
|
71
|
-
And I have a Berkshelf config file containing:
|
72
|
-
"""
|
73
|
-
{ "allowed_licenses": ["apache2"], "raise_license_exception": true }
|
74
|
-
"""
|
75
|
-
When I successfully run `berks install`
|
76
|
-
Then the output should not contain:
|
77
|
-
"""
|
78
|
-
'mit' is not in your list of allowed licenses
|
79
|
-
"""
|
@@ -1,57 +0,0 @@
|
|
1
|
-
Then(/^the output should warn about the old lockfile format$/) do
|
2
|
-
message = Berkshelf::Lockfile.class_eval('LockfileLegacy.send(:warning_message)')
|
3
|
-
expect(all_output).to include(message)
|
4
|
-
end
|
5
|
-
|
6
|
-
Given /^the Lockfile has:$/ do |table|
|
7
|
-
result = { 'dependencies' => {} }
|
8
|
-
|
9
|
-
table.raw.each do |name, locked_or_path, ref, rel|
|
10
|
-
result['dependencies'][name] = {}
|
11
|
-
|
12
|
-
if locked_or_path =~ /(\d+\.){2}\d/
|
13
|
-
result['dependencies'][name]['locked_version'] = locked_or_path
|
14
|
-
else
|
15
|
-
result['dependencies'][name]['path'] = locked_or_path
|
16
|
-
end
|
17
|
-
|
18
|
-
unless ref.nil?
|
19
|
-
result['dependencies'][name]['rel'] = ref
|
20
|
-
end
|
21
|
-
|
22
|
-
unless rel.nil?
|
23
|
-
result['dependencies'][name]['rel'] = rel
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
File.open(File.join(current_dir, 'Berksfile.lock'), 'w') do |file|
|
28
|
-
file.write(JSON.pretty_generate(result) + "\n")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
Then /^the Lockfile should have:$/ do |table|
|
33
|
-
hash = JSON.parse(File.read(File.join(current_dir, 'Berksfile.lock')))
|
34
|
-
dependencies = hash['dependencies']
|
35
|
-
|
36
|
-
table.raw.each do |name, locked_or_path, ref, rel|
|
37
|
-
expect(dependencies).to have_key(name)
|
38
|
-
|
39
|
-
if locked_or_path =~ /(\d+\.){2}\d/
|
40
|
-
expect(dependencies[name]).to have_key('locked_version')
|
41
|
-
expect(dependencies[name]['locked_version']).to eq(locked_or_path)
|
42
|
-
else
|
43
|
-
expect(dependencies[name]).to have_key('path')
|
44
|
-
expect(dependencies[name]['path']).to eq(locked_or_path)
|
45
|
-
end
|
46
|
-
|
47
|
-
unless ref.nil?
|
48
|
-
expect(dependencies[name]).to have_key('ref')
|
49
|
-
expect(dependencies[name]['ref']).to eq(ref)
|
50
|
-
end
|
51
|
-
|
52
|
-
unless rel.nil?
|
53
|
-
expect(dependencies[name]).to have_key('rel')
|
54
|
-
expect(dependencies[name]['rel']).to eq(rel)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|