berkshelf 2.0.18 → 3.0.0.beta1

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.
Files changed (128) hide show
  1. data/.ruby-version +1 -1
  2. data/.travis.yml +4 -1
  3. data/CHANGELOG.md +2 -26
  4. data/Gemfile +12 -2
  5. data/README.md +9 -1
  6. data/berkshelf.gemspec +9 -18
  7. data/bin/berks +3 -13
  8. data/features/apply_command.feature +11 -9
  9. data/features/berksfile.feature +8 -10
  10. data/features/config.feature +1 -2
  11. data/features/configure_command.feature +13 -14
  12. data/features/contingent_command.feature +13 -1
  13. data/features/cookbook_command.feature +2 -4
  14. data/features/groups_install.feature +10 -2
  15. data/features/help.feature +1 -1
  16. data/features/init_command.feature +5 -7
  17. data/features/install_command.feature +157 -228
  18. data/features/json_formatter.feature +27 -15
  19. data/features/licenses.feature +18 -12
  20. data/features/list_command.feature +6 -1
  21. data/features/lockfile.feature +116 -72
  22. data/features/outdated_command.feature +3 -47
  23. data/features/package_command.feature +10 -7
  24. data/features/shelf/show.feature +2 -2
  25. data/features/shelf/uninstall.feature +2 -2
  26. data/features/show_command.feature +10 -3
  27. data/features/step_definitions/chef/config_steps.rb +12 -0
  28. data/features/step_definitions/chef_server_steps.rb +16 -16
  29. data/features/step_definitions/cli_steps.rb +3 -79
  30. data/features/step_definitions/config_steps.rb +43 -0
  31. data/features/step_definitions/environment_steps.rb +7 -0
  32. data/features/step_definitions/filesystem_steps.rb +12 -57
  33. data/features/step_definitions/gem_steps.rb +1 -2
  34. data/features/step_definitions/json_steps.rb +3 -1
  35. data/features/step_definitions/lockfile_steps.rb +4 -0
  36. data/features/step_definitions/utility_steps.rb +0 -19
  37. data/features/support/aruba.rb +12 -0
  38. data/features/support/env.rb +52 -57
  39. data/features/update_command.feature +37 -23
  40. data/features/upload_command.feature +96 -160
  41. data/generator_files/Berksfile.erb +2 -1
  42. data/generator_files/Vagrantfile.erb +3 -0
  43. data/generator_files/default_test.rb.erb +1 -1
  44. data/generator_files/helpers.rb.erb +1 -1
  45. data/lib/berkshelf.rb +43 -24
  46. data/lib/berkshelf/api_client.rb +67 -0
  47. data/lib/berkshelf/api_client/remote_cookbook.rb +42 -0
  48. data/lib/berkshelf/berksfile.rb +232 -420
  49. data/lib/berkshelf/cached_cookbook.rb +22 -10
  50. data/lib/berkshelf/chef/config.rb +1 -0
  51. data/lib/berkshelf/cli.rb +66 -68
  52. data/lib/berkshelf/commands/shelf.rb +1 -1
  53. data/lib/berkshelf/community_rest.rb +10 -17
  54. data/lib/berkshelf/config.rb +23 -27
  55. data/lib/berkshelf/cookbook_generator.rb +3 -4
  56. data/lib/berkshelf/cookbook_store.rb +74 -17
  57. data/lib/berkshelf/core_ext/file.rb +2 -2
  58. data/lib/berkshelf/core_ext/pathname.rb +7 -5
  59. data/lib/berkshelf/{cookbook_source.rb → dependency.rb} +47 -67
  60. data/lib/berkshelf/downloader.rb +49 -106
  61. data/lib/berkshelf/errors.rb +64 -71
  62. data/lib/berkshelf/formatters.rb +11 -9
  63. data/lib/berkshelf/formatters/human_readable.rb +9 -9
  64. data/lib/berkshelf/formatters/json.rb +14 -4
  65. data/lib/berkshelf/init_generator.rb +3 -3
  66. data/lib/berkshelf/installer.rb +136 -0
  67. data/lib/berkshelf/location.rb +91 -131
  68. data/lib/berkshelf/locations/git_location.rb +9 -11
  69. data/lib/berkshelf/locations/github_location.rb +1 -1
  70. data/lib/berkshelf/locations/path_location.rb +10 -27
  71. data/lib/berkshelf/lockfile.rb +92 -70
  72. data/lib/berkshelf/logger.rb +4 -7
  73. data/lib/berkshelf/mixin/config.rb +21 -4
  74. data/lib/berkshelf/resolver.rb +60 -150
  75. data/lib/berkshelf/resolver/graph.rb +44 -0
  76. data/lib/berkshelf/source.rb +55 -0
  77. data/lib/berkshelf/source_uri.rb +38 -0
  78. data/lib/berkshelf/version.rb +1 -1
  79. data/spec/config/knife.rb +1 -1
  80. data/spec/fixtures/cassettes/Berkshelf_Resolver/_initialize/adds_the_dependencies_of_the_dependency_as_dependencies.yml +3694 -0
  81. data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +1 -1
  82. data/spec/fixtures/lockfiles/default.lock +1 -1
  83. data/spec/spec_helper.rb +20 -121
  84. data/spec/support/chef_api.rb +3 -4
  85. data/spec/support/chef_server.rb +20 -11
  86. data/spec/support/git.rb +127 -0
  87. data/spec/support/kitchen.rb +12 -0
  88. data/spec/support/path_helpers.rb +69 -0
  89. data/spec/unit/berkshelf/api_client/remote_cookbook_spec.rb +23 -0
  90. data/spec/unit/berkshelf/api_client_spec.rb +57 -0
  91. data/spec/unit/berkshelf/berksfile_spec.rb +206 -324
  92. data/spec/unit/berkshelf/cached_cookbook_spec.rb +73 -38
  93. data/spec/unit/berkshelf/community_rest_spec.rb +30 -71
  94. data/spec/unit/berkshelf/config_spec.rb +3 -14
  95. data/spec/unit/berkshelf/cookbook_generator_spec.rb +1 -2
  96. data/spec/unit/berkshelf/cookbook_store_spec.rb +12 -7
  97. data/spec/unit/berkshelf/dependency_spec.rb +285 -0
  98. data/spec/unit/berkshelf/downloader_spec.rb +4 -183
  99. data/spec/unit/berkshelf/formatters/null_spec.rb +1 -1
  100. data/spec/unit/berkshelf/formatters_spec.rb +4 -2
  101. data/spec/unit/berkshelf/git_spec.rb +15 -15
  102. data/spec/unit/berkshelf/installer_spec.rb +39 -0
  103. data/spec/unit/berkshelf/location_spec.rb +87 -114
  104. data/spec/unit/berkshelf/locations/git_location_spec.rb +41 -53
  105. data/spec/unit/berkshelf/locations/path_location_spec.rb +13 -23
  106. data/spec/unit/berkshelf/lockfile_spec.rb +38 -40
  107. data/spec/unit/berkshelf/resolver/graph_spec.rb +44 -0
  108. data/spec/unit/berkshelf/resolver_spec.rb +34 -83
  109. data/spec/unit/berkshelf/source_spec.rb +23 -0
  110. data/spec/unit/berkshelf/source_uri_spec.rb +29 -0
  111. metadata +149 -188
  112. checksums.yaml +0 -7
  113. data/features/default_locations.feature +0 -127
  114. data/features/step_definitions/berksfile_steps.rb +0 -8
  115. data/features/step_definitions/configure_cli_steps.rb +0 -19
  116. data/features/vendor_install.feature +0 -19
  117. data/lib/berkshelf/core_ext/openuri.rb +0 -36
  118. data/lib/berkshelf/core_ext/rbzip2.rb +0 -8
  119. data/lib/berkshelf/locations/chef_api_location.rb +0 -228
  120. data/lib/berkshelf/locations/site_location.rb +0 -92
  121. data/lib/berkshelf/test.rb +0 -35
  122. data/spec/knife.rb.sample +0 -12
  123. data/spec/support/test_generators.rb +0 -27
  124. data/spec/unit/berkshelf/cli_spec.rb +0 -16
  125. data/spec/unit/berkshelf/cookbook_source_spec.rb +0 -358
  126. data/spec/unit/berkshelf/core_ext/pathname_spec.rb +0 -46
  127. data/spec/unit/berkshelf/locations/chef_api_location_spec.rb +0 -139
  128. data/spec/unit/berkshelf/locations/site_location_spec.rb +0 -19
