berkshelf 3.0.0.beta2 → 3.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/CHANGELOG.md +8 -0
  4. data/Gemfile +0 -1
  5. data/Guardfile +0 -4
  6. data/README.md +1 -1
  7. data/Thorfile +2 -11
  8. data/berkshelf.gemspec +2 -5
  9. data/features/berksfile.feature +2 -10
  10. data/features/commands/apply.feature +31 -0
  11. data/features/{configure_command.feature → commands/configure.feature} +9 -11
  12. data/features/{contingent_command.feature → commands/contingent.feature} +10 -20
  13. data/features/{cookbook_command.feature → commands/cookbook.feature} +4 -11
  14. data/features/{init_command.feature → commands/init.feature} +10 -19
  15. data/features/{install_command.feature → commands/install.feature} +161 -82
  16. data/features/{list_command.feature → commands/list.feature} +4 -14
  17. data/features/{outdated_command.feature → commands/outdated.feature} +21 -63
  18. data/features/{package_command.feature → commands/package.feature} +11 -22
  19. data/features/{shelf → commands/shelf}/list.feature +3 -8
  20. data/features/{shelf → commands/shelf}/show.feature +5 -9
  21. data/features/{shelf → commands/shelf}/uninstall.feature +6 -10
  22. data/features/{show_command.feature → commands/show.feature} +13 -38
  23. data/features/commands/update.feature +48 -0
  24. data/features/commands/upload.feature +197 -0
  25. data/features/commands/vendor.feature +53 -0
  26. data/features/community_site.feature +39 -0
  27. data/features/config.feature +79 -9
  28. data/features/help.feature +10 -19
  29. data/features/json_formatter.feature +19 -44
  30. data/features/licenses.feature +27 -61
  31. data/features/lockfile.feature +120 -354
  32. data/features/resolver.feature +28 -0
  33. data/features/step_definitions/berksfile_steps.rb +39 -0
  34. data/features/step_definitions/chef/config_steps.rb +1 -1
  35. data/features/step_definitions/chef_server_steps.rb +27 -27
  36. data/features/step_definitions/config_steps.rb +3 -0
  37. data/features/step_definitions/filesystem_steps.rb +10 -0
  38. data/features/step_definitions/json_steps.rb +0 -7
  39. data/features/step_definitions/lockfile_steps.rb +53 -0
  40. data/features/step_definitions/utility_steps.rb +4 -4
  41. data/features/support/env.rb +1 -0
  42. data/generator_files/Berksfile.erb +1 -1
  43. data/generator_files/README.md.erb +62 -6
  44. data/generator_files/Vagrantfile.erb +15 -4
  45. data/lib/berkshelf.rb +2 -4
  46. data/lib/berkshelf/api_client.rb +5 -7
  47. data/lib/berkshelf/berksfile.rb +24 -20
  48. data/lib/berkshelf/cached_cookbook.rb +8 -1
  49. data/lib/berkshelf/cli.rb +5 -10
  50. data/lib/berkshelf/community_rest.rb +4 -5
  51. data/lib/berkshelf/config.rb +8 -2
  52. data/lib/berkshelf/cookbook_store.rb +9 -14
  53. data/lib/berkshelf/dependency.rb +16 -13
  54. data/lib/berkshelf/errors.rb +15 -1
  55. data/lib/berkshelf/formatters/json.rb +1 -1
  56. data/lib/berkshelf/init_generator.rb +17 -3
  57. data/lib/berkshelf/installer.rb +12 -1
  58. data/lib/berkshelf/logger.rb +7 -4
  59. data/lib/berkshelf/resolver.rb +1 -1
  60. data/lib/berkshelf/version.rb +1 -1
  61. data/spec/spec_helper.rb +0 -9
  62. data/spec/support/chef_server.rb +24 -7
  63. data/spec/unit/berkshelf/api_client/remote_cookbook_spec.rb +3 -3
  64. data/spec/unit/berkshelf/berksfile_spec.rb +35 -1
  65. data/spec/unit/berkshelf/cached_cookbook_spec.rb +8 -0
  66. data/spec/unit/berkshelf/community_rest_spec.rb +76 -25
  67. data/spec/unit/berkshelf/cookbook_generator_spec.rb +9 -3
  68. data/spec/unit/berkshelf/dependency_spec.rb +16 -1
  69. data/spec/unit/berkshelf/init_generator_spec.rb +71 -7
  70. metadata +44 -116
  71. data/.cane +0 -4
  72. data/features/apply_command.feature +0 -40
  73. data/features/groups_install.feature +0 -113
  74. data/features/update_command.feature +0 -136
  75. data/features/upload_command.feature +0 -327
  76. data/features/vendor_command.feature +0 -83
  77. data/lib/berkshelf/chef.rb +0 -7
  78. data/lib/berkshelf/chef/cookbook.rb +0 -5
  79. data/lib/berkshelf/chef/cookbook/chefignore.rb +0 -75
  80. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_download/unpacks_the_archive.json +0 -1
  81. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/raises_a_CommunitySiteError_error_on_any_non_200_or_404_response.json +0 -1
  82. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/raises_a_CookbookNotFound_error_on_a_404_response_for_a_non-existent_cookbook.json +0 -1
  83. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/raises_a_CookbookNotFound_error_on_a_404_response_for_a_non-existent_version.json +0 -1
  84. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/returns_the_cookbook_and_version_information.json +0 -1
  85. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_latest_version/raises_a_CommunitySiteError_error_on_any_non_200_or_404_response.json +0 -1
  86. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_latest_version/raises_a_CookbookNotFound_error_on_a_404_response.json +0 -1
  87. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_latest_version/returns_the_version_number_of_the_latest_version_of_the_cookbook.json +0 -1
  88. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_satisfy/returns_the_version_number_of_the_best_solution.json +0 -1
  89. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_versions/raises_a_CommunitySiteError_error_on_any_non_200_or_404_response.json +0 -1
  90. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_versions/raises_a_CookbookNotFound_error_on_a_404_response.json +0 -1
  91. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_versions/returns_an_array_containing_an_item_for_each_version.json +0 -1
  92. data/spec/fixtures/cassettes/Berkshelf_Resolver/_initialize/adds_the_dependencies_of_the_dependency_as_dependencies.yml +0 -3694
  93. data/spec/fixtures/cassettes/Berkshelf_Resolver/_initialize/adds_the_dependencies_of_the_source_as_sources.yml +0 -3829
  94. data/spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb +0 -19
