berkshelf 2.0.0.beta → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. data/CHANGELOG.md +19 -1
  2. data/CONTRIBUTING.md +1 -3
  3. data/Gemfile +0 -20
  4. data/Guardfile +3 -3
  5. data/LICENSE +6 -5
  6. data/README.md +1 -0
  7. data/Thorfile +48 -67
  8. data/berkshelf.gemspec +48 -37
  9. data/features/apply_command.feature +17 -11
  10. data/features/config.feature +11 -11
  11. data/features/configure_command.feature +8 -8
  12. data/features/contingent_command.feature +37 -8
  13. data/features/cookbook_command.feature +17 -14
  14. data/features/groups_install.feature +24 -20
  15. data/features/install_command.feature +24 -33
  16. data/features/licenses.feature +112 -0
  17. data/features/list_command.feature +17 -5
  18. data/features/lockfile.feature +307 -188
  19. data/features/outdated_command.feature +1 -4
  20. data/features/package_command.feature +41 -19
  21. data/features/shelf/list.feature +39 -0
  22. data/features/shelf/show.feature +152 -0
  23. data/features/shelf/uninstall.feature +103 -0
  24. data/features/show_command.feature +49 -17
  25. data/features/step_definitions/filesystem_steps.rb +12 -3
  26. data/features/step_definitions/utility_steps.rb +0 -1
  27. data/features/support/env.rb +11 -4
  28. data/features/update_command.feature +22 -10
  29. data/features/upload_command.feature +174 -127
  30. data/features/vendor_install.feature +6 -6
  31. data/generator_files/Berksfile.erb +1 -1
  32. data/generator_files/metadata.rb.erb +7 -7
  33. data/lib/berkshelf.rb +39 -27
  34. data/lib/berkshelf/base_generator.rb +2 -3
  35. data/lib/berkshelf/berksfile.rb +69 -17
  36. data/lib/berkshelf/cached_cookbook.rb +17 -1
  37. data/lib/berkshelf/chef.rb +2 -4
  38. data/lib/berkshelf/chef/config.rb +51 -75
  39. data/lib/berkshelf/chef/cookbook.rb +1 -2
  40. data/lib/berkshelf/chef/cookbook/chefignore.rb +1 -1
  41. data/lib/berkshelf/cli.rb +144 -194
  42. data/lib/berkshelf/command.rb +11 -12
  43. data/lib/berkshelf/commands/shelf.rb +130 -0
  44. data/lib/berkshelf/commands/test_command.rb +11 -0
  45. data/lib/berkshelf/community_rest.rb +1 -2
  46. data/lib/berkshelf/config.rb +14 -10
  47. data/lib/berkshelf/cookbook_generator.rb +30 -24
  48. data/lib/berkshelf/cookbook_source.rb +1 -1
  49. data/lib/berkshelf/cookbook_store.rb +0 -1
  50. data/lib/berkshelf/core_ext.rb +1 -1
  51. data/lib/berkshelf/core_ext/file.rb +1 -1
  52. data/lib/berkshelf/downloader.rb +3 -1
  53. data/lib/berkshelf/errors.rb +128 -53
  54. data/lib/berkshelf/formatters.rb +2 -6
  55. data/lib/berkshelf/formatters/human_readable.rb +8 -2
  56. data/lib/berkshelf/formatters/json.rb +7 -1
  57. data/lib/berkshelf/formatters/null.rb +0 -1
  58. data/lib/berkshelf/git.rb +16 -16
  59. data/lib/berkshelf/init_generator.rb +28 -26
  60. data/lib/berkshelf/location.rb +12 -11
  61. data/lib/berkshelf/locations/chef_api_location.rb +2 -2
  62. data/lib/berkshelf/locations/git_location.rb +0 -1
  63. data/lib/berkshelf/locations/github_location.rb +0 -1
  64. data/lib/berkshelf/locations/path_location.rb +1 -2
  65. data/lib/berkshelf/locations/site_location.rb +3 -2
  66. data/lib/berkshelf/lockfile.rb +29 -10
  67. data/lib/berkshelf/mixin/config.rb +155 -0
  68. data/lib/berkshelf/mixin/logging.rb +0 -1
  69. data/lib/berkshelf/mixin/shellout.rb +71 -0
  70. data/lib/berkshelf/resolver.rb +7 -4
  71. data/lib/berkshelf/test.rb +1 -3
  72. data/lib/berkshelf/ui.rb +8 -4
  73. data/lib/berkshelf/version.rb +1 -1
  74. data/lib/thor/monkies/shell.rb +0 -1
  75. data/spec/config/berkshelf.pem +27 -0
  76. data/spec/config/knife.rb +12 -0
  77. data/spec/config/validator.pem +27 -0
  78. data/spec/spec_helper.rb +4 -8
  79. data/spec/support/chef_api.rb +14 -9
  80. data/spec/support/chef_server.rb +3 -4
  81. data/spec/unit/berkshelf/berksfile_spec.rb +1 -1
  82. data/spec/unit/berkshelf/cookbook_generator_spec.rb +12 -6
  83. data/spec/unit/berkshelf/cookbook_source_spec.rb +13 -1
  84. data/spec/unit/berkshelf/init_generator_spec.rb +5 -0
  85. data/spec/unit/chef/config_spec.rb +9 -10
  86. metadata +216 -93
  87. data/features/info_command.feature +0 -39
  88. data/features/open_command.feature +0 -36
  89. data/lib/berkshelf/cli_commands/test_command.rb +0 -11
  90. data/lib/berkshelf/mixin.rb +0 -10
  91. data/lib/berkshelf/mixin/path_helpers.rb +0 -30
  92. data/spec/support/knife.rb +0 -18
