berkshelf 5.2.0 → 8.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +19 -47
  3. data/Rakefile +14 -4
  4. data/berkshelf.gemspec +61 -40
  5. data/bin/berks +2 -2
  6. data/lib/berkshelf/api-client.rb +1 -0
  7. data/lib/berkshelf/api_client/chef_server_connection.rb +29 -0
  8. data/lib/berkshelf/api_client/connection.rb +57 -0
  9. data/lib/berkshelf/api_client/errors.rb +10 -0
  10. data/lib/berkshelf/api_client/remote_cookbook.rb +56 -0
  11. data/lib/berkshelf/api_client/version.rb +5 -0
  12. data/lib/berkshelf/api_client.rb +24 -0
  13. data/lib/berkshelf/berksfile.rb +149 -122
  14. data/lib/berkshelf/cached_cookbook.rb +127 -24
  15. data/lib/berkshelf/chef_config_compat.rb +51 -0
  16. data/lib/berkshelf/chef_repo_universe.rb +47 -0
  17. data/lib/berkshelf/cli.rb +143 -174
  18. data/lib/berkshelf/commands/shelf.rb +20 -19
  19. data/lib/berkshelf/community_rest.rb +59 -94
  20. data/lib/berkshelf/config.rb +97 -127
  21. data/lib/berkshelf/cookbook_store.rb +7 -6
  22. data/lib/berkshelf/core_ext/file.rb +1 -1
  23. data/lib/berkshelf/core_ext/file_utils.rb +4 -4
  24. data/lib/berkshelf/core_ext.rb +1 -1
  25. data/lib/berkshelf/dependency.rb +25 -32
  26. data/lib/berkshelf/downloader.rb +66 -39
  27. data/lib/berkshelf/errors.rb +23 -17
  28. data/lib/berkshelf/file_syncer.rb +24 -47
  29. data/lib/berkshelf/formatters/human.rb +7 -5
  30. data/lib/berkshelf/formatters/json.rb +6 -6
  31. data/lib/berkshelf/installer.rb +120 -111
  32. data/lib/berkshelf/location.rb +14 -14
  33. data/lib/berkshelf/locations/base.rb +1 -1
  34. data/lib/berkshelf/locations/git.rb +16 -24
  35. data/lib/berkshelf/locations/github.rb +2 -2
  36. data/lib/berkshelf/locations/path.rb +2 -2
  37. data/lib/berkshelf/lockfile.rb +326 -328
  38. data/lib/berkshelf/logger.rb +64 -1
  39. data/lib/berkshelf/mixin/git.rb +6 -5
  40. data/lib/berkshelf/packager.rb +44 -10
  41. data/lib/berkshelf/resolver/graph.rb +1 -1
  42. data/lib/berkshelf/resolver.rb +4 -4
  43. data/lib/berkshelf/ridley_compat.rb +109 -0
  44. data/lib/berkshelf/shell.rb +2 -1
  45. data/lib/berkshelf/shell_out.rb +18 -0
  46. data/lib/berkshelf/source.rb +77 -33
  47. data/lib/berkshelf/source_uri.rb +4 -4
  48. data/lib/berkshelf/ssl_policies.rb +38 -0
  49. data/lib/berkshelf/thor.rb +1 -1
  50. data/lib/berkshelf/thor_ext/hash_with_indifferent_access.rb +1 -1
  51. data/lib/berkshelf/thor_ext.rb +1 -1
  52. data/lib/berkshelf/uploader.rb +106 -70
  53. data/lib/berkshelf/validator.rb +13 -5
  54. data/lib/berkshelf/version.rb +1 -1
  55. data/lib/berkshelf/visualizer.rb +16 -11
  56. data/lib/berkshelf.rb +106 -81
  57. data/spec/config/knife.rb +4 -4
  58. data/spec/data/trusted_certs/example.crt +22 -0
  59. data/spec/fixtures/Berksfile +3 -3
  60. data/spec/fixtures/complex-cookbook-path/cookbooks/app/metadata.rb +2 -0
  61. data/spec/fixtures/complex-cookbook-path/cookbooks/jenkins/metadata.rb +2 -0
  62. data/spec/fixtures/complex-cookbook-path/cookbooks/jenkins-config/metadata.rb +4 -0
  63. data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
  64. data/spec/fixtures/cookbook-path-uploader/apt-2.3.6/metadata.rb +2 -0
  65. data/spec/fixtures/cookbook-path-uploader/build-essential-1.4.2/metadata.rb +2 -0
  66. data/spec/fixtures/cookbook-path-uploader/jenkins-2.0.3/metadata.rb +5 -0
  67. data/spec/fixtures/cookbook-path-uploader/jenkins-config-0.1.0/metadata.rb +4 -0
  68. data/spec/fixtures/cookbook-path-uploader/runit-1.5.8/metadata.rb +5 -0
  69. data/spec/fixtures/cookbook-path-uploader/yum-3.0.6/metadata.rb +2 -0
  70. data/spec/fixtures/cookbook-path-uploader/yum-epel-0.2.0/metadata.rb +3 -0
  71. data/spec/fixtures/cookbook-store/jenkins-2.0.3/metadata.rb +5 -5
  72. data/spec/fixtures/cookbook-store/jenkins-2.0.4/metadata.rb +4 -4
  73. data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
  74. data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
  75. data/spec/spec_helper.rb +56 -64
  76. data/spec/support/chef_api.rb +15 -16
  77. data/spec/support/chef_server.rb +71 -69
  78. data/spec/support/git.rb +59 -58
  79. data/spec/support/kitchen.rb +0 -14
  80. data/spec/support/matchers/file_system_matchers.rb +4 -5
  81. data/spec/support/matchers/filepath_matchers.rb +2 -2
  82. data/spec/support/path_helpers.rb +17 -17
  83. data/spec/support/shared_examples/formatter.rb +1 -1
  84. data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/attributes/default.rb +0 -0
  85. data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/files/default/file.h +0 -0
  86. data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/metadata.rb +2 -0
  87. data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/recipes/default.rb +0 -0
  88. data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/templates/default/template.erb +0 -0
  89. data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/attributes/default.rb +0 -0
  90. data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/files/default/file.h +0 -0
  91. data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/metadata.rb +2 -0
  92. data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/recipes/default.rb +0 -0
  93. data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/templates/default/template.erb +0 -0
  94. data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/attributes/default.rb +0 -0
  95. data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/files/default/file.h +0 -0
  96. data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/metadata.rb +2 -0
  97. data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/recipes/default.rb +0 -0
  98. data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/templates/default/template.erb +0 -0
  99. data/spec/unit/berkshelf/berksfile_spec.rb +84 -105
  100. data/spec/unit/berkshelf/berkshelf/api_client/chef_server_connection_spec.rb +65 -0
  101. data/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +157 -0
  102. data/spec/unit/berkshelf/berkshelf/api_client/remote_cookbook_spec.rb +23 -0
  103. data/spec/unit/berkshelf/berkshelf/api_client_spec.rb +9 -0
  104. data/spec/unit/berkshelf/cached_cookbook_spec.rb +45 -47
  105. data/spec/unit/berkshelf/chef_repo_universe_spec.rb +37 -0
  106. data/spec/unit/berkshelf/cli_spec.rb +7 -8
  107. data/spec/unit/berkshelf/community_rest_spec.rb +82 -90
  108. data/spec/unit/berkshelf/config_spec.rb +51 -22
  109. data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
  110. data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +7 -8
  111. data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
  112. data/spec/unit/berkshelf/dependency_spec.rb +48 -48
  113. data/spec/unit/berkshelf/downloader_spec.rb +191 -34
  114. data/spec/unit/berkshelf/errors_spec.rb +3 -3
  115. data/spec/unit/berkshelf/file_syncer_spec.rb +87 -87
  116. data/spec/unit/berkshelf/formatters/base_spec.rb +23 -23
  117. data/spec/unit/berkshelf/formatters/human_spec.rb +2 -2
  118. data/spec/unit/berkshelf/formatters/json_spec.rb +2 -2
  119. data/spec/unit/berkshelf/formatters/null_spec.rb +3 -3
  120. data/spec/unit/berkshelf/installer_spec.rb +8 -8
  121. data/spec/unit/berkshelf/location_spec.rb +11 -11
  122. data/spec/unit/berkshelf/locations/base_spec.rb +35 -36
  123. data/spec/unit/berkshelf/locations/git_spec.rb +90 -93
  124. data/spec/unit/berkshelf/locations/path_spec.rb +40 -41
  125. data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
  126. data/spec/unit/berkshelf/lockfile_spec.rb +205 -211
  127. data/spec/unit/berkshelf/logger_spec.rb +3 -3
  128. data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -5
  129. data/spec/unit/berkshelf/packager_spec.rb +2 -2
  130. data/spec/unit/berkshelf/resolver/graph_spec.rb +10 -8
  131. data/spec/unit/berkshelf/resolver_spec.rb +17 -17
  132. data/spec/unit/berkshelf/ridley_compat_spec.rb +16 -0
  133. data/spec/unit/berkshelf/shell_spec.rb +34 -34
  134. data/spec/unit/berkshelf/source_spec.rb +186 -20
  135. data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
  136. data/spec/unit/berkshelf/ssl_policies_spec.rb +86 -0
  137. data/spec/unit/berkshelf/uploader_spec.rb +146 -64
  138. data/spec/unit/berkshelf/validator_spec.rb +23 -16
  139. data/spec/unit/berkshelf/visualizer_spec.rb +24 -15
  140. data/spec/unit/berkshelf_spec.rb +18 -18
  141. metadata +138 -289
  142. data/.gitignore +0 -29
  143. data/.travis.yml +0 -64
  144. data/CHANGELOG.legacy.md +0 -307
  145. data/CHANGELOG.md +0 -1358
  146. data/CONTRIBUTING.md +0 -64
  147. data/Gemfile.lock +0 -399
  148. data/Guardfile +0 -23
  149. data/PLUGINS.md +0 -25
  150. data/README.md +0 -70
  151. data/Thorfile +0 -61
  152. data/appveyor.yml +0 -31
  153. data/docs/berkshelf_for_newcomers.md +0 -65
  154. data/features/berksfile.feature +0 -46
  155. data/features/commands/apply.feature +0 -41
  156. data/features/commands/contingent.feature +0 -48
  157. data/features/commands/cookbook.feature +0 -35
  158. data/features/commands/info.feature +0 -99
  159. data/features/commands/init.feature +0 -27
  160. data/features/commands/install.feature +0 -636
  161. data/features/commands/list.feature +0 -78
  162. data/features/commands/outdated.feature +0 -130
  163. data/features/commands/package.feature +0 -17
  164. data/features/commands/search.feature +0 -17
  165. data/features/commands/shelf/list.feature +0 -32
  166. data/features/commands/shelf/show.feature +0 -143
  167. data/features/commands/shelf/uninstall.feature +0 -96
  168. data/features/commands/show.feature +0 -83
  169. data/features/commands/update.feature +0 -142
  170. data/features/commands/upload.feature +0 -426
  171. data/features/commands/vendor.feature +0 -111
  172. data/features/commands/verify.feature +0 -29
  173. data/features/commands/viz.feature +0 -66
  174. data/features/community_site.feature +0 -37
  175. data/features/config.feature +0 -111
  176. data/features/help.feature +0 -11
  177. data/features/json_formatter.feature +0 -161
  178. data/features/lifecycle.feature +0 -378
  179. data/features/lockfile.feature +0 -378
  180. data/features/step_definitions/berksfile_steps.rb +0 -39
  181. data/features/step_definitions/chef/config_steps.rb +0 -12
  182. data/features/step_definitions/chef_server_steps.rb +0 -60
  183. data/features/step_definitions/cli_steps.rb +0 -18
  184. data/features/step_definitions/config_steps.rb +0 -46
  185. data/features/step_definitions/environment_steps.rb +0 -7
  186. data/features/step_definitions/filesystem_steps.rb +0 -269
  187. data/features/step_definitions/gem_steps.rb +0 -13
  188. data/features/step_definitions/json_steps.rb +0 -23
  189. data/features/step_definitions/utility_steps.rb +0 -11
  190. data/features/support/aruba.rb +0 -12
  191. data/features/support/env.rb +0 -82
  192. data/generator_files/Berksfile.erb +0 -11
  193. data/generator_files/CHANGELOG.md.erb +0 -3
  194. data/generator_files/Gemfile.erb +0 -8
  195. data/generator_files/README.md.erb +0 -42
  196. data/generator_files/Thorfile.erb +0 -11
  197. data/generator_files/Vagrantfile.erb +0 -117
  198. data/generator_files/chefignore +0 -94
  199. data/generator_files/default_recipe.erb +0 -6
  200. data/generator_files/default_test.rb.erb +0 -11
  201. data/generator_files/gitignore.erb +0 -23
  202. data/generator_files/helpers.rb.erb +0 -7
  203. data/generator_files/licenses/apachev2.erb +0 -13
  204. data/generator_files/licenses/gplv2.erb +0 -15
  205. data/generator_files/licenses/gplv3.erb +0 -14
  206. data/generator_files/licenses/mit.erb +0 -20
  207. data/generator_files/licenses/reserved.erb +0 -3
  208. data/generator_files/metadata.rb.erb +0 -11
  209. data/lib/berkshelf/base_generator.rb +0 -43
  210. data/lib/berkshelf/commands/test_command.rb +0 -13
  211. data/lib/berkshelf/cookbook_generator.rb +0 -133
  212. data/lib/berkshelf/init_generator.rb +0 -195
  213. data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
  214. data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
  215. data/spec/unit/berkshelf/cookbook_generator_spec.rb +0 -110
  216. data/spec/unit/berkshelf/init_generator_spec.rb +0 -263