@@ -17,4 +17,4 @@ Feature: Appending -h or --help to a command
17
17
 
18
18
  Scenario: Specifying the -h option to a sub-command
19
19
  Given I successfully run `berks cookbook -h`
20
- Then the output should be the same as `berks help cookbook`
20
+ Then the output should be the same as `berks help cookbook`
@@ -5,7 +5,7 @@ Feature: initialize command
5
5
 
6
6
  Scenario: initializing a path containing a cookbook
7
7
  Given a cookbook named "sparkle_motion"
8
- When I run the init command with the cookbook "sparkle_motion" as the target
8
+ When I successfully run `berks init sparkle_motion`
9
9
  Then the cookbook "sparkle_motion" should have the following files:
10
10
  | Berksfile |
11
11
  | chefignore |
@@ -18,7 +18,7 @@ Feature: initialize command
18
18
 
19
19
  Scenario: initializing a path that does not contain a cookbook
20
20
  Given a directory named "not_a_cookbook"
21
- When I run the init command with the directory "not_a_cookbook" as the target
21
+ When I successfully run `berks init not_a_cookbook`
22
22
  Then the directory "not_a_cookbook" should have the following files:
23
23
  | Berksfile |
24
24
  And the directory "not_a_cookbook" should not have the following files:
@@ -31,10 +31,8 @@ Feature: initialize command
31
31
  And the exit status should be 0