@@ -1,19 +1,31 @@
1
- Feature: list command
1
+ Feature: Listing cookbooks defined by a Berksfile
2
2
  As a user with a Berksfile
3
3
  I want a way to show all my cookbooks and their versions without opening my Berksfile
4
4
  So that I can be more productive
5
5
 
6
6
  Scenario: Running the list command
7
+ Given the cookbook store has the cookbooks:
8
+ | fake1 | 1.0.0 |
9
+ | fake2 | 1.0.1 |
7
10
  Given I write to "Berksfile" with:
8
11
  """
9
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
10
- cookbook 'hostsfile', '1.0.1'
12
+ cookbook 'fake1', '1.0.0'
13
+ cookbook 'fake2', '1.0.1'
11
14
  """
12
15
  When I successfully run `berks list`
13
16
  Then the output should contain:
14
17
  """
15
18
  Cookbooks installed by your Berksfile:
16
- * berkshelf-cookbook-fixture (1.0.0)
17
- * hostsfile (1.0.1)
19
+ * fake1 (1.0.0)
20
+ * fake2 (1.0.1)
21
+ """
22
+ And the exit status should be 0
23
+
24
+ Scenario: Running the list command with no sources defined
25
+ Given an empty file named "Berksfile"
26
+ When I successfully run `berks list`
27
+ Then the output should contain:
28
+ """
29
+ There are no cookbooks installed by your Berksfile
18
30
  """
19
31
  And the exit status should be 0
@@ -1,21 +1,22 @@
1
- Feature: Berksfile.lock
1
+ Feature: Creating and reading the Berkshelf lockfile
2
2
  As a user
3
3
  I want my versions to be locked even when I don't specify versions in my Berksfile
4
4
  So when I share my repository, all other developers get the same versions that I did when I installed.
5
5
 
6
6
  Scenario: Writing the Berksfile.lock
7
- Given I write to "Berksfile" with:
7
+ Given the cookbook store has the cookbooks:
8
+ | fake | 1.0.0 |
9
+ And I write to "Berksfile" with:
8
10
  """
9
- site :opscode
10
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
11
+ cookbook 'fake', '1.0.0'
11
12
  """
12
13
  When I successfully run `berks install`
13
14
  Then the file "Berksfile.lock" should contain JSON:
14
15
  """
15
16
  {
16
- "sha":"c6438d7590f4d695d8abae83ff22586ba6d3a52e",
17
+ "sha":"80396ed07db133e0192593adebb360c27eed88c2",
17
18
  "sources":{
18
- "berkshelf-cookbook-fixture":{
19
+ "fake":{
19
20
  "constraint":"= 1.0.0",
20
21
  "locked_version":"1.0.0"
21
22
  }
@@ -23,34 +24,89 @@ Feature: Berksfile.lock
23
24
  }
24
25
  """
25
26
 
27
+ Scenario: Wiring the Berksfile.lock when an old lockfile is present
28
+ Given the cookbook store has the cookbooks:
29
+ | fake | 1.0.0 |
30
+ And I write to "Berksfile" with:
31
+ """
32
+ cookbook 'fake', '1.0.0'
33
+ """
34
+ And I write to "Berksfile.lock" with:
35
+ """
36
+ cookbook 'fake', :locked_version => '1.0.0'
37
+ """
38
+ When I successfully run `berks install`
39
+ Then the output should contain "You are using the old lockfile format. Attempting to convert..."
40
+ Then the file "Berksfile.lock" should contain JSON:
41
+ """
42
+ {
43
+ "sha":"80396ed07db133e0192593adebb360c27eed88c2",
44
+ "sources":{
45
+ "fake":{
46
+ "locked_version":"1.0.0",
47
+ "constraint":"= 1.0.0"
48
+ }
49
+ }
50
+ }
51
+ """
52
+
53
+ Scenario: Writing the Berksfile.lock when an old lockfile is present and contains a full path
54
+ Given a cookbook named "fake"
55
+ And I write to "Berksfile" with:
56
+ """
57
+ cookbook 'fake', '0.0.0', path: './fake'
58
+ """
59
+ And I dynamically write to "Berksfile.lock" with:
60
+ """
61
+ cookbook 'fake', :locked_version => '0.0.0', path: '<%= File.expand_path('tmp/aruba/fake') %>'
62
+ """
63
+ When I successfully run `berks install`
64
+ Then the output should contain "You are using the old lockfile format. Attempting to convert..."
65
+ Then the file "Berksfile.lock" should contain JSON:
66
+ """
67
+ {
68
+ "sha":"4b614de85168d72fda4b255fc31796b4c474c3fc",
69
+ "sources":{
70
+ "fake":{
71
+ "locked_version":"0.0.0",
72
+ "constraint":"= 0.0.0",
73
+ "path":"./fake"
74
+ }
75
+ }
76
+ }
77
+ """
78
+
26
79
  Scenario: Installing a cookbook with dependencies
27
- Given I write to "Berksfile" with:
28
- """
29
- site :opscode
30
- cookbook 'berkshelf-cookbook-fixture', '1.0.0', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
31
- """
32
- When I successfully run `berks install`
33
- Then the file "Berksfile.lock" should contain JSON:
34
- """
35
- {
36
- "sha":"572a911ad3fda64121835ae842141b1d711f71fc",
37
- "sources":{
38
- "berkshelf-cookbook-fixture":{
39
- "constraint":"= 1.0.0",
40
- "locked_version":"1.0.0",
41
- "git": "git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
42
- "ref":"f080e8a74dcb1948780389f45cd2862091f8a0b6"
43
- },
44
- "hostsfile":{
45
- "constraint":"= 1.0.1",
46
- "locked_version":"1.0.1"
80
+ Given the cookbook store has the cookbooks:
81
+ | dep | 1.0.0 |
82
+ And the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
83
+ | dep | ~> 1.0.0 |
84
+ And I write to "Berksfile" with:
85
+ """
86
+ cookbook 'fake', '1.0.0'
87
+ """
88
+ When I successfully run `berks install`
89
+ Then the file "Berksfile.lock" should contain JSON:
90
+ """
91
+ {
92
+ "sha":"80396ed07db133e0192593adebb360c27eed88c2",
93
+ "sources":{
94
+ "fake":{
95
+ "constraint":"= 1.0.0",
96
+ "locked_version":"1.0.0"
97
+ },
98
+ "dep":{
99
+ "constraint":"~> 1.0.0",
100
+ "locked_version":"1.0.0"
101
+ }
47
102
  }
48
103
  }