@@ -1,378 +0,0 @@
1
- @api_server
2
- Feature: Creating and reading the Berkshelf lockfile
3
- Background:
4
- * the cookbook store has the cookbooks:
5
- | fake | 0.1.0 |
6
- | fake | 0.2.0 |
7
- | fake | 1.0.0 |
8
- * the cookbook store has the git cookbooks:
9
- | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
10
- | berkshelf-cookbook-fixture | 1.0.0 | 919afa0c402089df23ebdf36637f12271b8a96b4 |
11
- | berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
12
- | berkshelf-cookbook-fixture | 1.0.0 | 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a |
13
-
14
- Scenario: Writing the Berksfile.lock
15
- Given I have a Berksfile pointing at the local Berkshelf API with:
16
- """
17
- cookbook 'fake', '1.0.0'
18
- """
19
- When I successfully run `berks install`
20
- Then the file "Berksfile.lock" should contain:
21
- """
22
- DEPENDENCIES
23
- fake (= 1.0.0)
24
-
25
- GRAPH
26
- fake (1.0.0)
27
- """
28
-
29
- Scenario: Writing the Berksfile.lock when a 2.0 lockfile is present
30
- Given I have a Berksfile pointing at the local Berkshelf API with:
31
- """
32
- cookbook 'fake', '1.0.0'
33
- """
34
- And I write to "Berksfile.lock" with:
35
- """
36
- {
37
- "sources": {
38
- "fake": {
39
- "locked_version": "1.0.0"
40
- }
41
- }
42
- }
43
- """
44
- When I successfully run `berks install`
45
- Then the output should contain:
46
- """
47
- It looks like you are using an older version of the lockfile.
48
- """
49
- And the file "Berksfile.lock" should contain:
50
- """
51
- DEPENDENCIES
52
- fake (= 1.0.0)
53
-
54
- GRAPH
55
- fake (1.0.0)
56
- """
57
-
58
- Scenario: Reading the Berksfile.lock when it contains an invalid path location
59
- Given I have a Berksfile pointing at the local Berkshelf API with:
60
- """
61
- cookbook 'fake'
62
- """
63
- And I write to "Berksfile.lock" with:
64
- """
65
- DEPENDENCIES
66
- non-existent (~> 0.1)
67
- path: /this/path/does/not/exist
68
- """
69
- When I successfully run `berks install`
70
- And the file "Berksfile.lock" should contain:
71
- """
72
- DEPENDENCIES
73
- fake
74
-
75
- GRAPH
76
- fake (1.0.0)
77
- """
78
-
79
- Scenario: Installing a cookbook with dependencies
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 have a Berksfile pointing at the local Berkshelf API with:
85
- """
86
- cookbook 'fake', '1.0.0'
87
- """
88
- When I successfully run `berks install`
89
- Then the file "Berksfile.lock" should contain:
90
- """
91
- DEPENDENCIES
92
- fake (= 1.0.0)
93
-
94
- GRAPH
95
- dep (1.0.0)
96
- fake (1.0.0)
97
- dep (~> 1.0.0)
98
- """
99
-
100
- Scenario: Writing the Berksfile.lock with a pessimistic lock
101
- And I have a Berksfile pointing at the local Berkshelf API with:
102
- """
103
- cookbook 'fake', '~> 1.0.0'
104
- """
105
- And I write to "Berksfile.lock" with:
106
- """
107
- DEPENDENCIES
108
- fake (~> 1.0.0)
109
-
110
- GRAPH
111
- fake (1.0.0)
112
- """
113
- When I successfully run `berks install`
114
- Then the file "Berksfile.lock" should contain:
115
- """
116
- DEPENDENCIES
117
- fake (~> 1.0.0)
118
-
119
- GRAPH
120
- fake (1.0.0)
121
- """
122
-
123
- Scenario: Updating with a Berksfile.lock with pessimistic lock
124
- Given I have a Berksfile pointing at the local Berkshelf API with:
125
- """
126
- cookbook 'fake', '~> 0.1'
127
- """
128
- And I write to "Berksfile.lock" with:
129
- """
130
- DEPENDENCIES
131
- fake (~> 0.1)
132
-
133
- GRAPH
134
- fake (0.1.0)
135
- """
136
- When I successfully run `berks update fake`
137
- Then the file "Berksfile.lock" should contain:
138
- """
139
- DEPENDENCIES
140
- fake (~> 0.1)
141
-
142
- GRAPH
143
- fake (0.2.0)
144
- """
145
-
146
- Scenario: Updating with a Berksfile.lock with hard lock
147
- And I have a Berksfile pointing at the local Berkshelf API with:
148
- """
149
- cookbook 'fake', '0.1.0'
150
- """
151
- And I write to "Berksfile.lock" with:
152
- """
153
- DEPENDENCIES
154
- fake (= 0.1.0)
155
-
156
- GRAPH
157
- fake (0.1.0)
158
- """
159
- When I successfully run `berks update fake`
160
- Then the file "Berksfile.lock" should contain:
161
- """
162
- DEPENDENCIES
163
- fake (= 0.1.0)
164
-
165
- GRAPH
166
- fake (0.1.0)
167
- """
168
-
169
- Scenario: Updating a Berksfile.lock with a git location
170
- Given I have a Berksfile pointing at the local Berkshelf API with:
171
- """
172
- cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', ref: '919afa0c4'
173
- """
174
- When I successfully run `berks install`
175
- Then the file "Berksfile.lock" should contain:
176
- """
177
- DEPENDENCIES
178
- berkshelf-cookbook-fixture
179
- git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
180
- revision: 919afa0c402089df23ebdf36637f12271b8a96b4
181
- ref: 919afa0
182
-
183
- GRAPH
184
- berkshelf-cookbook-fixture (1.0.0)
185
- """
186
-
187
- Scenario: Updating a Berksfile.lock with a git location and a branch
188
- Given I have a Berksfile pointing at the local Berkshelf API with:
189
- """
190
- cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', branch: 'master'
191
- """
192
- When I successfully run `berks install`
193
- Then the file "Berksfile.lock" should contain:
194
- """
195
- DEPENDENCIES
196
- berkshelf-cookbook-fixture
197
- git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
198
- revision: a97b9447cbd41a5fe58eee2026e48ccb503bd3bc
199
- branch: master
200
-
201
- GRAPH
202
- berkshelf-cookbook-fixture (1.0.0)
203
- """
204
-
205
- Scenario: Updating a Berksfile.lock with a git location and a tag
206
- Given I have a Berksfile pointing at the local Berkshelf API with:
207
- """
208
- cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', tag: 'v0.2.0'
209
- """
210
- When I successfully run `berks install`
211
- Then the file "Berksfile.lock" should contain:
212
- """
213
- DEPENDENCIES
214
- berkshelf-cookbook-fixture
215
- git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
216
- revision: 70a527e17d91f01f031204562460ad1c17f972ee
217
- tag: v0.2.0
218
-
219
- GRAPH
220
- berkshelf-cookbook-fixture (0.2.0)
221
- """
222
-
223
- Scenario: Updating a Berksfile.lock with a GitHub location
224
- Given I have a Berksfile pointing at the local Berkshelf API with:
225
- """
226
- cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', ref: '919afa0c4'
227
- """
228
- When I successfully run `berks install`
229
- Then the file "Berksfile.lock" should contain:
230
- """
231
- DEPENDENCIES
232
- berkshelf-cookbook-fixture
233
- git: https://github.com/RiotGames/berkshelf-cookbook-fixture.git
234
- revision: 919afa0c402089df23ebdf36637f12271b8a96b4
235
- ref: 919afa0
236
-
237
- GRAPH
238
- berkshelf-cookbook-fixture (1.0.0)
239
- """
240
-
241
- Scenario: Updating a Berksfile.lock when a git location with :rel
242
- Given I have a Berksfile pointing at the local Berkshelf API with:
243
- """
244
- cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
245
- """
246
- When I successfully run `berks install`
247
- Then the file "Berksfile.lock" should contain:
248
- """
249
- DEPENDENCIES
250
- berkshelf-cookbook-fixture
251
- git: https://github.com/RiotGames/berkshelf-cookbook-fixture.git
252
- revision: 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a
253
- branch: rel
254
- rel: cookbooks/berkshelf-cookbook-fixture
255
-
256
- GRAPH
257
- berkshelf-cookbook-fixture (1.0.0)
258
- """
259
-
260
- Scenario: Updating a Berksfile.lock with a path location
261
- Given a cookbook named "fake"
262
- And I have a Berksfile pointing at the local Berkshelf API with:
263
- """
264
- cookbook 'fake', path: './fake'
265
- """
266
- When I successfully run `berks install`
267
- Then the file "Berksfile.lock" should contain:
268
- """
269
- DEPENDENCIES
270
- fake
271
- path: fake
272
-
273
- GRAPH
274
- fake (0.0.0)
275
- """
276
-
277
- Scenario: Installing a Berksfile with a metadata location
278
- Given a cookbook named "fake"
279
- And I cd to "fake"
280
- And I have a Berksfile pointing at the local Berkshelf API with:
281
- """
282
- metadata
283
- """
284
- When I successfully run `berks install`
285
- Then the file "Berksfile.lock" should contain:
286
- """
287
- DEPENDENCIES
288
- fake
289
- path: .
290
- metadata: true
291
-
292
- GRAPH
293
- fake (0.0.0)
294
- """
295
-
296
- Scenario: Installing a Berksfile with a locked metadata location
297
- Given a cookbook named "fake"
298
- And I cd to "fake"
299
- And I have a Berksfile pointing at the local Berkshelf API with:
300
- """
301
- metadata
302
- """
303
- And I write to "Berksfile.lock" with:
304
- """
305
- DEPENDENCIES
306
- fake
307
- path: .
308
- metadata: true
309
-
310
- GRAPH
311
- fake (0.0.0)
312
- """
313
- When I successfully run `berks install`
314
- Then the file "Berksfile.lock" should contain:
315
- """
316
- DEPENDENCIES
317
- fake
318
- path: .
319
- metadata: true
320
-
321
- GRAPH
322
- fake (0.0.0)
323
- """
324
-
325
- Scenario: Installing when the locked version is no longer satisfied
326
- Given I have a Berksfile pointing at the local Berkshelf API with:
327
- """
328
- cookbook 'fake', '~> 1.3.0'
329
- """
330
- And I write to "Berksfile.lock" with:
331
- """
332
- DEPENDENCIES
333
- fake (~> 1.3.0)
334
-
335
- GRAPH
336
- fake (1.0.0)
337
- """
338
- When I run `berks install`
339
- Then the output should contain:
340
- """
341
- Berkshelf could not find compatible versions for cookbook 'fake':
342
- In Berksfile:
343
- fake (~> 1.3.0)
344
-
345
- In Berksfile.lock:
346
- fake (1.0.0)
347
-
348
- Try running `berks update fake`, which will try to find 'fake' matching '~> 1.3.0'
349
- """
350
- And the exit status should be "OutdatedDependency"
351
-
352
- Scenario: Installing when the Lockfile is empty
353
- Given I have a Berksfile pointing at the local Berkshelf API with:
354
- """
355
- cookbook 'fake', '1.0.0'
356
- """
357
- And an empty file named "Berksfile.lock"
358
- When I successfully run `berks install`
359
- Then the output should contain:
360
- """
361
- Using fake (1.0.0)
362
- """
363
-
364
- Scenario: Installing when the Lockfile is in a bad state
365
- Given I have a Berksfile pointing at the local Berkshelf API with:
366
- """
367
- cookbook 'fake', '1.0.0'
368
- """
369
- Given I write to "Berksfile.lock" with:
370
- """
371
- this is totally not valid
372
- """
373
- When I run `berks install`
374
- Then the output should contain:
375
- """
376
- Error reading the Berkshelf lockfile:
377
- """
378
- And the exit status should be "LockfileParserError"
@@ -1,39 +0,0 @@
1
- Given /I have a Berksfile pointing at the community API endpoint with:/ do |content|
2
- steps %Q{
3
- Given a file named "Berksfile" with:
4
- """
5
- source '#{Berkshelf::Berksfile::DEFAULT_API_URL}'
6
-
7
- #{content}
8
- """
9
- }
10
- end
11
-
12
- Given /^I have a Berksfile pointing at the local Berkshelf API$/ do
13
- steps %Q{
14
- Given I have a Berksfile pointing at the local Berkshelf API with:
15
- """
16
- """
17
- }
18
- end
19
-
20
- Given /^I have a Berksfile pointing at the local Berkshelf API with:$/ do |content|
21
- steps %Q{
22
- Given I have a Berksfile at "." pointing at the local Berkshelf API with:
23
- """
24
- #{content}
25
- """
26
- }
27
- end
28
-
29
- Given /^I have a Berksfile at "(.+)" pointing at the local Berkshelf API with:$/ do |path, content|
30
- steps %Q{
31
- Given a directory named "#{path}"
32
- And a file named "#{path}/Berksfile" with:
33
- """
34
- source 'http://127.0.0.1:#{BERKS_API_PORT}'
35
-
36
- #{content}
37
- """
38
- }
39
- end
@@ -1,12 +0,0 @@
1
- Given(/^I do not have a Berkshelf config$/) do
2
- FileUtils.rm_f(ENV['BERKSHELF_CONFIG'])
3
- end
4
-
5
- Given /^I do not have a Chef config$/ do
6
- path = tmp_path.join('knife.rb').to_s
7
- Berkshelf.chef_config = Ridley::Chef::Config.new(path)
8
- Berkshelf.chef_config.save
9
-
10
- ENV['BERKSHELF_CHEF_CONFIG'] = path
11
- set_environment_variable 'BERKSHELF_CHEF_CONFIG', path
12
- end
@@ -1,60 +0,0 @@
1
- World(Berkshelf::RSpec::ChefServer)
2
-
3
- Given(/^the Chef Server is empty$/) do
4
- Berkshelf::RSpec::ChefServer.reset!
5
- end
6
-
7
- Given /^the Chef Server has cookbooks:$/ do |cookbooks|
8
- cookbooks.raw.each do |name, version, dependencies|
9
- metadata = []
10
- metadata << "name '#{name}'"
11
- metadata << "version '#{version}'"
12
- dependencies.to_s.split(',').map { |d| d.split(' ', 2) }.each do |(name, constraint)|
13
- metadata << "depends '#{name}', '#{constraint}'"
14
- end
15
-
16
- chef_cookbook(name, { 'metadata.rb' => metadata.join("\n") })
17
- end
18
- end
19
-
20
- Given /^the Chef Server has frozen cookbooks:$/ do |cookbooks|
21
- cookbooks.raw.each do |name, version|
22
- chef_cookbook(name, { 'metadata.rb' => "version '#{version}'", frozen: true })
23
- end
24
- end
25
-
26
- Given(/^the Chef Server has an environment named "(.*?)"$/) do |name|
27
- chef_environment(name, { 'description' => 'This is an environment' })
28
- end
29
-
30
- Given(/^the Chef Server does not have an environment named "(.*?)"$/) do |name|
31
- if chef_server.data_store.exists?(['organizations', 'chef', 'environments', name])
32
- chef_server.data_store.delete(['organizations', 'chef', 'environments', name])
33
- end
34
- end
35
-
36
- Then /^the Chef Server should have the cookbooks:$/ do |cookbooks|
37
- list = chef_cookbooks
38
- cookbooks.raw.each do |name, version|
39
- expect(list.keys).to include(name)
40
- expect(list[name]).to include(version) unless version.nil?
41
- end
42
- end
43
-
44
- Then /^the Chef Server should not have the cookbooks:$/ do |cookbooks|
45
- list = chef_cookbooks
46
- cookbooks.raw.each do |name, version|
47
- unless version.nil?
48
- expect(list.keys).to_not include(name)
49
- else
50
- expect(list[name] || []).to_not include(version)
51
- end
52
- end
53
- end
54
-
55
- Then(/^the version locks in the "(.*?)" environment should be:$/) do |name, locks|
56
- list = chef_environment_locks(name)
57
- locks.raw.each do |cookbook, version|
58
- expect(list[cookbook]).to eq(version)
59
- end
60
- end
@@ -1,18 +0,0 @@
1
- Then /^the exit status should be "(.+)"$/ do |name|
2
- error = name.split('::').reduce(Berkshelf) { |klass, id| klass.const_get(id) }
3
- expect(last_command_started).to have_exit_status(error.status_code)
4
- end
5
-
6
- Then /^the results should have the cookbooks:$/ do |cookbooks|
7
- list = last_command_started.stdout
8
- cookbooks.split("\n").each do |cookbook|
9
- expect(list).to include(cookbook)
10
- end
11
- end
12
-
13
- Then /^the results should each start with "(.+)"$/ do |prefix|
14
- list = last_command_started.stdout
15
- list.split("\n").each do |cookbook|
16
- expect(cookbook).to start_with(prefix)
17
- end
18
- end
@@ -1,46 +0,0 @@
1
- require 'tempfile'
2
-
3
- Given /^I already have a Berkshelf config file$/ do
4
- path = Tempfile.new('berkshelf').path
5
- config = Berkshelf::Config.new(path)
6
- config.save
7
-
8
- Berkshelf.config = config
9
-
10
- ENV['BERKSHELF_CONFIG'] = path
11
- set_environment_variable 'BERKSHELF_CONFIG', path
12
- end
13
-
14
- Given /^I have a Berkshelf config file containing:$/ do |contents|
15
- path = Berkshelf.config.path
16
- FileUtils.mkdir_p(Pathname.new(path).dirname.to_s)
17
-
18
- File.open(path, 'w+') { |f| f.write(contents) }
19
-
20
- Berkshelf.config = Berkshelf::Config.from_file(path)
21
- end
22
-
23
- Then /^a Berkshelf config file should exist and contain:$/ do |table|
24
- # Have to reload the config...
25
- Berkshelf.config.reload
26
-
27
- check_file_presence([Berkshelf.config.path], true)
28
-
29
- table.raw.each do |key, value|
30
- if value == "BOOLEAN[true]"
31
- value = true
32
- end
33
- expect(Berkshelf.config[key]).to eq(value)
34
- end
35
- end
36
-
37
- Then /^a Berkshelf config file should exist at "(.+)" and contain:$/ do |path, table|
38
- check_file_presence([path], true)
39
-
40
- path = File.join(@dirs.first, path)
41
- Berkshelf.config = Berkshelf::Config.from_file(path)
42
-
43
- table.raw.each do |key, value|
44
- expect(Berkshelf.config[key]).to eq(value)
45
- end
46
- end
@@ -1,7 +0,0 @@
1
- Given /^the environment variable (.+) is nil$/ do |variable|
2
- set_environment_variable(variable, nil)
3
- end
4
-
5
- Given /^the environment variable (.+) is "(.+)"$/ do |variable, value|
6
- set_environment_variable(variable, value)
7
- end