32
32
 
33
33
  Scenario: initializing with no value given for target
34
- When I run the init command with no value for the target
34
+ When I successfully run `berks init`
35
35
  Then the output should contain "Successfully initialized"
36
- And the current directory should have the following files:
37
- | Berksfile |
38
- And the current directory should not have the following files:
39
- | chefignore |
36
+ And a file named "Berksfile" should exist
37
+ And a file named "chefignore" should not exist
40
38
  And the exit status should be 0
@@ -1,211 +1,233 @@
1
1
  Feature: install cookbooks from a Berksfile
2
2
  As a user with a Berksfile
3
- I want to be able to run knife berkshelf install to install my cookbooks
4
- So that I don't have to download my cookbooks and their dependencies manually
3
+ I want a command to install the cookbooks defined in my Berksfile and their recursive dependencies
4
+ So I don't have to download those cookbooks and their all of their dependencies manually
5
5
 
6
- Scenario: installing a Berksfile that contains a source with a default location
6
+ Background:
7
+ Given the Berkshelf API server's cache is empty
8
+ And the Chef Server is empty
9
+ And the cookbook store is empty
10
+
11
+ Scenario: installing the version that best satisfies our demand
7
12
  Given I write to "Berksfile" with:
8
13
  """
9
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
14
+ source "http://localhost:26210"
15
+
16
+ cookbook 'berkshelf'
10
17
  """
18
+ And the Chef Server has cookbooks:
19
+ | berkshelf | 1.0.0 |
20
+ | berkshelf | 2.0.0 |
21
+ And the Berkshelf API server cache is up to date
11
22
  When I successfully run `berks install`
12
- Then the cookbook store should have the cookbooks:
13
- | berkshelf-cookbook-fixture | 1.0.0 |
14
- And the output should contain:
23
+ Then the output should contain:
15
24
  """
16
- Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
25
+ Installing berkshelf (2.0.0)
17
26
  """
18
- And the exit status should be 0
27
+ And the cookbook store should have the cookbooks:
28
+ | berkshelf | 2.0.0 |
19
29
 
20
- Scenario: installing a Berksfile that contains the cookbook explicitly desired by a source
21
- Given the cookbook store has the cookbooks:
22
- | berkshelf-cookbook-fixture | 1.0.0 |
23
- And I write to "Berksfile" with:
30
+ Scenario: installing an explicit version demand
31
+ Given I write to "Berksfile" with:
24
32
  """
25
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
33
+ source "http://localhost:26210"
34
+
35
+ cookbook 'berkshelf', '1.0.0'
26
36
  """
37
+ And the Chef Server has cookbooks:
38
+ | berkshelf | 1.0.0 |
39
+ | berkshelf | 2.0.0 |
40
+ And the Berkshelf API server cache is up to date
27
41
  When I successfully run `berks install`
28
42
  Then the output should contain:
29
43
  """
30
- Using berkshelf-cookbook-fixture (1.0.0)
44
+ Installing berkshelf (1.0.0)
31
45
  """
32
- And the exit status should be 0
46
+ And the cookbook store should have the cookbooks:
47
+ | berkshelf | 1.0.0 |
33
48
 
34
- Scenario: installing a Berksfile that has multiple cookbooks in different groups
35
- Given the cookbook store has the cookbooks:
36
- | berkshelf-cookbook-fixture | 1.0.0 |
37
- And I write to "Berksfile" with:
49
+ Scenario: installing demands from all groups
50
+ Given I write to "Berksfile" with:
38
51
  """
39
- group :a do
40
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
52
+ source "http://localhost:26210"
53
+
54
+ group :one do
55
+ cookbook 'ruby'
41
56
  end
42
57
 
43
- group :b do
44
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
58
+ group :two do
59
+ cookbook 'elixir'
45
60
  end
46
61
  """