49
- }
50
- """
104
+ """
51
105
 
52
106
  Scenario: Writing the Berksfile.lock with a pessimistic lock
53
- Given I write to "Berksfile" with:
107
+ Given the cookbook store has the cookbooks:
108
+ | berkshelf-cookbook-fixture | 1.0.0 |
109
+ And I write to "Berksfile" with:
54
110
  """
55
111
  site :opscode
56
112
  cookbook 'berkshelf-cookbook-fixture', '~> 1.0.0'
@@ -82,173 +138,234 @@ Feature: Berksfile.lock
82
138
  """
83
139
 
84
140
  Scenario: Updating with a Berksfile.lock with pessimistic lock
85
- Given I write to "Berksfile" with:
86
- """
87
- site :opscode
88
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
89
- """
90
- And I write to "Berksfile.lock" with:
91
- """
92
- {
93
- "sha":"3dced4fcd9c3f72b68e746190aaa1140bdc6cc3d",
94
- "sources":{
95
- "berkshelf-cookbook-fixture":{
96
- "constraint":"~> 0.1",
97
- "locked_version":"0.1.0"
141
+ Given the cookbook store has the cookbooks:
142
+ | berkshelf-cookbook-fixture | 0.2.0 |
143
+ | berkshelf-cookbook-fixture | 1.0.0 |
144
+ And I write to "Berksfile" with:
145
+ """
146
+ site :opscode
147
+ cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
148
+ """
149
+ And I write to "Berksfile.lock" with:
150
+ """
151
+ {
152
+ "sha":"3dced4fcd9c3f72b68e746190aaa1140bdc6cc3d",
153
+ "sources":{
154
+ "berkshelf-cookbook-fixture":{
155
+ "constraint":"~> 0.1",
156
+ "locked_version":"0.1.0"
157
+ }
98
158
  }
99
159
  }
