berkshelf 2.0.0.beta → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +19 -1
- data/CONTRIBUTING.md +1 -3
- data/Gemfile +0 -20
- data/Guardfile +3 -3
- data/LICENSE +6 -5
- data/README.md +1 -0
- data/Thorfile +48 -67
- data/berkshelf.gemspec +48 -37
- data/features/apply_command.feature +17 -11
- data/features/config.feature +11 -11
- data/features/configure_command.feature +8 -8
- data/features/contingent_command.feature +37 -8
- data/features/cookbook_command.feature +17 -14
- data/features/groups_install.feature +24 -20
- data/features/install_command.feature +24 -33
- data/features/licenses.feature +112 -0
- data/features/list_command.feature +17 -5
- data/features/lockfile.feature +307 -188
- data/features/outdated_command.feature +1 -4
- data/features/package_command.feature +41 -19
- data/features/shelf/list.feature +39 -0
- data/features/shelf/show.feature +152 -0
- data/features/shelf/uninstall.feature +103 -0
- data/features/show_command.feature +49 -17
- data/features/step_definitions/filesystem_steps.rb +12 -3
- data/features/step_definitions/utility_steps.rb +0 -1
- data/features/support/env.rb +11 -4
- data/features/update_command.feature +22 -10
- data/features/upload_command.feature +174 -127
- data/features/vendor_install.feature +6 -6
- data/generator_files/Berksfile.erb +1 -1
- data/generator_files/metadata.rb.erb +7 -7
- data/lib/berkshelf.rb +39 -27
- data/lib/berkshelf/base_generator.rb +2 -3
- data/lib/berkshelf/berksfile.rb +69 -17
- data/lib/berkshelf/cached_cookbook.rb +17 -1
- data/lib/berkshelf/chef.rb +2 -4
- data/lib/berkshelf/chef/config.rb +51 -75
- data/lib/berkshelf/chef/cookbook.rb +1 -2
- data/lib/berkshelf/chef/cookbook/chefignore.rb +1 -1
- data/lib/berkshelf/cli.rb +144 -194
- data/lib/berkshelf/command.rb +11 -12
- data/lib/berkshelf/commands/shelf.rb +130 -0
- data/lib/berkshelf/commands/test_command.rb +11 -0
- data/lib/berkshelf/community_rest.rb +1 -2
- data/lib/berkshelf/config.rb +14 -10
- data/lib/berkshelf/cookbook_generator.rb +30 -24
- data/lib/berkshelf/cookbook_source.rb +1 -1
- data/lib/berkshelf/cookbook_store.rb +0 -1
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/core_ext/file.rb +1 -1
- data/lib/berkshelf/downloader.rb +3 -1
- data/lib/berkshelf/errors.rb +128 -53
- data/lib/berkshelf/formatters.rb +2 -6
- data/lib/berkshelf/formatters/human_readable.rb +8 -2
- data/lib/berkshelf/formatters/json.rb +7 -1
- data/lib/berkshelf/formatters/null.rb +0 -1
- data/lib/berkshelf/git.rb +16 -16
- data/lib/berkshelf/init_generator.rb +28 -26
- data/lib/berkshelf/location.rb +12 -11
- data/lib/berkshelf/locations/chef_api_location.rb +2 -2
- data/lib/berkshelf/locations/git_location.rb +0 -1
- data/lib/berkshelf/locations/github_location.rb +0 -1
- data/lib/berkshelf/locations/path_location.rb +1 -2
- data/lib/berkshelf/locations/site_location.rb +3 -2
- data/lib/berkshelf/lockfile.rb +29 -10
- data/lib/berkshelf/mixin/config.rb +155 -0
- data/lib/berkshelf/mixin/logging.rb +0 -1
- data/lib/berkshelf/mixin/shellout.rb +71 -0
- data/lib/berkshelf/resolver.rb +7 -4
- data/lib/berkshelf/test.rb +1 -3
- data/lib/berkshelf/ui.rb +8 -4
- data/lib/berkshelf/version.rb +1 -1
- data/lib/thor/monkies/shell.rb +0 -1
- data/spec/config/berkshelf.pem +27 -0
- data/spec/config/knife.rb +12 -0
- data/spec/config/validator.pem +27 -0
- data/spec/spec_helper.rb +4 -8
- data/spec/support/chef_api.rb +14 -9
- data/spec/support/chef_server.rb +3 -4
- data/spec/unit/berkshelf/berksfile_spec.rb +1 -1
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +12 -6
- data/spec/unit/berkshelf/cookbook_source_spec.rb +13 -1
- data/spec/unit/berkshelf/init_generator_spec.rb +5 -0
- data/spec/unit/chef/config_spec.rb +9 -10
- metadata +216 -93
- data/features/info_command.feature +0 -39
- data/features/open_command.feature +0 -36
- data/lib/berkshelf/cli_commands/test_command.rb +0 -11
- data/lib/berkshelf/mixin.rb +0 -10
- data/lib/berkshelf/mixin/path_helpers.rb +0 -30
- data/spec/support/knife.rb +0 -18
@@ -1,11 +1,11 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Configuring Berkshelf via the command line
|
2
2
|
As CLI user of Berkshelf
|
3
3
|
I want a command to generate a Berkshelf configuration file based on my input
|
4
4
|
So I can quickly get up and running with the least amount of resistance
|
5
5
|
|
6
|
-
Scenario:
|
6
|
+
Scenario: Using custom values
|
7
7
|
Given I do not have a Berkshelf config file
|
8
|
-
When I run
|
8
|
+
When I run `berks configure` interactively
|
9
9
|
And I type "https://api.opscode.com/organizations/vialstudios"
|
10
10
|
And I type "node_name"
|
11
11
|
And I type "client_key"
|
@@ -27,10 +27,10 @@ Feature: configure command
|
|
27
27
|
| vagrant.vm.box | Berkshelf-minimal |
|
28
28
|
| vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
|
29
29
|
|
30
|
-
Scenario:
|
30
|
+
Scenario: Accepting the default values
|
31
31
|
Given I do not have a Berkshelf config file
|
32
32
|
And I have a default Chef config
|
33
|
-
When I run
|
33
|
+
When I run `berks configure` interactively
|
34
34
|
And I type ""
|
35
35
|
And I type ""
|
36
36
|
And I type ""
|
@@ -51,16 +51,16 @@ Feature: configure command
|
|
51
51
|
| vagrant.vm.box | Berkshelf-CentOS-6.3-x86_64-minimal |
|
52
52
|
| vagrant.vm.box_url | https://dl.dropbox.com/u/31081437/Berkshelf-CentOS-6.3-x86_64-minimal.box |
|
53
53
|
|
54
|
-
Scenario:
|
54
|
+
Scenario: Creating a Berkshelf configuration file when one already exists
|
55
55
|
Given I have a default Berkshelf config file
|
56
|
-
When I run
|
56
|
+
When I run `berks configure` interactively
|
57
57
|
Then the output should contain:
|
58
58
|
"""
|
59
59
|
A configuration file already exists. Re-run with the --force flag if you wish to overwrite it.
|
60
60
|
"""
|
61
61
|
And the CLI should exit with the status code for error "ConfigExists"
|
62
62
|
|
63
|
-
Scenario Outline:
|
63
|
+
Scenario Outline: Using the --path option
|
64
64
|
Given I do not have a Berkshelf config file at "<path>"
|
65
65
|
When I run the "configure --path <path>" command interactively
|
66
66
|
And I type "https://api.opscode.com/organizations/vialstudios"
|
@@ -1,18 +1,47 @@
|
|
1
|
-
Feature: contingent command
|
1
|
+
Feature: Running the contingent command
|
2
2
|
As a user with a Berksfile
|
3
3
|
I want a way to the cookbooks that depend on another
|
4
4
|
So that I can better understand my infrastructure
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
Scenario: When there are dependent cookbooks
|
7
|
+
Given the cookbook store has the cookbooks:
|
8
|
+
| dep | 1.0.0 |
|
9
|
+
And the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
|
10
|
+
| dep | ~> 1.0.0 |
|
11
|
+
And the cookbook store contains a cookbook "ekaf" "1.0.0" with dependencies:
|
12
|
+
| dep | ~> 1.0.0 |
|
13
|
+
And I write to "Berksfile" with:
|
9
14
|
"""
|
10
|
-
cookbook '
|
15
|
+
cookbook 'fake', '1.0.0'
|
16
|
+
cookbook 'ekaf', '1.0.0'
|
11
17
|
"""
|
12
|
-
And I successfully run `berks contingent
|
18
|
+
And I successfully run `berks contingent dep`
|
13
19
|
Then the output should contain:
|
14
20
|
"""
|
15
|
-
Cookbooks contingent upon
|
16
|
-
*
|
21
|
+
Cookbooks in this Berksfile contingent upon dep:
|
22
|
+
* ekaf (1.0.0)
|
23
|
+
* fake (1.0.0)
|
17
24
|
"""
|
18
25
|
And the exit status should be 0
|
26
|
+
|
27
|
+
Scenario: When there are no dependent cookbooks
|
28
|
+
Given the cookbook store has the cookbooks:
|
29
|
+
| fake | 1.0.0 |
|
30
|
+
And I write to "Berksfile" with:
|
31
|
+
"""
|
32
|
+
cookbook 'fake', '1.0.0'
|
33
|
+
"""
|
34
|
+
And I successfully run `berks contingent dep`
|
35
|
+
Then the output should contain:
|
36
|
+
"""
|
37
|
+
There are no cookbooks contingent upon 'dep' defined in this Berksfile
|
38
|
+
"""
|
39
|
+
And the exit status should be 0
|
40
|
+
|
41
|
+
Scenario: When the cookbook is not in the Berksfile
|
42
|
+
Given an empty file named "Berksfile"
|
43
|
+
And I successfully run `berks contingent dep`
|
44
|
+
Then the output should contain:
|
45
|
+
"""
|
46
|
+
There are no cookbooks contingent upon 'dep' defined in this Berksfile
|
47
|
+
"""
|
@@ -1,29 +1,32 @@
|
|
1
|
-
Feature: cookbook
|
1
|
+
Feature: Creating a new cookbook
|
2
2
|
As a Cookbook author
|
3
3
|
I want a way to quickly generate a Cookbook skeleton that contains supporting Berkshelf files
|
4
4
|
So I can quickly and automatically generate a Cookbook containing Berkshelf supporting files or other common supporting files
|
5
5
|
|
6
|
-
Scenario:
|
7
|
-
When I run
|
6
|
+
Scenario: With the default options
|
7
|
+
When I successfully run `berks cookbook sparkle_motion`
|
8
8
|
Then I should have a new cookbook skeleton "sparkle_motion"
|
9
9
|
And the exit status should be 0
|
10
10
|
|
11
|
-
Scenario Outline:
|
11
|
+
Scenario Outline: With various options
|
12
12
|
When I run the cookbook command to create "sparkle_motion" with options:
|
13
13
|
| --<option> |
|
14
14
|
Then I should have a new cookbook skeleton "sparkle_motion" with <feature> support
|
15
15
|
And the exit status should be 0
|
16
16
|
|
17
17
|
Examples:
|
18
|
-
| option
|
19
|
-
| foodcritic
|
20
|
-
| chef-minitest
|
21
|
-
| scmversion
|
22
|
-
| no-bundler
|
23
|
-
|
24
|
-
|
18
|
+
| option | feature |
|
19
|
+
| foodcritic | Foodcritic |
|
20
|
+
| chef-minitest | Chef-Minitest |
|
21
|
+
| scmversion | SCMVersion |
|
22
|
+
| no-bundler | no Bundler |
|
23
|
+
# Disable testing of skip git until Test Kitchen supports the skip_git flag in it's generator
|
24
|
+
# https://github.com/opscode/test-kitchen/issues/141
|
25
|
+
# | skip-git | no Git |
|
26
|
+
| skip-vagrant | no Vagrant |
|
27
|
+
| skip-test-kitchen | no Test Kitchen |
|
25
28
|
|
26
|
-
Scenario Outline:
|
29
|
+
Scenario Outline: When a required supporting gem is not installed
|
27
30
|
Given the gem "<gem>" is not installed
|
28
31
|
When I run the cookbook command to create "sparkle_motion" with options:
|
29
32
|
| --<option> |
|
@@ -36,9 +39,9 @@ Feature: cookbook command
|
|
36
39
|
| foodcritic | Foodcritic | foodcritic |
|
37
40
|
| scmversion | SCMVersion | thor-scmversion |
|
38
41
|
|
39
|
-
Scenario:
|
42
|
+
Scenario: When bundler is not installed
|
40
43
|
Given the gem "bundler" is not installed
|
41
|
-
When I run
|
44
|
+
When I successfully run `berks cookbook sparkle_motion`
|
42
45
|
Then I should have a new cookbook skeleton "sparkle_motion"
|
43
46
|
And the output should contain a warning to suggest supporting the default for "bundler" by installing "bundler"
|
44
47
|
And the exit status should be 0
|
@@ -1,51 +1,55 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Installing specific groups
|
2
2
|
As a user
|
3
3
|
I want to be able specify groups of cookbooks to include or exclude
|
4
4
|
So I don't install cookbooks that are part of a group that I do not want to install
|
5
5
|
|
6
|
-
Scenario: except
|
6
|
+
Scenario: Using the --except option
|
7
|
+
Given the cookbook store has the cookbooks:
|
8
|
+
| default | 1.0.0 |
|
9
|
+
| takeme | 1.0.0 |
|
7
10
|
Given I write to "Berksfile" with:
|
8
11
|
"""
|
9
12
|
group :notme do
|
10
|
-
cookbook '
|
13
|
+
cookbook 'notme', '1.0.0'
|
11
14
|
end
|
12
15
|
|
13
|
-
cookbook '
|
16
|
+
cookbook 'default', '1.0.0'
|
14
17
|
|
15
18
|
group :takeme do
|
16
|
-
cookbook '
|
19
|
+
cookbook 'takeme', '1.0.0'
|
17
20
|
end
|
18
21
|
"""
|
19
22
|
When I successfully run `berks install --except notme`
|
20
|
-
Then the
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
Then the output should contain:
|
24
|
+
"""
|
25
|
+
Using default (1.0.0)
|
26
|
+
Using takeme (1.0.0)
|
27
|
+
"""
|
28
|
+
And the output should not contain "Using notme (1.0.0)"
|
25
29
|
And the exit status should be 0
|
26
30
|
|
27
|
-
Scenario: only
|
31
|
+
Scenario: Using the --only option
|
32
|
+
Given the cookbook store has the cookbooks:
|
33
|
+
| takeme | 1.0.0 |
|
28
34
|
Given I write to "Berksfile" with:
|
29
35
|
"""
|
30
36
|
group :notme do
|
31
|
-
cookbook '
|
37
|
+
cookbook 'notme', '1.0.0'
|
32
38
|
end
|
33
39
|
|
34
|
-
cookbook '
|
40
|
+
cookbook 'default', '1.0.0'
|
35
41
|
|
36
42
|
group :takeme do
|
37
|
-
cookbook '
|
43
|
+
cookbook 'takeme', '1.0.0'
|
38
44
|
end
|
39
45
|
"""
|
40
46
|
When I successfully run `berks install --only takeme`
|
41
|
-
Then the
|
42
|
-
|
43
|
-
|
44
|
-
| nginx | 0.101.2 |
|
45
|
-
| berkshelf-cookbook-fixture | 1.0.0 |
|
47
|
+
Then the output should contain "Using takeme (1.0.0)"
|
48
|
+
Then the output should not contain "Using notme (1.0.0)"
|
49
|
+
Then the output should not contain "Using default (1.0.0)"
|
46
50
|
And the exit status should be 0
|
47
51
|
|
48
|
-
Scenario:
|
52
|
+
Scenario: Attempting to provide an only and except option
|
49
53
|
Given I write to "Berksfile" with:
|
50
54
|
"""
|
51
55
|
group :notme do
|
@@ -3,30 +3,6 @@ Feature: install cookbooks from a Berksfile
|
|
3
3
|
I want to be able to run knife berkshelf install to install my cookbooks
|
4
4
|
So that I don't have to download my cookbooks and their dependencies manually
|
5
5
|
|
6
|
-
Scenario: installing with the old lockfile format
|
7
|
-
Given I write to "Berksfile" with:
|
8
|
-
"""
|
9
|
-
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
10
|
-
"""
|
11
|
-
Given I write to "Berksfile.lock" with:
|
12
|
-
"""
|
13
|
-
cookbook 'berkshelf-cookbook-fixture', :locked_version => '1.0.0'
|
14
|
-
"""
|
15
|
-
When I successfully run `berks install`
|
16
|
-
Then the output should contain "You are using the old lockfile format. Attempting to convert..."
|
17
|
-
Then the file "Berksfile.lock" should contain JSON:
|
18
|
-
"""
|
19
|
-
{
|
20
|
-
"sha":"bfb1de046fdc2a0c38cd5bbaddddce8bc1cd3c24",
|
21
|
-
"sources":{
|
22
|
-
"berkshelf-cookbook-fixture":{
|
23
|
-
"locked_version":"1.0.0",
|
24
|
-
"constraint":"= 1.0.0"
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
"""
|
29
|
-
|
30
6
|
Scenario: installing a Berksfile that contains a source with a default location
|
31
7
|
Given I write to "Berksfile" with:
|
32
8
|
"""
|
@@ -182,7 +158,7 @@ Feature: install cookbooks from a Berksfile
|
|
182
158
|
When I run `berks install`
|
183
159
|
Then the output should contain:
|
184
160
|
"""
|
185
|
-
'somethingabsurd' is not
|
161
|
+
'somethingabsurd' is not supported for the 'github' location key - please use 'git' instead
|
186
162
|
"""
|
187
163
|
And the exit status should be 110
|
188
164
|
|
@@ -244,7 +220,7 @@ Feature: install cookbooks from a Berksfile
|
|
244
220
|
When I run `berks install`
|
245
221
|
Then the output should contain:
|
246
222
|
"""
|
247
|
-
'/something/on/disk' is not a valid Git URI
|
223
|
+
'/something/on/disk' is not a valid Git URI
|
248
224
|
"""
|
249
225
|
And the CLI should exit with the status code for error "InvalidGitURI"
|
250
226
|
|
@@ -275,7 +251,7 @@ Feature: install cookbooks from a Berksfile
|
|
275
251
|
does not satisfy the version constraint:
|
276
252
|
berkshelf-cookbook-fixture \(= 1.0.0\)
|
277
253
|
|
278
|
-
This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb
|
254
|
+
This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb`
|
279
255
|
"""
|
280
256
|
And the CLI should exit with the status code for error "CookbookValidationFailure"
|
281
257
|
|
@@ -322,6 +298,20 @@ Feature: install cookbooks from a Berksfile
|
|
322
298
|
| berkshelf-cookbook-fixture | 1.0.0 |
|
323
299
|
And the exit status should be 0
|
324
300
|
|
301
|
+
Scenario: when the :site is not defined
|
302
|
+
Given I write to "Berksfile" with:
|
303
|
+
"""
|
304
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: nil
|
305
|
+
"""
|
306
|
+
When I successfully run `berks install`
|
307
|
+
Then the output should contain:
|
308
|
+
"""
|
309
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from site:
|
310
|
+
"""
|
311
|
+
And the cookbook store should have the cookbooks:
|
312
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
313
|
+
And the exit status should be 0
|
314
|
+
|
325
315
|
Scenario: with a chef_api source location specifying :config when a Berkshelf config is not found at the given path
|
326
316
|
Given I write to "Berksfile" with:
|
327
317
|
"""
|
@@ -331,9 +321,9 @@ Feature: install cookbooks from a Berksfile
|
|
331
321
|
| -c /tmp/notthere.lol |
|
332
322
|
Then the output should contain:
|
333
323
|
"""
|
334
|
-
|
324
|
+
No Berkshelf config file found at: '/tmp/notthere.lol'!
|
335
325
|
"""
|
336
|
-
And the CLI should exit with the status code for error "
|
326
|
+
And the CLI should exit with the status code for error "ConfigNotFound"
|
337
327
|
|
338
328
|
Scenario: with a git error during download
|
339
329
|
Given I write to "Berksfile" with:
|
@@ -344,9 +334,10 @@ Feature: install cookbooks from a Berksfile
|
|
344
334
|
When I run `berks install`
|
345
335
|
Then the output should contain:
|
346
336
|
"""
|
347
|
-
|
348
|
-
|
349
|
-
|
337
|
+
An error occurred during Git execution:
|
338
|
+
|
339
|
+
fatal: remote error:
|
340
|
+
Repository not found.
|
350
341
|
"""
|
351
342
|
And the CLI should exit with the status code for error "GitError"
|
352
343
|
|
@@ -359,5 +350,5 @@ Feature: install cookbooks from a Berksfile
|
|
359
350
|
When I run `berks install`
|
360
351
|
Then the output should contain:
|
361
352
|
"""
|
362
|
-
Unknown site shortname
|
353
|
+
Unknown site shortname 'somethingabsurd' - supported shortnames are:
|
363
354
|
"""
|
@@ -0,0 +1,112 @@
|
|
1
|
+
Feature: Installing cookbooks with specific licenses
|
2
|
+
As a user
|
3
|
+
I want to ensure my company only uses cookbooks that fall in our legal realm
|
4
|
+
So that I can safely install and legally use community cookbooks
|
5
|
+
|
6
|
+
Scenario: With licenses defined
|
7
|
+
Given the cookbook store has the cookbooks:
|
8
|
+
| berkshelf-cookbook-fixture | 0.1.0 | mit |
|
9
|
+
And I write to "Berksfile" with:
|
10
|
+
"""
|
11
|
+
site :opscode
|
12
|
+
cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
|
13
|
+
"""
|
14
|
+
And I have a Berkshelf config file containing:
|
15
|
+
"""
|
16
|
+
{
|
17
|
+
"allowed_licenses": ["mit"]
|
18
|
+
}
|
19
|
+
"""
|
20
|
+
When I successfully run `berks install`
|
21
|
+
Then the output should not contain:
|
22
|
+
"""
|
23
|
+
is not in your list of allowed licenses
|
24
|
+
"""
|
25
|
+
And the exit status should be 0
|
26
|
+
|
27
|
+
Scenario: With a license that is not listed
|
28
|
+
Given the cookbook store has the cookbooks:
|
29
|
+
| berkshelf-cookbook-fixture | 0.1.0 | mit |
|
30
|
+
And I write to "Berksfile" with:
|
31
|
+
"""
|
32
|
+
site :opscode
|
33
|
+
cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
|
34
|
+
"""
|
35
|
+
And I have a Berkshelf config file containing:
|
36
|
+
"""
|
37
|
+
{
|
38
|
+
"allowed_licenses": ["apache2"]
|
39
|
+
}
|
40
|
+
"""
|
41
|
+
When I successfully run `berks install`
|
42
|
+
Then the output should contain:
|
43
|
+
"""
|
44
|
+
'mit' is not in your list of allowed licenses
|
45
|
+
"""
|
46
|
+
And the exit status should be 0
|
47
|
+
|
48
|
+
Scenario: With raise_license_exception defined
|
49
|
+
Given the cookbook store has the cookbooks:
|
50
|
+
| berkshelf-cookbook-fixture | 0.1.0 | mit |
|
51
|
+
And I write to "Berksfile" with:
|
52
|
+
"""
|
53
|
+
site :opscode
|
54
|
+
cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
|
55
|
+
"""
|
56
|
+
And I have a Berkshelf config file containing:
|
57
|
+
"""
|
58
|
+
{
|
59
|
+
"allowed_licenses": ["mit"],
|
60
|
+
"raise_license_exception": true
|
61
|
+
}
|
62
|
+
"""
|
63
|
+
When I successfully run `berks install`
|
64
|
+
Then the output should not contain:
|
65
|
+
"""
|
66
|
+
is not in your list of allowed licenses
|
67
|
+
"""
|
68
|
+
And the exit status should be 0
|
69
|
+
|
70
|
+
Scenario: With a license that is not listed
|
71
|
+
Given the cookbook store has the cookbooks:
|
72
|
+
| berkshelf-cookbook-fixture | 0.1.0 | mit |
|
73
|
+
And I write to "Berksfile" with:
|
74
|
+
"""
|
75
|
+
site :opscode
|
76
|
+
cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
|
77
|
+
"""
|
78
|
+
And I have a Berkshelf config file containing:
|
79
|
+
"""
|
80
|
+
{
|
81
|
+
"allowed_licenses": ["apache2"],
|
82
|
+
"raise_license_exception": true
|
83
|
+
}
|
84
|
+
"""
|
85
|
+
When I run `berks install`
|
86
|
+
Then the output should contain:
|
87
|
+
"""
|
88
|
+
'mit' is not in your list of allowed licenses
|
89
|
+
"""
|
90
|
+
And the CLI should exit with the status code for error "LicenseNotAllowed"
|
91
|
+
|
92
|
+
Scenario: With a :path location
|
93
|
+
Given the cookbook store has the cookbooks:
|
94
|
+
| fake | 0.1.0 | mit |
|
95
|
+
And I write to "Berksfile" with:
|
96
|
+
"""
|
97
|
+
site :opscode
|
98
|
+
cookbook 'fake', path: '../berkshelf/cookbooks/fake-0.1.0'
|
99
|
+
"""
|
100
|
+
And I have a Berkshelf config file containing:
|
101
|
+
"""
|
102
|
+
{
|
103
|
+
"allowed_licenses": ["apache2"],
|
104
|
+
"raise_license_exception": true
|
105
|
+
}
|
106
|
+
"""
|
107
|
+
When I run `berks install`
|
108
|
+
Then the output should not contain:
|
109
|
+
"""
|
110
|
+
'mit' is not in your list of allowed licenses
|
111
|
+
"""
|
112
|
+
And the exit status should be 0
|