62
+ And the Chef Server has cookbooks:
63
+ | ruby | 1.0.0 |
64
+ | elixir | 1.0.0 |
65
+ And the Berkshelf API server cache is up to date
47
66
  When I successfully run `berks install`
48
- Then the output should contain "Using berkshelf-cookbook-fixture (1.0.0)"
49
- And the exit status should be 0
67
+ Then the output should contain:
68
+ """
69
+ Installing ruby (1.0.0)
70
+ Installing elixir (1.0.0)
71
+ """
72
+ And the cookbook store should have the cookbooks:
73
+ | ruby | 1.0.0 |
74
+ | elixir | 1.0.0 |
50
75
 
51
- Scenario: installing a Berksfile that contains a source with dependencies, all of which already have been installed
52
- Given the cookbook store contains a cookbook "berkshelf-cookbook-fixture" "1.0.0" with dependencies:
76
+ Scenario: installing a demand that has already been installed
77
+ Given I write to "Berksfile" with:
78
+ """
79
+ source "http://localhost:26210"
80
+
81
+ cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
82
+ """
83
+ And the cookbook store contains a cookbook "berkshelf" "1.0.0" with dependencies:
53
84
  | hostsfile | = 1.0.1 |
54
85
  And the cookbook store has the cookbooks:
55
86
  | hostsfile | 1.0.1 |
56
- And I write to "Berksfile" with:
57
- """
58
- cookbook 'berkshelf-cookbook-fixture', '1.0.0', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
59
- """
87
+ And the Berkshelf API server cache is up to date
60
88
  When I successfully run `berks install`
61
89
  Then the output should contain:
62
90
  """
63
91
  Using hostsfile (1.0.1)
64
92
  """
65
- And the exit status should be 0
66
93
 
67
- Scenario: installing a Berksfile that contains a path location
68
- Given a Berksfile with path location sources to fixtures:
69
- | example_cookbook | example_cookbook-0.5.0 |
94
+ Scenario: installing a demand from a path location
95
+ Given I write to "Berksfile" with:
96
+ """
97
+ source "http://localhost:26210"
98
+
99
+ cookbook 'example_cookbook', path: '../../spec/fixtures/cookbooks/example_cookbook-0.5.0'
100
+ """
101
+ And the Berkshelf API server cache is up to date
70
102
  When I successfully run `berks install`
71
103
  Then the output should contain:
72
104
  """
73
- Using example_cookbook (0.5.0) at '
105
+ Using example_cookbook (0.5.0) path: '
74
106
  """
75
- And the exit status should be 0
76
107
 
77
108
  Scenario: installing a Berksfile from a remote directory that contains a path location
78
109
  Given I write to "tmp_berks/Berksfile" with:
79
110
  """
111
+ source "http://localhost:26210"
112
+
80
113
  cookbook 'example_cookbook', path: '../../../spec/fixtures/cookbooks/example_cookbook-0.5.0'
81
114
  """
82
115
  When I successfully run `berks install -b ./tmp_berks/Berksfile`
83
116
  Then the output should contain:
84
117
  """
85
- Using example_cookbook (0.5.0) at '
118
+ Using example_cookbook (0.5.0) path: '
86
119
  """
87
- And the exit status should be 0
88
120
 
89
- Scenario: installing a Berksfile that contains a Git location
121
+ Scenario: installing a demand from a Git location
90
122
  Given I write to "Berksfile" with:
91
123
  """
124
+ source "http://localhost:26210"
125
+
92
126
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git"
93
127
  """
94
128
  When I successfully run `berks install`
95
- Then the cookbook store should have the cookbooks installed by git:
129
+ Then the cookbook store should have the git cookbooks:
96
130
  | berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
97
131
  And the output should contain:
98
132
  """
99
- Installing berkshelf-cookbook-fixture (1.0.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
133
+ Fetching 'berkshelf-cookbook-fixture' from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
134
+ building universe...
135
+ Using berkshelf-cookbook-fixture (1.0.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
100
136
  """
101
- And the exit status should be 0
102
137
 
103
- Scenario: installing a Berksfile that contains a Git location that has already been downloaded
138
+ Scenario: installing a demand from a Git location that has already been installed
104
139
  Given I write to "Berksfile" with:
105
140
  """
141
+ source "http://localhost:26210"
142
+
106
143
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git"
107
144
  """
108
- And the cookbook store has the cookbooks installed by git:
145
+ And the cookbook store has the git cookbooks:
109
146
  | berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
110
- And I successfully run `berks install`
111
147
  When I successfully run `berks install`
112
- Then the exit status should be 0
148
+ Then the output should contain:
149
+ """
150
+ Using berkshelf-cookbook-fixture (1.0.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
151
+ """
113
152
 
114
153
  Scenario: installing a Berksfile that contains a Git location with a rel
115
154
  Given I write to "Berksfile" with:
116
155
  """
156
+ source "http://localhost:26210"
157
+
117
158
  cookbook "berkshelf-cookbook-fixture", github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
118
159
  """
119
160
  When I successfully run `berks install`
120
- Then the cookbook store should have the cookbooks installed by git:
161
+ Then the cookbook store should have the git cookbooks:
121
162
  | berkshelf-cookbook-fixture | 1.0.0 | 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a |
122
163
  And the output should contain:
123
164
  """
124
- Installing berkshelf-cookbook-fixture (1.0.0)
165
+ Fetching 'berkshelf-cookbook-fixture' from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'rel' over protocol: 'git'
166
+ building universe...
167
+ Using berkshelf-cookbook-fixture (1.0.0) github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'rel' over protocol: 'git'
125
168
  """
126
- And the exit status should be 0
127
-
128
- Scenario: installing a Berksfile that contains a Git location with a rel that has already been downloaded
129
- Given I write to "Berksfile" with:
130
- """
131
- site :opscode
132
- cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
133
- """
134
- And the cookbook store has the cookbooks installed by git:
135
- | berkshelf-cookbook-fixture | 1.0.0 | 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a |
136
- And I successfully run `berks install`
137
- When I run `berks install`
138
- Then the output should contain:
139
- """
140
- Installing berkshelf-cookbook-fixture (1.0.0)
141
- """
142
- And the exit status should be 0
143
169
 
144
170
  Scenario: installing a Berksfile that contains a Git location with a tag
145
171
  Given I write to "Berksfile" with:
146
172
  """
173
+ source "http://localhost:26210"
174
+
147
175
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
148
176
  """
149
177
  When I successfully run `berks install`
150
- Then the cookbook store should have the cookbooks installed by git:
178
+ Then the cookbook store should have the git cookbooks:
151
179
  | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
152
180
  And the output should contain:
153
181
  """
154
- Installing berkshelf-cookbook-fixture (0.2.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v0.2.0'
182
+ Fetching 'berkshelf-cookbook-fixture' from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v0.2.0'
183
+ building universe...
184
+ Using berkshelf-cookbook-fixture (0.2.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v0.2.0' at ref: '70a527e17d91f01f031204562460ad1c17f972ee'
155
185
  """
156
- And the exit status should be 0
157
186
 
158
187
  Scenario: installing a Berksfile that contains a GitHub location
159
188
  Given I write to "Berksfile" with:
160
189
  """
161
- cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
162
- """
163
- When I successfully run `berks install`
164
- Then the cookbook store should have the cookbooks installed by git:
165
- | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
166
- And the output should contain:
167
- """
168
- Installing berkshelf-cookbook-fixture (0.2.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0'
169
- """
170
- And the exit status should be 0
190
+ source "http://localhost:26210"
171
191
 
172
- Scenario: installing a Berksfile that contains a Github location and the default protocol
173
- Given I write to "Berksfile" with:
174
- """
175
192
  cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
176
193
  """
177
194
  When I successfully run `berks install`
178
- Then the cookbook store should have the cookbooks installed by git:
195
+ Then the cookbook store should have the git cookbooks:
179
196
  | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
180
197
  And the output should contain:
181
198
  """
182
- Installing berkshelf-cookbook-fixture (0.2.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0' over protocol: 'git'
199
+ Fetching 'berkshelf-cookbook-fixture' from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0' over protocol: 'git'
200
+ building universe...
201
+ Using berkshelf-cookbook-fixture (0.2.0) github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0' over protocol: 'git'
183
202
  """
184
- And the exit status should be 0
185
203
 
186
204
  Scenario Outline: installing a Berksfile that contains a Github location and specific protocol
187
205
  Given I write to "Berksfile" with:
188
206
  """
207
+ source "http://localhost:26210"
208
+
189
209
  cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v1.0.0", protocol: "<protocol>"
190
210
  """