100
- }
101
- """
102
- When I successfully run `berks update berkshelf-cookbook-fixture`
103
- Then the file "Berksfile.lock" should contain JSON:
104
- """
105
- {
106
- "sha":"b2714a4f9bdf500cb20267067160a0b3c1d8404c",
107
- "sources":{
108
- "berkshelf-cookbook-fixture":{
109
- "constraint":"~> 0.1",
110
- "locked_version":"0.2.0"
160
+ """
161
+ When I successfully run `berks update berkshelf-cookbook-fixture`
162
+ Then the file "Berksfile.lock" should contain JSON:
163
+ """
164
+ {
165
+ "sha":"b2714a4f9bdf500cb20267067160a0b3c1d8404c",
166
+ "sources":{
167
+ "berkshelf-cookbook-fixture":{
168
+ "constraint":"~> 0.1",
169
+ "locked_version":"0.2.0"
170
+ }
111
171
  }
112
172
  }
113
- }
114
- """
173
+ """
115
174
 
116
175
  Scenario: Updating with a Berksfile.lock with hard lock
117
- Given I write to "Berksfile" with:
118
- """
119
- site :opscode
120
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
121
- """
122
- And I write to "Berksfile.lock" with:
123
- """
124
- {
125
- "sha":"7d07c22eca03bf6da5aaf38ae81cb9a8a439c692",
126
- "sources":{
127
- "berkshelf-cookbook-fixture":{
128
- "constraint":"= 1.0.0",
129
- "locked_version":"1.0.0"
176
+ Given the cookbook store has the cookbooks:
177
+ | berkshelf-cookbook-fixture | 1.0.0 |
178
+ And I write to "Berksfile" with:
179
+ """
180
+ site :opscode
181
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
182
+ """
183
+ And I write to "Berksfile.lock" with:
184
+ """
185
+ {
186
+ "sha":"7d07c22eca03bf6da5aaf38ae81cb9a8a439c692",
187
+ "sources":{
188
+ "berkshelf-cookbook-fixture":{
189
+ "constraint":"= 1.0.0",
190
+ "locked_version":"1.0.0"
191
+ }
130
192
  }
131
193
  }
132
- }
133
- """
134
- When I successfully run `berks update berkshelf-cookbook-fixture`
135
- Then the file "Berksfile.lock" should contain JSON:
136
- """
137
- {
138
- "sha":"c6438d7590f4d695d8abae83ff22586ba6d3a52e",
139
- "sources":{
140
- "berkshelf-cookbook-fixture":{
141
- "constraint":"= 1.0.0",
142
- "locked_version":"1.0.0"
194
+ """
195
+ When I successfully run `berks update berkshelf-cookbook-fixture`
196
+ Then the file "Berksfile.lock" should contain JSON:
197
+ """
198
+ {
199
+ "sha":"c6438d7590f4d695d8abae83ff22586ba6d3a52e",
200
+ "sources":{
201
+ "berkshelf-cookbook-fixture":{
202
+ "constraint":"= 1.0.0",
203
+ "locked_version":"1.0.0"
204
+ }
143
205
  }
144
206
  }
145
- }
146
- """
207
+ """
147
208
 
148
209
  Scenario: Updating a Berksfile.lock with a git location
149
- Given I write to "Berksfile" with:
150
- """
151
- site :opscode
152
- cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', ref: '919afa0c4'
153
- """
154
- When I successfully run `berks install`
155
- Then the file "Berksfile.lock" should contain JSON:
156
- """
157
- {
158
- "sha": "b8e06c891c824b3e3481df024eb241e1c02572a6",
159
- "sources":{
160
- "berkshelf-cookbook-fixture":{
161
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
162
- "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
163
- "locked_version":"1.0.0"
210
+ Given the cookbook store has the cookbooks:
211
+ | berkshelf-cookbook-fixture | 919afa0c402089df23ebdf36637f12271b8a96b4 |
212
+ And I write to "Berksfile" with:
213
+ """
214
+ site :opscode
215
+ cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', ref: '919afa0c4'
216
+ """
217
+ When I successfully run `berks install`
218
+ Then the file "Berksfile.lock" should contain JSON:
219
+ """
220
+ {
221
+ "sha": "b8e06c891c824b3e3481df024eb241e1c02572a6",
222
+ "sources":{
223
+ "berkshelf-cookbook-fixture":{
224
+ "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
225
+ "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
226
+ "locked_version":"1.0.0"
227
+ }
164
228
  }
165
229
  }
166
- }
167
- """
230
+ """
168
231
 
169
232
  Scenario: Updating a Berksfile.lock with a git location and a branch
170
- Given I write to "Berksfile" with:
171
- """
172
- site :opscode
173
- cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', branch: 'master'
174
- """
175
- When I successfully run `berks install`
176
- Then the file "Berksfile.lock" should contain JSON:
177
- """
178
- {
179
- "sha": "310f95bb86ba76b47eef28abc621d0e8de19bbb6",
180
- "sources":{
181
- "berkshelf-cookbook-fixture":{
182
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
183
- "ref":"a97b9447cbd41a5fe58eee2026e48ccb503bd3bc",
184
- "locked_version":"1.0.0"
233
+ Given the cookbook store has the cookbooks:
234
+ | berkshelf-cookbook-fixture | master |
235
+ And I write to "Berksfile" with:
236
+ """
237
+ site :opscode
238
+ cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', branch: 'master'
239
+ """
240
+ When I successfully run `berks install`
241
+ Then the file "Berksfile.lock" should contain JSON:
242
+ """
243
+ {
244
+ "sha": "310f95bb86ba76b47eef28abc621d0e8de19bbb6",
245
+ "sources":{
246
+ "berkshelf-cookbook-fixture":{
247
+ "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
248
+ "ref":"a97b9447cbd41a5fe58eee2026e48ccb503bd3bc",
249
+ "locked_version":"1.0.0"
250
+ }
185
251
  }
186
252
  }
187
- }
188
- """
253
+ """
189
254
 
190
255
  Scenario: Updating a Berksfile.lock with a git location and a branch
191
- Given I write to "Berksfile" with:
192
- """
193
- site :opscode
194
- cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', tag: 'v0.2.0'
195
- """
196
- When I successfully run `berks install`
197
- Then the file "Berksfile.lock" should contain JSON:
198
- """
199
- {
200
- "sha": "ade51e222f569cc299f34ec1100d321f3b230c36",
201
- "sources":{
202
- "berkshelf-cookbook-fixture":{
203
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
204
- "ref":"70a527e17d91f01f031204562460ad1c17f972ee",
205
- "locked_version":"0.2.0"
256
+ Given the cookbook store has the cookbooks:
257
+ | berkshelf-cookbook-fixture | 70a527e17d91f01f031204562460ad1c17f972ee |
258
+ And I write to "Berksfile" with:
259
+ """
260
+ site :opscode
261
+ cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', tag: 'v0.2.0'
262
+ """
263
+ When I successfully run `berks install`
264
+ Then the file "Berksfile.lock" should contain JSON:
265
+ """
266
+ {
267
+ "sha": "ade51e222f569cc299f34ec1100d321f3b230c36",
268
+ "sources":{
269
+ "berkshelf-cookbook-fixture":{
270
+ "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
271
+ "ref":"70a527e17d91f01f031204562460ad1c17f972ee",
272
+ "locked_version":"0.2.0"
273
+ }
206
274
  }
207
275
  }
208
- }
209
- """
276
+ """
210
277
 