@@ -1,136 +0,0 @@
1
- Feature: Updating a cookbook defined by a Berksfile
2
- As a user
3
- I want a way to update the versions without clearing out the files I've downloaded
4
- So that I can update faster than a clean install
5
-
6
- Scenario: With the old lockfile format
7
- Given the cookbook store has the cookbooks:
8
- | berkshelf-cookbook-fixture | 0.1.0 |
9
- And I write to "Berksfile" with:
10
- """
11
- source "http://localhost:26210"
12
-
13
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
14
- """
15
- And I write to "Berksfile.lock" with:
16
- """
17
- cookbook 'berkshelf-cookbook-fixture', :locked_version => '0.1.0'
18
- """
19
- When I successfully run `berks update`
20
- Then the output should warn about the old lockfile format
21
- Then the file "Berksfile.lock" should contain JSON:
22
- """
23
- {
24
- "dependencies":{
25
- "berkshelf-cookbook-fixture":{
26
- "locked_version":"0.1.0"
27
- }
28
- }
29
- }
30
- """
31
-
32
- Scenario: Without a cookbook specified
33
- Given the cookbook store has the cookbooks:
34
- | berkshelf-cookbook-fixture | 0.1.0 |
35
- | berkshelf-cookbook-fixture | 0.2.0 |
36
- | hostsfile | 1.0.1 |
37
- And I write to "Berksfile" with:
38
- """
39
- source "http://localhost:26210"
40
-
41
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
42
- cookbook 'hostsfile', '~> 1.0.0'
43
- """
44
- And I write to "Berksfile.lock" with:
45
- """
46
- {
47
- "dependencies":{
48
- "berkshelf-cookbook-fixture":{
49
- "locked_version":"0.1.0"
50
- },
51
- "hostsfile":{
52
- "locked_version":"1.0.1"
53
- }
54
- }
55
- }
56
- """
57
- When I successfully run `berks update`
58
- Then the file "Berksfile.lock" should contain JSON:
59
- """
60
- {
61
- "dependencies":{
62
- "berkshelf-cookbook-fixture":{
63
- "locked_version":"0.2.0"
64
- },
65
- "hostsfile":{
66
- "locked_version":"1.0.1"
67
- }
68
- }
69
- }
70
- """
71
-
72
- Scenario: With a single cookbook specified
73
- Given the cookbook store has the cookbooks:
74
- | berkshelf-cookbook-fixture | 0.1.0 |
75
- | berkshelf-cookbook-fixture | 0.2.0 |
76
- | hostsfile | 1.0.1 |
77
- Given I write to "Berksfile" with:
78
- """
79
- source "http://localhost:26210"
80
-
81
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
82
- cookbook 'hostsfile', '~> 1.0.0'
83
- """
84
- And I write to "Berksfile.lock" with:
85
- """
86
- {
87
- "dependencies":{
88
- "berkshelf-cookbook-fixture":{
89
- "locked_version":"0.1.0"
90
- },
91
- "hostsfile":{
92
- "locked_version":"1.0.1"
93
- }
94
- }
95
- }
96
- """
97
- And I successfully run `berks update berkshelf-cookbook-fixture`
98
- Then the file "Berksfile.lock" should contain JSON:
99
- """
100
- {
101
- "dependencies":{
102
- "berkshelf-cookbook-fixture":{
103
- "locked_version":"0.2.0"
104
- },
105
- "hostsfile":{
106
- "locked_version":"1.0.1"
107
- }
108
- }
109
- }
110
- """
111
-
112
- Scenario: With a cookbook that does not exist
113
- Given the cookbook store has the cookbooks:
114
- | berkshelf-cookbook-fixture | 0.1.0 |
115
- Given I write to "Berksfile" with:
116
- """
117
- source "http://localhost:26210"
118
-
119
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
120
- """
121
- Given I write to "Berksfile.lock" with:
122
- """
123
- {
124
- "dependencies":{
125
- "berkshelf-cookbook-fixture":{
126
- "locked_version":"0.1.0"
127
- }
128
- }
129
- }
130
- """
131
- When I run `berks update non-existent-cookbook`
132
- Then the output should contain:
133
- """
134
- Could not find cookbook(s) 'non-existent-cookbook' in any of the configured dependencies. Is it in your Berksfile?
135
- """
136
- And the exit status should be "DependencyNotFound"
@@ -1,327 +0,0 @@
1
- Feature: Uploading cookbooks to a Chef Server
2
- As a Berkshelf CLI user
3
- I need a way to upload cookbooks to a Chef Server that I have installed into my Bookshelf
4
- So they are available to Chef clients
5
-
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: multiple cookbooks with no arguments
12
- Given the cookbook store has the cookbooks:
13
- | ruby | 1.0.0 |
14
- | elixir | 2.0.0 |
15
- And I write to "Berksfile" with:
16
- """
17
- source "http://localhost:26210"
18
-
19
- cookbook 'ruby', '1.0.0'
20
- cookbook 'elixir', '2.0.0'
21
- """
22
- When I successfully run `berks upload`
23
- Then the output should contain:
24
- """
25
- Uploading ruby (1.0.0) to: 'http://localhost:26310/'
26
- Uploading elixir (2.0.0) to: 'http://localhost:26310/'
27
- """
28
- And the Chef Server should have the cookbooks:
29
- | ruby | 1.0.0 |
30
- | elixir | 2.0.0 |
31
-
32
- Scenario: a cookbook with a path location
33
- Given a cookbook named "ruby"
34
- And I write to "Berksfile" with:
35
- """
36
- source "http://localhost:26210"
37
-
38
- cookbook 'ruby', path: './ruby'
39
- """
40
- When I successfully run `berks upload`
41
- Then the output should contain:
42
- """
43
- Uploading ruby (0.0.0) to: 'http://localhost:26310/'
44
- """
45
- And the Chef Server should have the cookbooks:
46
- | ruby | 0.0.0 |
47
-
48
- Scenario: a cookbook with a git location
49
- Given the cookbook store has the cookbooks:
50
- | berkshelf-cookbook-fixture | 0.1.0 |
51
- And I write to "Berksfile" with:
52
- """
53
- source "http://localhost:26210"
54
-
55
- cookbook 'berkshelf-cookbook-fixture', ref: 'v0.1.0'
56
- """
57
- When I successfully run `berks upload`
58
- Then the output should contain:
59
- """
60
- Uploading berkshelf-cookbook-fixture (0.1.0) to: 'http://localhost:26310/'
61
- """
62
- And the Chef Server should have the cookbooks:
63
- | berkshelf-cookbook-fixture | 0.1.0 |
64
-
65
- Scenario: specifying a single cookbook with dependencies
66
- Given the cookbook store has the cookbooks:
67
- | fake | 1.0.0 |
68
- | ekaf | 2.0.0 |
69
- And the cookbook store contains a cookbook "reset" "3.4.5" with dependencies:
70
- | fake | = 1.0.0 |
71
- And I write to "Berksfile" with:
72
- """
73
- source "http://localhost:26210"
74
-
75
- cookbook 'fake', '1.0.0'
76
- cookbook 'ekaf', '2.0.0'
77
- cookbook 'reset', '3.4.5'
78
- """
79
- When I successfully run `berks upload reset`
80
- Then the output should contain:
81
- """
82
- Uploading reset (3.4.5) to: 'http://localhost:26310/'
83
- Uploading fake (1.0.0) to: 'http://localhost:26310/'
84
- """
85
- And the output should not contain:
86
- """
87
- Uploading ekaf (2.0.0) to: 'http://localhost:26310/'
88
- """
89
- And the Chef Server should have the cookbooks:
90
- | reset | 3.4.5 |
91
- | fake | 1.0.0 |
92
- And the Chef Server should not have the cookbooks:
93
- | ekaf | 2.0.0 |
94
-
95
- Scenario: specifying a dependency not defined in the Berksfile
96
- Given I write to "Berksfile" with:
97
- """
98
- source "http://localhost:26210"
99
- """
100
- When I run `berks upload reset`
101
- Then the output should contain:
102
- """
103
- Could not find cookbook(s) 'reset' in any of the configured dependencies. Is it in your Berksfile?
104
- """
105
- And the exit status should be "DependencyNotFound"
106
-
107
- Scenario: specifying multiple cookbooks to upload
108
- Given the cookbook store has the cookbooks:
109
- | ntp | 1.0.0 |
110
- | vim | 1.0.0 |
111
- | apt | 1.0.0 |
112
- Given I write to "Berksfile" with:
113
- """
114
- source "http://localhost:26210"
115
-
116
- cookbook 'apt', '1.0.0'
117
- cookbook 'ntp', '1.0.0'
118
- cookbook 'vim', '1.0.0'
119
- """
120
- When I successfully run `berks upload ntp vim`
121
- Then the output should contain:
122
- """
123
- Uploading ntp (1.0.0) to: 'http://localhost:26310/'
124
- Uploading vim (1.0.0) to: 'http://localhost:26310/'
125
- """
126
- And the output should not contain:
127
- """
128
- Uploading apt (1.0.0) to: 'http://localhost:26310/'
129
- """
130
- And the Chef Server should have the cookbooks:
131
- | ntp |
132
- | vim |
133
- And the Chef Server should not have the cookbooks:
134
- | apt |
135
-
136
- Scenario: uploading a single groups of demands with the --only flag
137
- Given the cookbook store has the cookbooks:
138
- | core | 1.0.0 |
139
- | system | 1.0.0 |
140
- Given I write to "Berksfile" with:
141
- """
142
- source "http://localhost:26210"
143
-
144
- group :group_a do
145
- cookbook 'core', '1.0.0'
146
- end
147
-
148
- group :group_b do
149
- cookbook 'system', '1.0.0'
150
- end
151
- """
152
- When I successfully run `berks upload --only group_a`
153
- Then the output should contain:
154
- """
155
- Uploading core (1.0.0) to: 'http://localhost:26310/'
156
- """
157
- And the output should not contain:
158
- """
159
- Uploading system (1.0.0) to: 'http://localhost:26310/'
160
- """
161
- And the Chef Server should have the cookbooks:
162
- | core | 1.0.0 |
163
- And the Chef Server should not have the cookbooks:
164
- | system | 1.0.0 |
165
-
166
- Scenario: uploading multiple groups of demands with the --only flag
167
- Given the cookbook store has the cookbooks:
168
- | core | 1.0.0 |
169
- | system | 1.0.0 |
170
- Given I write to "Berksfile" with:
171
- """
172
- source "http://localhost:26210"
173
-
174
- group :group_a do
175
- cookbook 'core', '1.0.0'
176
- end
177
-
178
- group :group_b do
179
- cookbook 'system', '1.0.0'
180
- end
181
- """
182
- When I successfully run `berks upload --only group_a group_b`
183
- Then the output should contain:
184
- """
185
- Uploading core (1.0.0) to: 'http://localhost:26310/'
186
- Uploading system (1.0.0) to: 'http://localhost:26310/'
187
- """
188
- And the Chef Server should have the cookbooks:
189
- | core | 1.0.0 |
190
- | system | 1.0.0 |
191
-
192
- Scenario: skipping a single group to upload with the --except flag
193
- Given the cookbook store has the cookbooks:
194
- | core | 1.0.0 |
195
- | system | 1.0.0 |
196
- Given I write to "Berksfile" with:
197
- """
198
- source "http://localhost:26210"
199
-
200
- group :group_a do
201
- cookbook 'core', '1.0.0'
202
- end
203
-
204
- group :group_b do
205
- cookbook 'system', '1.0.0'
206
- end
207
- """
208
- When I successfully run `berks upload --except group_b`
209
- Then the output should contain:
210
- """
211
- Uploading core (1.0.0) to: 'http://localhost:26310/'
212
- """
213
- And the output should not contain:
214
- """
215
- Uploading system (1.0.0) to: 'http://localhost:26310/'
216
- """
217
- And the Chef Server should have the cookbooks:
218
- | core | 1.0.0 |
219
- And the Chef Server should not have the cookbooks:
220
- | system | 1.0.0 |
221
-
222
- Scenario: skipping multiple groups with the --except flag
223
- Given the cookbook store has the cookbooks:
224
- | core | 1.0.0 |
225
- | system | 1.0.0 |
226
- Given I write to "Berksfile" with:
227
- """
228
- source "http://localhost:26210"
229
-
230
- group :group_a do
231
- cookbook 'core', '1.0.0'
232
- end
233
-
234
- group :group_b do
235
- cookbook 'system', '1.0.0'
236
- end
237
- """
238
- When I successfully run `berks upload --except group_a group_b`
239
- Then the output should not contain:
240
- """
241
- Uploading core (1.0.0) to: 'http://localhost:26310/'
242
- Uploading system (1.0.0) to: 'http://localhost:26310/'
243
- """
244
- And the Chef Server should not have the cookbooks:
245
- | core | 1.0.0 |
246
- | system | 1.0.0 |
247
-
248
- Scenario: attempting to upload an invalid cookbook
249
- Given a cookbook named "cookbook with spaces"
250
- And I write to "Berksfile" with:
251
- """
252
- source "http://localhost:26210"
253
-
254
- cookbook 'cookbook with spaces', path: './cookbook with spaces'
255
- """
256
- When I run `berks upload`
257
- Then the output should contain:
258
- """
259
- The cookbook 'cookbook with spaces' has invalid filenames:
260
- """
261
- And the exit status should be "InvalidCookbookFiles"
262
-
263
- Scenario: With unicode characters
264
- Given a cookbook named "fake"
265
- And the cookbook "fake" has the file "README.md" with:
266
- """
267
- Jamié Wiñsor
268
- 赛斯瓦戈
269
- Μιψηαελ Ιωευ
270
- جوستين كامبل
271
- """
272
- And the cookbook "fake" has the file "Berksfile" with:
273
- """
274
- source "http://localhost:26210"
275
-
276
- metadata
277
- """
278
- When I cd to "fake"
279
- And I successfully run `berks upload fake`
280
- Then the output should contain:
281
- """
282
- Uploading fake (0.0.0)
283
- """
284
-
285
- Scenario: When the cookbook already exist
286
- Given the cookbook store has the cookbooks:
287
- | fake | 1.0.0 |
288
- And the Chef Server has frozen cookbooks:
289
- | fake | 1.0.0 |
290
- And I write to "Berksfile" with:
291
- """
292
- cookbook 'fake', '1.0.0'
293
- """
294
- When I successfully run `berks upload`
295
- Then the output should contain:
296
- """
297
- Skipping fake (1.0.0) (already uploaded)
298
- """
299
- And the output should contain:
300
- """
301
- Skipped uploading some cookbooks because they already existed on the remote server. Re-run with the `--force` flag to force overwrite these cookbooks:
302
-
303
- * fake (1.0.0)
304
- """
305
- And the exit status should be 0
306
-
307
- Scenario: When the cookbook already exist and is a metadata location
308
- Given a cookbook named "fake"
309
- And the cookbook "fake" has the file "Berksfile" with:
310
- """
311
- metadata
312
- """
313
- When I cd to "fake"
314
- And the Chef Server has frozen cookbooks:
315
- | fake | 0.0.0 |
316
- When I run `berks upload`
317
- Then the output should contain:
318
- """
319
- building universe...
320
- Using fake (0.0.0) path: '/home/travis/build/RiotGames/berkshelf/spec/tmp/aruba/fake'
321
- Uploading fake (0.0.0) to: 'http://localhost:26310/'
322
- Skipping fake (0.0.0) (already uploaded)
323
- Skipped uploading some cookbooks because they already existed on the remote server. Re-run with the `--force` flag to force overwrite these cookbooks:
324
-
325
- * fake (0.0.0)
326
- """
327
- And the exit status should be 0