191
211
  When I successfully run `berks install`
192
- Then the cookbook store should have the cookbooks installed by git:
212
+ Then the cookbook store should have the git cookbooks:
193
213
  | berkshelf-cookbook-fixture | 1.0.0 | b4f968c9001ad8de30f564a2107fab9cfa91f771 |
194
214
  And the output should contain:
195
215
  """
196
- Installing berkshelf-cookbook-fixture (1.0.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v1.0.0' over protocol: '<protocol>'
216
+ Fetching 'berkshelf-cookbook-fixture' from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v1.0.0' over protocol: '<protocol>'
217
+ building universe...
218
+ Using berkshelf-cookbook-fixture (1.0.0) github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v1.0.0' over protocol: '<protocol>'
197
219
  """
198
- And the exit status should be 0
199
220
 
200
221
  Examples:
201
222
  | protocol |
202
- # | ssh | # GitHub over ssh requires push authorization. Nonpushers will get a test failure here.
203
223
  | git |
204
224
  | https |
205
225
 
206
226
  Scenario: installing a Berksfile that contains a Github location and an unsupported protocol
207
227
  Given I write to "Berksfile" with:
208
228
  """
229
+ source "http://localhost:26210"
230
+
209
231
  cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "somethingabsurd"
210
232
  """
211
233
  When I run `berks install`
@@ -213,76 +235,65 @@ Feature: install cookbooks from a Berksfile
213
235
  """
214
236
  'somethingabsurd' is not supported for the 'github' location key - please use 'git' instead
215
237
  """
216
- And the exit status should be 110
217
-
218
- Scenario: installing a Berksfile that contains an explicit site location
219
- Given I write to "Berksfile" with:
220
- """
221
- cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
222
- """
223
- When I successfully run `berks install`
224
- Then the cookbook store should have the cookbooks:
225
- | berkshelf-cookbook-fixture | 1.0.0 |
226
- And the output should contain:
227
- """
228
- Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
229
- """
230
- And the exit status should be 0
238
+ And the exit status should be "InvalidGitURI"
231
239
 
232
240
  Scenario: running install when current project is a cookbook and the 'metadata' is specified
233
241
  Given a cookbook named "sparkle_motion"
234
242
  And the cookbook "sparkle_motion" has the file "Berksfile" with:
235
243
  """
244
+ source "http://localhost:26210"
245
+
236
246
  metadata
237
247
  """
238
248
  When I cd to "sparkle_motion"
239
249
  And I successfully run `berks install`
240
- Then the stdout should contain exactly:
250
+ Then the output should contain:
241
251
  """
242
- Using sparkle_motion (0.0.0) from metadata
243
-
252
+ Using sparkle_motion (0.0.0)
244
253
  """
245
- And the exit status should be 0
246
254
 
247
255
  Scenario: running install when current project is a cookbook and the 'metadata' is specified with a path
248
256
  Given a cookbook named "fake"
249
257
  And I write to "Berksfile" with:
250
258
  """
259
+ source "http://localhost:26210"
260
+
251
261
  metadata path: './fake'
252
262
  """
253
263
  When I successfully run `berks install`
254
- Then the stdout should contain exactly:
264
+ Then the output should contain:
255
265
  """
256
- Using fake (0.0.0) from metadata at './fake'
257
-
266
+ Using fake (0.0.0)
258
267
  """
259
- And the exit status should be 0
260
268
 
261
269
  Scenario: running install with no Berksfile or Berksfile.lock
262
- Given I do not have a Berksfile
263
- And I do not have a Berksfile.lock
264
270
  When I run `berks install`
265
271
  Then the output should contain:
266
272
  """
267
- No Berksfile or Berksfile.lock found at '
273
+ No Berksfile or Berksfile.lock found at:
268
274
  """
269
- And the CLI should exit with the status code for error "BerksfileNotFound"
275
+ And the exit status should be "BerksfileNotFound"
270
276
 
271
277
  Scenario: running install when the Cookbook is not found on the remote site
272
278
  Given I write to "Berksfile" with:
273
279
  """
280
+ source "http://localhost:26210"
281
+
274
282
  cookbook 'doesntexist'
283
+ cookbook 'other-failure'
275
284
  """
276
285
  And I run `berks install`
277
286
  Then the output should contain:
278
287
  """
279
- Cookbook 'doesntexist' not found in any of the default locations
288
+ Unable to find a solution for demands: doesntexist (>= 0.0.0), other-failure (>= 0.0.0)
280
289
  """