211
278
  Scenario: Updating a Berksfile.lock with a GitHub location
212
- Given I write to "Berksfile" with:
213
- """
214
- site :opscode
215
- cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', ref: '919afa0c4'
216
- """
217
- When I successfully run `berks install`
218
- Then the file "Berksfile.lock" should contain JSON:
219
- """
220
- {
221
- "sha": "3ac97aa503bcebb2b393410aebc176c3c5bed2d4",
222
- "sources":{
223
- "berkshelf-cookbook-fixture":{
224
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
225
- "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
226
- "locked_version":"1.0.0"
279
+ Given the cookbook store has the cookbooks:
280
+ | berkshelf-cookbook-fixture | 919afa0c402089df23ebdf36637f12271b8a96b4 |
281
+ And I write to "Berksfile" with:
282
+ """
283
+ site :opscode
284
+ cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', ref: '919afa0c4'
285
+ """
286
+ When I successfully run `berks install`
287
+ Then the file "Berksfile.lock" should contain JSON:
288
+ """
289
+ {
290
+ "sha": "3ac97aa503bcebb2b393410aebc176c3c5bed2d4",
291
+ "sources":{
292
+ "berkshelf-cookbook-fixture":{
293
+ "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
294
+ "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
295
+ "locked_version":"1.0.0"
296
+ }
227
297
  }
228
298
  }
229
- }
230
- """
299
+ """
300
+
301
+ Scenario: Updating a Berksfile.lock when a git location with :rel
302
+ Given I write to "Berksfile" with:
303
+ """
304
+ site :opscode
305
+ cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
306
+ """
307
+ When I successfully run `berks install`
308
+ Then the file "Berksfile.lock" should contain JSON:
309
+ """
310
+ {
311
+ "sha": "f0b5a9c0230a3ff384badb0c40af1058cde75bee",
312
+ "sources":{
313
+ "berkshelf-cookbook-fixture":{
314
+ "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
315
+ "ref":"93f5768b7d14df45e10d16c8bf6fe98ba3ff809a",
316
+ "rel":"cookbooks/berkshelf-cookbook-fixture",
317
+ "locked_version":"1.0.0"
318
+ }
319
+ }
320
+ }
321
+ """
231
322
 
232
323
  Scenario: Updating a Berksfile.lock with a path location
