berkshelf 1.4.6 → 2.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +1 -5
- data/CONTRIBUTING.md +3 -1
- data/Gemfile +11 -1
- data/README.md +16 -0
- data/Thorfile +3 -1
- data/berkshelf.gemspec +26 -38
- data/features/apply_command.feature +32 -0
- data/features/configure_command.feature +31 -0
- data/features/contingent_command.feature +5 -5
- data/features/default_locations.feature +2 -2
- data/features/groups_install.feature +19 -20
- data/features/info_command.feature +13 -13
- data/features/install_command.feature +86 -83
- data/features/json_formatter.feature +60 -23
- data/features/list_command.feature +5 -11
- data/features/lockfile.feature +286 -6
- data/features/open_command.feature +8 -4
- data/features/outdated_command.feature +8 -15
- data/features/package_command.feature +39 -0
- data/features/show_command.feature +8 -9
- data/features/step_definitions/chef_server_steps.rb +20 -2
- data/features/step_definitions/cli_steps.rb +10 -2
- data/features/step_definitions/configure_cli_steps.rb +7 -0
- data/features/step_definitions/filesystem_steps.rb +19 -14
- data/features/step_definitions/json_steps.rb +22 -5
- data/features/step_definitions/utility_steps.rb +13 -1
- data/features/support/env.rb +10 -23
- data/features/update_command.feature +105 -24
- data/features/upload_command.feature +0 -14
- data/features/vendor_install.feature +3 -3
- data/generator_files/Vagrantfile.erb +11 -11
- data/lib/berkshelf.rb +6 -5
- data/lib/berkshelf/berksfile.rb +267 -99
- data/lib/berkshelf/cli.rb +70 -34
- data/lib/berkshelf/cli_commands/test_command.rb +11 -0
- data/lib/berkshelf/community_rest.rb +1 -1
- data/lib/berkshelf/config.rb +19 -2
- data/lib/berkshelf/cookbook_source.rb +41 -12
- data/lib/berkshelf/cookbook_store.rb +8 -4
- data/lib/berkshelf/errors.rb +61 -29
- data/lib/berkshelf/formatters.rb +13 -19
- data/lib/berkshelf/formatters/human_readable.rb +8 -0
- data/lib/berkshelf/formatters/json.rb +12 -1
- data/lib/berkshelf/formatters/null.rb +23 -0
- data/lib/berkshelf/init_generator.rb +22 -11
- data/lib/berkshelf/location.rb +8 -10
- data/lib/berkshelf/locations/chef_api_location.rb +4 -5
- data/lib/berkshelf/locations/git_location.rb +14 -12
- data/lib/berkshelf/locations/path_location.rb +16 -1
- data/lib/berkshelf/locations/site_location.rb +1 -3
- data/lib/berkshelf/lockfile.rb +230 -33
- data/lib/berkshelf/resolver.rb +2 -1
- data/lib/berkshelf/ui.rb +4 -8
- data/lib/berkshelf/version.rb +1 -1
- data/lib/thor/monkies/shell.rb +2 -5
- data/spec/fixtures/cassettes/Berkshelf_Resolver/{ClassMethods/_initialize → _initialize}/adds_the_dependencies_of_the_source_as_sources.yml +0 -0
- data/spec/fixtures/cookbooks/example_cookbook/.gitignore +2 -0
- data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +26 -0
- data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +5 -0
- data/spec/fixtures/lockfiles/default.lock +11 -0
- data/spec/{config/knife.rb → knife.rb.sample} +2 -2
- data/spec/spec_helper.rb +15 -3
- data/spec/support/chef_api.rb +19 -5
- data/spec/support/chef_server.rb +4 -3
- data/spec/support/knife.rb +18 -0
- data/spec/unit/berkshelf/berksfile_spec.rb +332 -235
- data/spec/unit/berkshelf/cached_cookbook_spec.rb +40 -42
- data/spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb +11 -15
- data/spec/unit/berkshelf/community_rest_spec.rb +16 -14
- data/spec/unit/berkshelf/config_spec.rb +36 -20
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +6 -10
- data/spec/unit/berkshelf/cookbook_source_spec.rb +244 -183
- data/spec/unit/berkshelf/cookbook_store_spec.rb +72 -76
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +2 -2
- data/spec/unit/berkshelf/downloader_spec.rb +137 -157
- data/spec/unit/berkshelf/errors_spec.rb +1 -1
- data/spec/unit/berkshelf/formatters/null_spec.rb +17 -0
- data/spec/unit/berkshelf/formatters_spec.rb +83 -90
- data/spec/unit/berkshelf/git_spec.rb +219 -207
- data/spec/unit/berkshelf/init_generator_spec.rb +73 -73
- data/spec/unit/berkshelf/location_spec.rb +143 -162
- data/spec/unit/berkshelf/locations/chef_api_location_spec.rb +94 -89
- data/spec/unit/berkshelf/locations/git_location_spec.rb +75 -59
- data/spec/unit/berkshelf/locations/path_location_spec.rb +46 -30
- data/spec/unit/berkshelf/locations/site_location_spec.rb +4 -4
- data/spec/unit/berkshelf/lockfile_spec.rb +185 -1
- data/spec/unit/berkshelf/logger_spec.rb +6 -24
- data/spec/unit/berkshelf/mixin/logging_spec.rb +6 -8
- data/spec/unit/berkshelf/resolver_spec.rb +36 -38
- data/spec/unit/berkshelf/ui_spec.rb +9 -10
- data/spec/unit/berkshelf_spec.rb +41 -40
- data/spec/unit/chef/config_spec.rb +9 -11
- metadata +55 -203
- data/spec/config/berkshelf.pem +0 -27
- data/spec/config/validator.pem +0 -27
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
# 1.4.6
|
2
|
-
|
3
|
-
- Backport bug fixes from 2.0.2
|
4
|
-
|
5
1
|
# 1.4.4
|
6
2
|
|
7
3
|
- Bump Ridley dependency to 0.12, bringing in many bugfixes.
|
@@ -33,7 +29,7 @@
|
|
33
29
|
|
34
30
|
# 1.3.1
|
35
31
|
- Support for Vagrant 1.1.x
|
36
|
-
- Move Berkshelf Vagrant plugin into it's [own repository](https://github.com/RiotGames/vagrant
|
32
|
+
- Move Berkshelf Vagrant plugin into it's [own repository](https://github.com/RiotGames/berkshelf-vagrant)
|
37
33
|
- Added -d flag to output debug information in berks command
|
38
34
|
- Various bug fixes in uploading cookbooks
|
39
35
|
|
data/CONTRIBUTING.md
CHANGED
@@ -34,7 +34,9 @@ Bundler will install all gems and their dependencies required for testing and de
|
|
34
34
|
|
35
35
|
### Running unit (RSpec) and acceptance (Cucumber) tests
|
36
36
|
|
37
|
-
|
37
|
+
Simply copy the `spec/knife.rb.sample` to `spec/knife.rb`, and point it at a
|
38
|
+
chef server. Berkshelf tests may upload and destroy cookbooks on your chef
|
39
|
+
server, so be sure to configure a server safe for this task.
|
38
40
|
|
39
41
|
$ bundle exec guard start
|
40
42
|
|
data/Gemfile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
+
|
2
3
|
gemspec
|
3
4
|
|
4
5
|
group :development do
|
5
|
-
gem 'chef-zero', '
|
6
|
+
gem 'chef-zero', '>= 0.9.9'
|
6
7
|
gem 'coolline'
|
7
8
|
gem 'guard', '>= 1.5.0'
|
8
9
|
gem 'guard-cane'
|
@@ -33,3 +34,12 @@ group :development do
|
|
33
34
|
gem 'win32console', require: false
|
34
35
|
end
|
35
36
|
end
|
37
|
+
|
38
|
+
group :test do
|
39
|
+
gem 'fuubar'
|
40
|
+
gem 'json_spec'
|
41
|
+
gem 'rake', '>= 0.9.2.2'
|
42
|
+
gem 'rspec'
|
43
|
+
gem 'thor'
|
44
|
+
gem 'webmock'
|
45
|
+
end
|
data/README.md
CHANGED
@@ -41,6 +41,22 @@ Plugins
|
|
41
41
|
-------
|
42
42
|
Please see [Plugins page](https://github.com/RiotGames/berkshelf/blob/master/PLUGINS.md) for more information.
|
43
43
|
|
44
|
+
Configuration
|
45
|
+
-------------
|
46
|
+
Berkshelf will search in specific locations for a configuration file. In order:
|
47
|
+
|
48
|
+
```text
|
49
|
+
$PWD/.berkshelf/config.json
|
50
|
+
$PWD/berkshelf/config.json
|
51
|
+
$PWD/berkshelf-config.json
|
52
|
+
$PWD/config.json
|
53
|
+
~/.berkshelf/config.json
|
54
|
+
```
|
55
|
+
|
56
|
+
You are encouraged to keep project-specific configuration in the `$PWD/.berkshelf` directory. You can generate a project-configuration file by running:
|
57
|
+
|
58
|
+
$ berks configure --path ./.berkshelf/config.json
|
59
|
+
|
44
60
|
SSL Errors
|
45
61
|
----------
|
46
62
|
|
data/Thorfile
CHANGED
@@ -46,7 +46,9 @@ class Default < Thor
|
|
46
46
|
desc "ci", "Run all possible tests on Travis-CI"
|
47
47
|
def ci
|
48
48
|
ENV['CI'] = 'true' # Travis-CI also sets this, but set it here for local testing
|
49
|
-
|
49
|
+
unless run_unit("--tag ~chef_server") && run_acceptance("--tags ~@chef_server") && run_quality
|
50
|
+
exit 1
|
51
|
+
end
|
50
52
|
end
|
51
53
|
|
52
54
|
desc "unit", "Run unit tests"
|
data/berkshelf.gemspec
CHANGED
@@ -3,65 +3,53 @@ require File.expand_path('../lib/berkshelf/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.authors = [
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
"Jamie Winsor",
|
7
|
+
"Josiah Kiehl",
|
8
|
+
"Michael Ivey",
|
9
|
+
"Justin Campbell"
|
10
10
|
]
|
11
11
|
s.email = [
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
"reset@riotgames.com",
|
13
|
+
"jkiehl@riotgames.com",
|
14
|
+
"michael.ivey@riotgames.com",
|
15
|
+
"justin.campbell@riotgames.com"
|
16
16
|
]
|
17
17
|
|
18
18
|
s.description = %q{Manages a Cookbook's, or an Application's, Cookbook dependencies}
|
19
19
|
s.summary = s.description
|
20
|
-
s.homepage =
|
21
|
-
s.license =
|
20
|
+
s.homepage = "http://berkshelf.com"
|
21
|
+
s.license = "Apache 2.0"
|
22
22
|
s.files = `git ls-files`.split($\)
|
23
23
|
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
24
24
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
25
|
-
s.name =
|
26
|
-
s.require_paths = [
|
25
|
+
s.name = "berkshelf"
|
26
|
+
s.require_paths = ["lib"]
|
27
27
|
s.version = Berkshelf::VERSION
|
28
|
-
s.required_ruby_version =
|
29
|
-
s.required_rubygems_version =
|
28
|
+
s.required_ruby_version = ">= 1.9.1"
|
29
|
+
s.required_rubygems_version = ">= 1.8.0"
|
30
30
|
|
31
31
|
s.add_dependency 'celluloid', '>= 0.14.0'
|
32
|
-
s.add_dependency '
|
32
|
+
s.add_dependency 'test-kitchen', '>= 1.0.0.alpha6'
|
33
33
|
s.add_dependency 'activesupport', '>= 3.2.0'
|
34
34
|
s.add_dependency 'mixlib-shellout', '~> 1.1'
|
35
35
|
s.add_dependency 'mixlib-config', '~> 1.1'
|
36
36
|
s.add_dependency 'faraday', '>= 0.8.5'
|
37
|
-
s.add_dependency 'ridley', '~> 0.12.
|
37
|
+
s.add_dependency 'ridley', '~> 0.12.1'
|
38
38
|
s.add_dependency 'chozo', '>= 0.6.1'
|
39
39
|
s.add_dependency 'hashie', '>= 2.0.2'
|
40
40
|
s.add_dependency 'minitar'
|
41
|
-
s.add_dependency '
|
42
|
-
s.add_dependency 'multi_json', '~> 1.5'
|
43
|
-
s.add_dependency 'solve', '>= 0.4.2'
|
41
|
+
s.add_dependency 'solve', '>= 0.4.4'
|
44
42
|
s.add_dependency 'thor', '~> 0.18.0'
|
45
43
|
s.add_dependency 'retryable'
|
46
44
|
s.add_dependency 'addressable'
|
47
45
|
|
48
|
-
s.add_development_dependency 'aruba'
|
49
|
-
s.add_development_dependency 'cane'
|
50
|
-
s.add_development_dependency '
|
51
|
-
s.add_development_dependency '
|
52
|
-
s.add_development_dependency '
|
53
|
-
s.add_development_dependency '
|
54
|
-
s.add_development_dependency '
|
55
|
-
s.add_development_dependency '
|
56
|
-
s.add_development_dependency 'vcr',
|
57
|
-
s.add_development_dependency 'webmock', '~> 1.11'
|
58
|
-
s.add_development_dependency 'yard', '~> 0.8'
|
59
|
-
|
60
|
-
# Guard extensions for development
|
61
|
-
s.add_development_dependency 'guard', '~> 1.8'
|
62
|
-
s.add_development_dependency 'guard-cane'
|
63
|
-
s.add_development_dependency 'guard-cucumber'
|
64
|
-
s.add_development_dependency 'guard-rspec'
|
65
|
-
s.add_development_dependency 'guard-spork'
|
66
|
-
s.add_development_dependency 'guard-yard'
|
46
|
+
s.add_development_dependency 'aruba'
|
47
|
+
s.add_development_dependency 'cane'
|
48
|
+
s.add_development_dependency 'rake', '>= 0.9.2.2'
|
49
|
+
s.add_development_dependency 'rspec'
|
50
|
+
s.add_development_dependency 'simplecov'
|
51
|
+
s.add_development_dependency 'spork'
|
52
|
+
s.add_development_dependency 'thor'
|
53
|
+
s.add_development_dependency 'webmock'
|
54
|
+
s.add_development_dependency 'vcr', '~> 2.4.0'
|
67
55
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Feature: lock cookbook versions on the server
|
2
|
+
As a berks user
|
3
|
+
I want to push my berks resolved cookbook versions to my environment
|
4
|
+
So that I can avoid manual configuration of my environments
|
5
|
+
|
6
|
+
@chef_server
|
7
|
+
Scenario: locking cookbook versions
|
8
|
+
Given I have an environment named "berkshelf_lock_test"
|
9
|
+
And I write to "Berksfile" with:
|
10
|
+
"""
|
11
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
|
12
|
+
"""
|
13
|
+
When I successfully run the apply command on "berkshelf_lock_test"
|
14
|
+
Then the version locks in "berkshelf_lock_test" should be:
|
15
|
+
| cookbook | version_lock |
|
16
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
17
|
+
| hostsfile | 1.0.1 |
|
18
|
+
And the exit status should be 0
|
19
|
+
|
20
|
+
@chef_server
|
21
|
+
Scenario: locking cookbook versions to an environment that does not exist
|
22
|
+
Given I do not have an environment named "berkshelf_lock_test"
|
23
|
+
And I write to "Berksfile" with:
|
24
|
+
"""
|
25
|
+
cookbook 'berkshelf-cookbook-fixture'
|
26
|
+
"""
|
27
|
+
When I run the apply command on "berkshelf_lock_test"
|
28
|
+
Then the output should contain:
|
29
|
+
"""
|
30
|
+
The environment "berkshelf_lock_test" does not exist.
|
31
|
+
"""
|
32
|
+
And the CLI should exit with the status code for error "EnvironmentNotFound"
|
@@ -59,3 +59,34 @@ Feature: configure command
|
|
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
|
+
|
63
|
+
Scenario Outline: Generating a local Berkshelf config
|
64
|
+
Given I do not have a Berkshelf config file at "<path>"
|
65
|
+
When I run the "configure --path <path>" command interactively
|
66
|
+
And I type "https://api.opscode.com/organizations/vialstudios"
|
67
|
+
And I type "node_name"
|
68
|
+
And I type "client_key"
|
69
|
+
And I type "reset"
|
70
|
+
And I type "/Users/reset/.chef/reset.pem"
|
71
|
+
And I type "Berkshelf-minimal"
|
72
|
+
And I type "https://dl.dropbox.com/Berkshelf.box"
|
73
|
+
Then the output should contain:
|
74
|
+
"""
|
75
|
+
Config written to:
|
76
|
+
"""
|
77
|
+
And the exit status should be 0
|
78
|
+
And a Berkshelf config file should exist at "<path>" and contain:
|
79
|
+
| chef.chef_server_url | https://api.opscode.com/organizations/vialstudios |
|
80
|
+
| chef.validation_client_name | reset |
|
81
|
+
| chef.node_name | node_name |
|
82
|
+
| chef.client_key | client_key |
|
83
|
+
| chef.validation_key_path | /Users/reset/.chef/reset.pem |
|
84
|
+
| vagrant.vm.box | Berkshelf-minimal |
|
85
|
+
| vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
|
86
|
+
|
87
|
+
Examples:
|
88
|
+
| path |
|
89
|
+
| .berkshelf/config.json |
|
90
|
+
| berkshelf/config.json |
|
91
|
+
| berkshelf-config.json |
|
92
|
+
| config.json |
|
@@ -3,16 +3,16 @@ Feature: contingent command
|
|
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
|
+
@slow_process
|
6
7
|
Scenario: Running the contingent command against a cookbook
|
7
8
|
Given I write to "Berksfile" with:
|
8
9
|
"""
|
9
|
-
cookbook
|
10
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
|
10
11
|
"""
|
11
|
-
And I successfully run `berks
|
12
|
-
When I run `berks contingent mysql`
|
12
|
+
And I successfully run `berks contingent hostsfile`
|
13
13
|
Then the output should contain:
|
14
14
|
"""
|
15
|
-
Cookbooks contingent upon
|
16
|
-
*
|
15
|
+
Cookbooks contingent upon hostsfile:
|
16
|
+
* berkshelf-cookbook-fixture (1.0.0)
|
17
17
|
"""
|
18
18
|
And the exit status should be 0
|
@@ -24,11 +24,11 @@ Feature: Berksfile default locations
|
|
24
24
|
| berkshelf-cookbook-fixture | 1.0.0 |
|
25
25
|
And the exit status should be 0
|
26
26
|
|
27
|
-
@chef_server
|
27
|
+
@chef_server
|
28
28
|
Scenario: with a default chef_api(1) and site(2) location with a cookbook source that is not satisfied by the chef_api(1) location
|
29
29
|
Given I write to "Berksfile" with:
|
30
30
|
"""
|
31
|
-
|
31
|
+
chef_api :config
|
32
32
|
site :opscode
|
33
33
|
|
34
34
|
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
@@ -7,59 +7,58 @@ Feature: installing groups
|
|
7
7
|
Given I write to "Berksfile" with:
|
8
8
|
"""
|
9
9
|
group :notme do
|
10
|
-
cookbook
|
10
|
+
cookbook 'nginx', '= 0.101.2'
|
11
11
|
end
|
12
12
|
|
13
|
-
cookbook
|
13
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
14
14
|
|
15
15
|
group :takeme do
|
16
|
-
cookbook
|
16
|
+
cookbook 'hostsfile', '1.0.1'
|
17
17
|
end
|
18
18
|
"""
|
19
|
-
When I run
|
20
|
-
| --except notme |
|
19
|
+
When I successfully run `berks install --except notme`
|
21
20
|
Then the cookbook store should have the cookbooks:
|
22
|
-
|
|
23
|
-
|
|
21
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
22
|
+
| hostsfile | 1.0.1 |
|
24
23
|
And the cookbook store should not have the cookbooks:
|
25
24
|
| nginx | 0.101.2 |
|
25
|
+
And the exit status should be 0
|
26
26
|
|
27
27
|
Scenario: only groups
|
28
28
|
Given I write to "Berksfile" with:
|
29
29
|
"""
|
30
30
|
group :notme do
|
31
|
-
cookbook
|
31
|
+
cookbook 'nginx', '= 0.101.2'
|
32
32
|
end
|
33
33
|
|
34
|
-
cookbook
|
34
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
35
35
|
|
36
36
|
group :takeme do
|
37
|
-
cookbook
|
37
|
+
cookbook 'hostsfile', '1.0.1'
|
38
38
|
end
|
39
39
|
"""
|
40
|
-
When I run
|
41
|
-
| --only takeme |
|
40
|
+
When I successfully run `berks install --only takeme`
|
42
41
|
Then the cookbook store should have the cookbooks:
|
43
|
-
|
|
42
|
+
| hostsfile | 1.0.1 |
|
44
43
|
And the cookbook store should not have the cookbooks:
|
45
|
-
| nginx
|
46
|
-
|
|
44
|
+
| nginx | 0.101.2 |
|
45
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
46
|
+
And the exit status should be 0
|
47
47
|
|
48
48
|
Scenario: attempting to provide an only and except option
|
49
49
|
Given I write to "Berksfile" with:
|
50
50
|
"""
|
51
51
|
group :notme do
|
52
|
-
cookbook
|
52
|
+
cookbook 'nginx', '= 0.101.2'
|
53
53
|
end
|
54
54
|
|
55
|
-
cookbook
|
55
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
56
56
|
|
57
57
|
group :takeme do
|
58
|
-
cookbook
|
58
|
+
cookbook 'hostsfile', '1.0.1'
|
59
59
|
end
|
60
60
|
"""
|
61
|
-
When I run
|
62
|
-
| --only takeme --except notme |
|
61
|
+
When I run `berks install --only takeme --except notme`
|
63
62
|
Then the output should contain:
|
64
63
|
"""
|
65
64
|
Cannot specify both :except and :only
|
@@ -5,12 +5,12 @@ Feature: info command
|
|
5
5
|
|
6
6
|
Scenario: Running the info command with an installed cookbook name
|
7
7
|
Given the cookbook store has the cookbooks:
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
When I successfully run `berks info
|
12
|
-
Then the output should contain "Name:
|
13
|
-
Then the output should contain "Version:
|
8
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
9
|
+
| berkshelf-cookbook-fixture | 0.2.0 |
|
10
|
+
| berkshelf-cookbook-fixture | 0.1.0 |
|
11
|
+
When I successfully run `berks info berkshelf-cookbook-fixture`
|
12
|
+
Then the output should contain "Name: berkshelf-cookbook-fixture"
|
13
|
+
Then the output should contain "Version: 1.0.0"
|
14
14
|
Then the output should contain "Description: A fabulous new cookbook"
|
15
15
|
Then the output should contain "Author: YOUR_COMPANY_NAME"
|
16
16
|
Then the output should contain "Email: YOUR_EMAIL"
|
@@ -19,12 +19,12 @@ Feature: info command
|
|
19
19
|
|
20
20
|
Scenario: Running the info command with an installed cookbook name and a version
|
21
21
|
Given the cookbook store has the cookbooks:
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
When I successfully run `berks info
|
26
|
-
Then the output should contain "Name:
|
27
|
-
Then the output should contain "Version:
|
22
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
23
|
+
| berkshelf-cookbook-fixture | 0.2.0 |
|
24
|
+
| berkshelf-cookbook-fixture | 0.1.0 |
|
25
|
+
When I successfully run `berks info berkshelf-cookbook-fixture --version 0.2.0`
|
26
|
+
Then the output should contain "Name: berkshelf-cookbook-fixture"
|
27
|
+
Then the output should contain "Version: 0.2.0"
|
28
28
|
Then the output should contain "Description: A fabulous new cookbook"
|
29
29
|
Then the output should contain "Author: YOUR_COMPANY_NAME"
|
30
30
|
Then the output should contain "Email: YOUR_EMAIL"
|
@@ -33,7 +33,7 @@ Feature: info command
|
|
33
33
|
|
34
34
|
Scenario: Running the info command with a not installed cookbook name
|
35
35
|
Given the cookbook store has the cookbooks:
|
36
|
-
|
|
36
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
37
37
|
When I run `berks info build-essential`
|
38
38
|
Then the output should contain "Cookbook 'build-essential' was not installed by your Berksfile"
|
39
39
|
And the CLI should exit with the status code for error "CookbookNotFound"
|
@@ -3,73 +3,88 @@ 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
|
+
|
6
30
|
Scenario: installing a Berksfile that contains a source with a default location
|
7
31
|
Given I write to "Berksfile" with:
|
8
32
|
"""
|
9
|
-
cookbook
|
10
|
-
cookbook "openssl", "1.0.0"
|
33
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
11
34
|
"""
|
12
35
|
When I successfully run `berks install`
|
13
36
|
Then the cookbook store should have the cookbooks:
|
14
|
-
|
|
15
|
-
| openssl | 1.0.0 |
|
37
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
16
38
|
And the output should contain:
|
17
39
|
"""
|
18
|
-
Installing
|
19
|
-
Installing openssl (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
40
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
20
41
|
"""
|
21
42
|
And the exit status should be 0
|
22
43
|
|
23
44
|
Scenario: installing a Berksfile that contains the cookbook explicitly desired by a source
|
24
45
|
Given the cookbook store has the cookbooks:
|
25
|
-
|
|
46
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
26
47
|
And I write to "Berksfile" with:
|
27
48
|
"""
|
28
|
-
cookbook
|
49
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
29
50
|
"""
|
30
51
|
When I successfully run `berks install`
|
31
52
|
Then the output should contain:
|
32
53
|
"""
|
33
|
-
Using
|
54
|
+
Using berkshelf-cookbook-fixture (1.0.0)
|
34
55
|
"""
|
35
56
|
And the exit status should be 0
|
36
57
|
|
37
58
|
Scenario: installing a Berksfile that has multiple cookbooks in different groups
|
38
59
|
Given the cookbook store has the cookbooks:
|
39
|
-
|
|
60
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
40
61
|
And I write to "Berksfile" with:
|
41
62
|
"""
|
42
63
|
group :a do
|
43
|
-
cookbook
|
64
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
44
65
|
end
|
45
66
|
|
46
67
|
group :b do
|
47
|
-
cookbook
|
68
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
48
69
|
end
|
49
70
|
"""
|
50
71
|
When I successfully run `berks install`
|
51
|
-
Then the output should contain "Using
|
72
|
+
Then the output should contain "Using berkshelf-cookbook-fixture (1.0.0)"
|
52
73
|
And the exit status should be 0
|
53
74
|
|
54
75
|
Scenario: installing a Berksfile that contains a source with dependencies, all of which already have been installed
|
55
|
-
Given the cookbook store contains a cookbook "
|
56
|
-
|
|
57
|
-
| windows | = 1.3.0 |
|
58
|
-
| chef_handler | = 1.0.6 |
|
76
|
+
Given the cookbook store contains a cookbook "berkshelf-cookbook-fixture" "1.0.0" with dependencies:
|
77
|
+
| hostsfile | = 1.0.1 |
|
59
78
|
And the cookbook store has the cookbooks:
|
60
|
-
|
|
61
|
-
| windows | 1.3.0 |
|
79
|
+
| hostsfile | 1.0.1 |
|
62
80
|
And I write to "Berksfile" with:
|
63
81
|
"""
|
64
|
-
cookbook
|
82
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
|
65
83
|
"""
|
66
84
|
When I successfully run `berks install`
|
67
85
|
Then the output should contain:
|
68
86
|
"""
|
69
|
-
Using
|
70
|
-
Using openssl (1.0.0)
|
71
|
-
Using windows (1.3.0)
|
72
|
-
Installing chef_handler (1.0.6) from site:
|
87
|
+
Using hostsfile (1.0.1)
|
73
88
|
"""
|
74
89
|
And the exit status should be 0
|
75
90
|
|
@@ -86,84 +101,83 @@ Feature: install cookbooks from a Berksfile
|
|
86
101
|
Scenario: installing a Berksfile that contains a Git location
|
87
102
|
Given I write to "Berksfile" with:
|
88
103
|
"""
|
89
|
-
cookbook "
|
104
|
+
cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git"
|
90
105
|
"""
|
91
106
|
When I successfully run `berks install`
|
92
107
|
Then the cookbook store should have the git cookbooks:
|
93
|
-
|
|
108
|
+
| berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
|
94
109
|
And the output should contain:
|
95
110
|
"""
|
96
|
-
Installing
|
111
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
|
97
112
|
"""
|
98
113
|
And the exit status should be 0
|
99
114
|
|
100
|
-
Scenario: installing a Berksfile that contains a Git location with a
|
115
|
+
Scenario: installing a Berksfile that contains a Git location with a tag
|
101
116
|
Given I write to "Berksfile" with:
|
102
117
|
"""
|
103
|
-
cookbook "
|
118
|
+
cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
|
104
119
|
"""
|
105
120
|
When I successfully run `berks install`
|
106
121
|
Then the cookbook store should have the git cookbooks:
|
107
|
-
|
|
122
|
+
| berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
|
108
123
|
And the output should contain:
|
109
124
|
"""
|
110
|
-
Installing
|
125
|
+
Installing berkshelf-cookbook-fixture (0.2.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v0.2.0'
|
111
126
|
"""
|
112
127
|
And the exit status should be 0
|
113
128
|
|
114
129
|
Scenario: installing a Berksfile that contains a GitHub location
|
115
130
|
Given I write to "Berksfile" with:
|
116
131
|
"""
|
117
|
-
cookbook "
|
132
|
+
cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
|
118
133
|
"""
|
119
134
|
When I successfully run `berks install`
|
120
135
|
Then the cookbook store should have the git cookbooks:
|
121
|
-
|
|
136
|
+
| berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
|
122
137
|
And the output should contain:
|
123
138
|
"""
|
124
|
-
Installing
|
139
|
+
Installing berkshelf-cookbook-fixture (0.2.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0'
|
125
140
|
"""
|
126
141
|
And the exit status should be 0
|
127
142
|
|
128
143
|
Scenario: installing a Berksfile that contains a Github location and the default protocol
|
129
144
|
Given I write to "Berksfile" with:
|
130
145
|
"""
|
131
|
-
cookbook "
|
146
|
+
cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
|
132
147
|
"""
|
133
148
|
When I successfully run `berks install`
|
134
149
|
Then the cookbook store should have the git cookbooks:
|
135
|
-
|
|
150
|
+
| berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
|
136
151
|
And the output should contain:
|
137
152
|
"""
|
138
|
-
Installing
|
153
|
+
Installing berkshelf-cookbook-fixture (0.2.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0' over protocol: 'git'
|
139
154
|
"""
|
140
155
|
And the exit status should be 0
|
141
156
|
|
142
157
|
Scenario Outline: installing a Berksfile that contains a Github location and specific protocol
|
143
158
|
Given I write to "Berksfile" with:
|
144
159
|
"""
|
145
|
-
cookbook "
|
160
|
+
cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v1.0.0", protocol: "<protocol>"
|
146
161
|
"""
|
147
162
|
When I successfully run `berks install`
|
148
163
|
Then the cookbook store should have the git cookbooks:
|
149
|
-
|
|
164
|
+
| berkshelf-cookbook-fixture | 1.0.0 | b4f968c9001ad8de30f564a2107fab9cfa91f771 |
|
150
165
|
And the output should contain:
|
151
166
|
"""
|
152
|
-
Installing
|
167
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v1.0.0' over protocol: '<protocol>'
|
153
168
|
"""
|
154
169
|
And the exit status should be 0
|
155
170
|
|
156
171
|
Examples:
|
157
172
|
| protocol |
|
158
|
-
# GitHub over ssh requires push authorization. Nonpushers will
|
159
|
-
|
160
|
-
# | ssh |
|
173
|
+
# | ssh | # GitHub over ssh requires push authorization. Nonpushers will get a test failure here.
|
174
|
+
| git |
|
161
175
|
| https |
|
162
176
|
|
163
177
|
Scenario: installing a Berksfile that contains a Github location and an unsupported protocol
|
164
178
|
Given I write to "Berksfile" with:
|
165
179
|
"""
|
166
|
-
cookbook "
|
180
|
+
cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "somethingabsurd"
|
167
181
|
"""
|
168
182
|
When I run `berks install`
|
169
183
|
Then the output should contain:
|
@@ -175,17 +189,14 @@ Feature: install cookbooks from a Berksfile
|
|
175
189
|
Scenario: installing a Berksfile that contains an explicit site location
|
176
190
|
Given I write to "Berksfile" with:
|
177
191
|
"""
|
178
|
-
cookbook
|
179
|
-
cookbook "openssl", "1.0.0", site: "http://cookbooks.opscode.com/api/v1/cookbooks"
|
192
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
180
193
|
"""
|
181
194
|
When I successfully run `berks install`
|
182
195
|
Then the cookbook store should have the cookbooks:
|
183
|
-
|
|
184
|
-
| openssl | 1.0.0 |
|
196
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
185
197
|
And the output should contain:
|
186
198
|
"""
|
187
|
-
Installing
|
188
|
-
Installing openssl (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
199
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
189
200
|
"""
|
190
201
|
And the exit status should be 0
|
191
202
|
|
@@ -216,7 +227,7 @@ Feature: install cookbooks from a Berksfile
|
|
216
227
|
Scenario: running install when the Cookbook is not found on the remote site
|
217
228
|
Given I write to "Berksfile" with:
|
218
229
|
"""
|
219
|
-
cookbook
|
230
|
+
cookbook 'doesntexist'
|
220
231
|
"""
|
221
232
|
And I run `berks install`
|
222
233
|
Then the output should contain:
|
@@ -228,7 +239,7 @@ Feature: install cookbooks from a Berksfile
|
|
228
239
|
Scenario: installing a Berksfile that has a Git location source with an invalid Git URI
|
229
240
|
Given I write to "Berksfile" with:
|
230
241
|
"""
|
231
|
-
cookbook
|
242
|
+
cookbook 'nginx', git: '/something/on/disk'
|
232
243
|
"""
|
233
244
|
When I run `berks install`
|
234
245
|
Then the output should contain:
|
@@ -240,46 +251,52 @@ Feature: install cookbooks from a Berksfile
|
|
240
251
|
Scenario: installing when there are sources with duplicate names defined in the same group
|
241
252
|
Given I write to "Berksfile" with:
|
242
253
|
"""
|
243
|
-
cookbook
|
244
|
-
cookbook
|
254
|
+
cookbook 'berkshelf-cookbook-fixture'
|
255
|
+
cookbook 'berkshelf-cookbook-fixture'
|
245
256
|
"""
|
246
257
|
When I run `berks install`
|
247
258
|
Then the output should contain:
|
248
259
|
"""
|
249
|
-
Berksfile contains multiple sources named '
|
260
|
+
Berksfile contains multiple sources named 'berkshelf-cookbook-fixture'. Use only one, or put them in different groups.
|
250
261
|
"""
|
251
262
|
And the CLI should exit with the status code for error "DuplicateSourceDefined"
|
252
263
|
|
253
264
|
Scenario: installing when a git source defines a branch that does not satisfy the version constraint
|
254
265
|
Given I write to "Berksfile" with:
|
255
266
|
"""
|
256
|
-
cookbook "
|
267
|
+
cookbook "berkshelf-cookbook-fixture", "= 1.0.0", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
|
257
268
|
"""
|
258
269
|
When I run `berks install`
|
259
|
-
Then the output should
|
270
|
+
Then the output should match multiline:
|
260
271
|
"""
|
261
|
-
|
272
|
+
The cookbook downloaded from git: 'git://github\.com/RiotGames/berkshelf-cookbook-fixture\.git' with branch: 'v0\.2\.0' at ref: '.+':
|
273
|
+
berkshelf-cookbook-fixture \(.+\)
|
274
|
+
|
275
|
+
does not satisfy the version constraint:
|
276
|
+
berkshelf-cookbook-fixture \(= 1.0.0\)
|
277
|
+
|
278
|
+
This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb`\.
|
262
279
|
"""
|
263
280
|
And the CLI should exit with the status code for error "CookbookValidationFailure"
|
264
281
|
|
265
282
|
Scenario: when a git location source is defined and a cookbook of the same name is already cached in the cookbook store
|
266
283
|
Given I write to "Berksfile" with:
|
267
284
|
"""
|
268
|
-
cookbook "
|
285
|
+
cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v1.0.0"
|
269
286
|
"""
|
270
287
|
And the cookbook store has the cookbooks:
|
271
|
-
|
|
288
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
272
289
|
When I successfully run `berks install`
|
273
290
|
Then the output should contain:
|
274
291
|
"""
|
275
|
-
Installing
|
292
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v1.0.0' at ref:
|
276
293
|
"""
|
277
294
|
And the exit status should be 0
|
278
295
|
|
279
296
|
Scenario: with a cookbook definition containing an invalid option
|
280
297
|
Given I write to "Berksfile" with:
|
281
298
|
"""
|
282
|
-
cookbook "
|
299
|
+
cookbook "berkshelf-cookbook-fixture", whatisthis: "I don't even know", anotherwat: "isthat"
|
283
300
|
"""
|
284
301
|
When I run `berks install`
|
285
302
|
Then the output should contain:
|
@@ -292,28 +309,14 @@ Feature: install cookbooks from a Berksfile
|
|
292
309
|
Scenario: with a cookbook definition containing a chef_api source location
|
293
310
|
Given I write to "Berksfile" with:
|
294
311
|
"""
|
295
|
-
cookbook
|
312
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0', chef_api: :config
|
296
313
|
"""
|
297
314
|
And the Chef server has cookbooks:
|
298
|
-
|
|
299
|
-
When I successfully run `berks install`
|
300
|
-
Then the output should contain:
|
301
|
-
"""
|
302
|
-
Installing cuke-test (1.0.0) from chef_api:
|
303
|
-
"""
|
304
|
-
And the cookbook store should have the cookbooks:
|
305
|
-
| cuke-test | 1.0.0 |
|
306
|
-
And the exit status should be 0
|
307
|
-
|
308
|
-
Scenario: when the :site is not defined
|
309
|
-
Given I write to "Berksfile" with:
|
310
|
-
"""
|
311
|
-
cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: nil
|
312
|
-
"""
|
315
|
+
| berkshelf-cookbook-fixture | 1.0.0 |
|
313
316
|
When I successfully run `berks install`
|
314
317
|
Then the output should contain:
|
315
318
|
"""
|
316
|
-
Installing berkshelf-cookbook-fixture (1.0.0) from
|
319
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from chef_api:
|
317
320
|
"""
|
318
321
|
And the cookbook store should have the cookbooks:
|
319
322
|
| berkshelf-cookbook-fixture | 1.0.0 |
|
@@ -322,7 +325,7 @@ Feature: install cookbooks from a Berksfile
|
|
322
325
|
Scenario: with a chef_api source location specifying :config when a Berkshelf config is not found at the given path
|
323
326
|
Given I write to "Berksfile" with:
|
324
327
|
"""
|
325
|
-
cookbook
|
328
|
+
cookbook 'berkshelf-cookbook-fixture', chef_api: :config
|
326
329
|
"""
|
327
330
|
When I run the install command with flags:
|
328
331
|
| -c /tmp/notthere.lol |
|
@@ -335,13 +338,13 @@ Feature: install cookbooks from a Berksfile
|
|
335
338
|
Scenario: with a git error during download
|
336
339
|
Given I write to "Berksfile" with:
|
337
340
|
"""
|
338
|
-
cookbook
|
341
|
+
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
|
339
342
|
cookbook "doesntexist", git: "git://github.com/asdjhfkljashflkjashfakljsf"
|
340
343
|
"""
|
341
344
|
When I run `berks install`
|
342
345
|
Then the output should contain:
|
343
346
|
"""
|
344
|
-
Installing
|
347
|
+
Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
345
348
|
Failed to download 'doesntexist' from git: 'git://github.com/asdjhfkljashflkjashfakljsf' with branch: 'master'
|
346
349
|
An error occured during Git execution:
|
347
350
|
"""
|
@@ -351,7 +354,7 @@ Feature: install cookbooks from a Berksfile
|
|
351
354
|
Given I write to "Berksfile" with:
|
352
355
|
"""
|
353
356
|
site :somethingabsurd
|
354
|
-
cookbook
|
357
|
+
cookbook 'berkshelf-cookbook-fixture'
|
355
358
|
"""
|
356
359
|
When I run `berks install`
|
357
360
|
Then the output should contain:
|