281
- And the CLI should exit with the status code for error "CookbookNotFound"
290
+ And the exit status should be "NoSolutionError"
282
291
 
283
292
  Scenario: installing a Berksfile that has a Git location source with an invalid Git URI
284
293
  Given I write to "Berksfile" with:
285
294
  """
295
+ source "http://localhost:26210"
296
+
286
297
  cookbook 'nginx', git: '/something/on/disk'
287
298
  """
288
299
  When I run `berks install`
@@ -290,75 +301,43 @@ Feature: install cookbooks from a Berksfile
290
301
  """
291
302
  '/something/on/disk' is not a valid Git URI
292
303
  """
293
- And the CLI should exit with the status code for error "InvalidGitURI"
304
+ And the exit status should be "InvalidGitURI"
294
305
 
295
306
  Scenario: installing when there are sources with duplicate names defined in the same group
296
307
  Given I write to "Berksfile" with:
297
308
  """
309
+ source "http://localhost:26210"
310
+
298
311
  cookbook 'berkshelf-cookbook-fixture'
299
312
  cookbook 'berkshelf-cookbook-fixture'
300
313
  """
301
314
  When I run `berks install`
302
315
  Then the output should contain:
303
316
  """
304
- Berksfile contains multiple sources named 'berkshelf-cookbook-fixture'. Use only one, or put them in different groups.
317
+ Berksfile contains multiple entries named 'berkshelf-cookbook-fixture'. Use only one, or put them in different groups.
305
318
  """
306
- And the CLI should exit with the status code for error "DuplicateSourceDefined"
319
+ And the exit status should be "DuplicateDependencyDefined"
307
320
 
308
- Scenario: When a version constraint in the metadata exists, but does not satisfy
309
- Given a cookbook named "fake"
310
- And I write to "Berksfile" with:
311
- """
312
- site :opscode
313
- cookbook 'fake', path: './fake'
314
- """
315
- And the cookbook "fake" has the file "metadata.rb" with:
316
- """
317
- name 'fake'
318
- version '1.0.0'
319
-
320
- depends 'berkshelf-cookbook-fixture', '~> 0.2.0'
321
- """
322
- And the cookbook store has the cookbooks:
323
- | berkshelf-cookbook-fixture | 0.2.0 |
324
- And I successfully run `berks install`
325
- And the cookbook "fake" has the file "metadata.rb" with:
321
+ Scenario: when a Git demand points to a branch that does not satisfy the version constraint
322
+ Given I write to "Berksfile" with:
326
323
  """
327
- name 'fake'
328
- version '1.0.0'
324
+ source "http://localhost:26210"
329
325
 
330
- depends 'berkshelf-cookbook-fixture', '~> 1.0.0'
326
+ cookbook "berkshelf-cookbook-fixture", "1.0.0", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
331
327
  """
332
- When I successfully run `berks install`
328
+ When I run `berks install`
333
329
  Then the output should contain:
334
330
  """
335
- Installing berkshelf-cookbook-fixture (1.0.0)
331
+ Fetching 'berkshelf-cookbook-fixture' from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v0.2.0'
332
+ The cookbook downloaded for berkshelf-cookbook-fixture (= 1.0.0) did not satisfy the constraint.
336
333
  """
337
- And the cookbook store should have the cookbooks:
338
- | berkshelf-cookbook-fixture | 1.0.0 |
339
- And the exit status should be 0
334
+ And the exit status should be "CookbookValidationFailure"
340
335
 
341
- Scenario: installing when a git source defines a branch that does not satisfy the version constraint
336
+ Scenario: when a Git demand is defined and a cookbook of the same name and version is already in the cookbook store
342
337
  Given I write to "Berksfile" with:
343
338
  """
344
- cookbook "berkshelf-cookbook-fixture", "= 1.0.0", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
345
- """
346
- When I run `berks install`
347
- Then the output should match multiline:
348
- """
349
- The cookbook downloaded from git: 'git://github\.com/RiotGames/berkshelf-cookbook-fixture\.git' with branch: 'v0\.2\.0' at ref: '.+':
350
- berkshelf-cookbook-fixture \(.+\)
339
+ source "http://localhost:26210"
351
340
 
352
- does not satisfy the version constraint:
353
- berkshelf-cookbook-fixture \(= 1.0.0\)
354
-
355
- This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb`
356
- """
357
- And the CLI should exit with the status code for error "CookbookValidationFailure"
358
-
359
- Scenario: when a git location source is defined and a cookbook of the same name is already cached in the cookbook store
360
- Given I write to "Berksfile" with:
361
- """
362
341
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v1.0.0"
363
342
  """