233
- Given I write to "Berksfile" with:
234
- """
235
- site :opscode
236
- cookbook 'fake', path: './fake'
237
- """
238
- And a cookbook named "fake"
239
- When I successfully run `berks install`
240
- Then the file "Berksfile.lock" should contain JSON:
241
- """
242
- {
243
- "sha": "42a13f91f1ba19ce8c6776fe267e74510dee27ce",
244
- "sources":{
245
- "fake":{
246
- "path":"./fake",
247
- "locked_version":"0.0.0"
324
+ Given a cookbook named "fake"
325
+ And I write to "Berksfile" with:
326
+ """
327
+ site :opscode
328
+ cookbook 'fake', path: './fake'
329
+ """
330
+ When I successfully run `berks install`
331
+ Then the file "Berksfile.lock" should contain JSON:
332
+ """
333
+ {
334
+ "sha": "42a13f91f1ba19ce8c6776fe267e74510dee27ce",
335
+ "sources":{
336
+ "fake":{
337
+ "path":"./fake",
338
+ "locked_version":"0.0.0"
339
+ }
340
+ }
341
+ }
342
+ """
343
+
344
+ Scenario: Lockfile when `metadata` is specified
345
+ Given I write to "metadata.rb" with:
346
+ """
347
+ name 'fake'
348
+ version '1.0.0'
349
+ """
350
+ And I write to "Berksfile" with:
351
+ """
352
+ site :opscode
353
+ metadata
354
+ """
355
+ When I successfully run `berks install`
356
+ Then the file "Berksfile.lock" should contain JSON:
357
+ """
358
+ {
359
+ "sha": "9e7f8da566fec49ac41c0d862cfdf728eee10568",
360
+ "sources":{
361
+ "fake":{
362
+ "path":".",
363
+ "locked_version":"1.0.0",
364
+ "constraint":"= 1.0.0"
365
+ }
248
366
  }
249
367
  }
250
- }
251
- """
368
+ """
252
369
 
253
370
  Scenario: Updating a Berksfile.lock with a different site location
254
371
  Given pending we have a reliable non-opscode site to test
@@ -271,27 +388,29 @@ Feature: Berksfile.lock
271
388
  # """
272
389
 
273
390
  Scenario: Installing when the locked version is no longer satisfied
274
- Given I write to "Berksfile" with:
275
- """
276
- site :opscode
277
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
278
- """
279
- And I successfully run `berks install`
280
- And I write to "Berksfile" with:
281
- """
282
- site :opscode
283
- cookbook 'berkshelf-cookbook-fixture', '~> 1.3.0'
284
- """
285
- When I run `berks install`
286
- Then the output should contain:
287
- """
288
- Berkshelf could not find compatible versions for cookbook 'berkshelf-cookbook-fixture':
289
- In Berksfile:
290
- berkshelf-cookbook-fixture (1.0.0)
391
+ Given the cookbook store has the cookbooks:
392
+ | berkshelf-cookbook-fixture | 1.0.0 |
393
+ Given I write to "Berksfile" with:
394
+ """
395
+ site :opscode
396
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
397
+ """
398
+ And I successfully run `berks install`
399
+ And I write to "Berksfile" with:
400
+ """
401
+ site :opscode
402
+ cookbook 'berkshelf-cookbook-fixture', '~> 1.3.0'
403
+ """
404
+ When I run `berks install`
405
+ Then the output should contain:
406
+ """
407
+ Berkshelf could not find compatible versions for cookbook 'berkshelf-cookbook-fixture':
408
+ In Berksfile:
409
+ berkshelf-cookbook-fixture (1.0.0)
291
410
 
292
- In Berksfile.lock:
293
- berkshelf-cookbook-fixture (~> 1.3.0)
411
+ In Berksfile.lock:
412
+ berkshelf-cookbook-fixture (~> 1.3.0)
294
413
 
295
- Try running `berks update berkshelf-cookbook-fixture, which will try to find 'berkshelf-cookbook-fixture' matching '~> 1.3.0'.
296
- """
297
- And the CLI should exit with the status code for error "OutdatedCookbookSource"
414
+ Try running `berks update berkshelf-cookbook-fixture, which will try to find 'berkshelf-cookbook-fixture' matching '~> 1.3.0'
415
+ """
416
+ And the CLI should exit with the status code for error "OutdatedCookbookSource"