364
343
  And the cookbook store has the cookbooks:
@@ -366,87 +345,37 @@ Feature: install cookbooks from a Berksfile
366
345
  When I successfully run `berks install`
367
346
  Then the output should contain:
368
347
  """
369
- Installing berkshelf-cookbook-fixture (1.0.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v1.0.0' at ref:
348
+ Fetching 'berkshelf-cookbook-fixture' from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v1.0.0'
349
+ building universe...
350
+ Using berkshelf-cookbook-fixture (1.0.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v1.0.0' at ref: 'b4f968c9001ad8de30f564a2107fab9cfa91f771'
370
351
  """
371
- And the exit status should be 0
372
352
 
373
353
  Scenario: with a cookbook definition containing an invalid option
374
354
  Given I write to "Berksfile" with:
375
355
  """
356
+ source "http://localhost:26210"
357
+
376
358
  cookbook "berkshelf-cookbook-fixture", whatisthis: "I don't even know", anotherwat: "isthat"
377
359
  """
378
360
  When I run `berks install`
379
361
  Then the output should contain:
380
362
  """
381
- Invalid options for Cookbook Source: 'whatisthis', 'anotherwat'.
382
- """
383
- And the CLI should exit with the status code for error "InternalError"
384
-
385
- @chef_server
386
- Scenario: with a cookbook definition containing a chef_api source location
387
- Given I write to "Berksfile" with:
388
- """
389
- cookbook 'berkshelf-cookbook-fixture', '1.0.0', chef_api: :config
390
- """
391
- And the Chef server has cookbooks:
392
- | berkshelf-cookbook-fixture | 1.0.0 |
393
- When I successfully run `berks install`
394
- Then the output should contain:
395
- """
396
- Installing berkshelf-cookbook-fixture (1.0.0) from chef_api:
397
- """
398
- And the cookbook store should have the cookbooks:
399
- | berkshelf-cookbook-fixture | 1.0.0 |
400
- And the exit status should be 0
401
-
402
- Scenario: when the :site is not defined
403
- Given I write to "Berksfile" with:
404
- """
405
- cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: nil
406
- """
407
- When I successfully run `berks install`
408
- Then the output should contain:
409
- """
410
- Installing berkshelf-cookbook-fixture (1.0.0) from site:
411
- """
412
- And the cookbook store should have the cookbooks:
413
- | berkshelf-cookbook-fixture | 1.0.0 |
414
- And the exit status should be 0
415
-
416
- Scenario: with a chef_api source location specifying :config when a Berkshelf config is not found at the given path
417
- Given I write to "Berksfile" with:
418
- """
419
- cookbook 'berkshelf-cookbook-fixture', chef_api: :config
420
- """
421
- When I run the install command with flags:
422
- | -c /tmp/notthere.lol |
423
- Then the output should contain:
424
- """
425
- No Berkshelf config file found at: '/tmp/notthere.lol'!
363
+ Invalid options for dependency: 'whatisthis', 'anotherwat'.
426
364
  """
427
- And the CLI should exit with the status code for error "ConfigNotFound"
365
+ And the exit status should be "InternalError"
428
366
 
429
367
  Scenario: with a git error during download
430
368
  Given I write to "Berksfile" with:
431
369
  """
370
+ source "http://localhost:26210"
371
+
432
372
  cookbook 'berkshelf-cookbook-fixture', '1.0.0'
433
373
  cookbook "doesntexist", git: "git://github.com/asdjhfkljashflkjashfakljsf"
434
374
  """
435
375
  When I run `berks install`
436
376
  Then the output should contain:
437
377
  """
438
- Failed to download 'doesntexist' from git:
439
- """
440
- And the CLI should exit with the status code for error "CookbookNotFound"
441
-
442
- Scenario: invalid site symbol
443
- Given I write to "Berksfile" with:
444
- """
445
- site :somethingabsurd
446
- cookbook 'berkshelf-cookbook-fixture'
447
- """
448
- When I run `berks install`
449
- Then the output should contain:
450
- """
451
- Unknown site shortname 'somethingabsurd' - supported shortnames are:
378
+ Fetching 'doesntexist' from git: 'git://github.com/asdjhfkljashflkjashfakljsf' with branch: 'master'
379
+ An error occurred during Git execution:
452
380
  """
381
+ And the exit status should be "GitError"