berkshelf 7.0.7 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/Rakefile +4 -4
  4. data/berkshelf.gemspec +10 -12
  5. data/bin/berks +5 -0
  6. data/lib/berkshelf.rb +8 -9
  7. data/lib/berkshelf/api_client/chef_server_connection.rb +3 -2
  8. data/lib/berkshelf/api_client/connection.rb +1 -1
  9. data/lib/berkshelf/api_client/remote_cookbook.rb +1 -1
  10. data/lib/berkshelf/berksfile.rb +41 -39
  11. data/lib/berkshelf/cached_cookbook.rb +6 -4
  12. data/lib/berkshelf/chef_config_compat.rb +2 -1
  13. data/lib/berkshelf/chef_repo_universe.rb +6 -4
  14. data/lib/berkshelf/cli.rb +6 -6
  15. data/lib/berkshelf/commands/shelf.rb +1 -1
  16. data/lib/berkshelf/community_rest.rb +6 -6
  17. data/lib/berkshelf/config.rb +3 -3
  18. data/lib/berkshelf/cookbook_store.rb +2 -4
  19. data/lib/berkshelf/core_ext.rb +1 -1
  20. data/lib/berkshelf/core_ext/file_utils.rb +3 -3
  21. data/lib/berkshelf/dependency.rb +1 -1
  22. data/lib/berkshelf/downloader.rb +9 -6
  23. data/lib/berkshelf/errors.rb +5 -2
  24. data/lib/berkshelf/file_syncer.rb +7 -12
  25. data/lib/berkshelf/formatters/human.rb +1 -1
  26. data/lib/berkshelf/formatters/json.rb +4 -4
  27. data/lib/berkshelf/installer.rb +1 -1
  28. data/lib/berkshelf/location.rb +3 -3
  29. data/lib/berkshelf/locations/git.rb +6 -12
  30. data/lib/berkshelf/lockfile.rb +14 -14
  31. data/lib/berkshelf/logger.rb +4 -2
  32. data/lib/berkshelf/mixin/git.rb +3 -3
  33. data/lib/berkshelf/packager.rb +5 -7
  34. data/lib/berkshelf/resolver.rb +1 -1
  35. data/lib/berkshelf/ridley_compat.rb +1 -1
  36. data/lib/berkshelf/shell.rb +2 -1
  37. data/lib/berkshelf/shell_out.rb +4 -3
  38. data/lib/berkshelf/source.rb +8 -7
  39. data/lib/berkshelf/source_uri.rb +1 -1
  40. data/lib/berkshelf/ssl_policies.rb +5 -9
  41. data/lib/berkshelf/thor.rb +1 -1
  42. data/lib/berkshelf/thor_ext.rb +1 -1
  43. data/lib/berkshelf/uploader.rb +11 -9
  44. data/lib/berkshelf/validator.rb +2 -8
  45. data/lib/berkshelf/version.rb +1 -1
  46. data/lib/berkshelf/visualizer.rb +3 -3
  47. data/spec/config/knife.rb +1 -1
  48. data/spec/spec_helper.rb +1 -1
  49. data/spec/support/chef_server.rb +2 -2
  50. data/spec/support/git.rb +18 -18
  51. data/spec/support/path_helpers.rb +4 -4
  52. data/spec/unit/berkshelf/berksfile_spec.rb +7 -7
  53. data/spec/unit/berkshelf/cli_spec.rb +1 -2
  54. data/spec/unit/berkshelf/community_rest_spec.rb +1 -1
  55. data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +2 -2
  56. data/spec/unit/berkshelf/dependency_spec.rb +5 -5
  57. data/spec/unit/berkshelf/downloader_spec.rb +4 -8
  58. data/spec/unit/berkshelf/locations/base_spec.rb +1 -2
  59. data/spec/unit/berkshelf/locations/git_spec.rb +2 -5
  60. data/spec/unit/berkshelf/locations/path_spec.rb +1 -2
  61. data/spec/unit/berkshelf/lockfile_spec.rb +9 -18
  62. data/spec/unit/berkshelf/ridley_compat_spec.rb +2 -2
  63. data/spec/unit/berkshelf/source_spec.rb +30 -19
  64. data/spec/unit/berkshelf/ssl_policies_spec.rb +3 -6
  65. data/spec/unit/berkshelf/uploader_spec.rb +6 -10
  66. data/spec/unit/berkshelf/validator_spec.rb +0 -13
  67. metadata +39 -193
  68. data/.github/lock.yml +0 -1
  69. data/.gitignore +0 -30
  70. data/.rubocop.yml +0 -12
  71. data/.travis.yml +0 -73
  72. data/CHANGELOG.legacy.md +0 -307
  73. data/CHANGELOG.md +0 -1589
  74. data/CONTRIBUTING.md +0 -68
  75. data/Gemfile.lock +0 -292
  76. data/PLUGINS.md +0 -25
  77. data/README.md +0 -72
  78. data/Thorfile +0 -61
  79. data/appveyor.yml +0 -31
  80. data/docs/berkshelf_for_newcomers.md +0 -64
  81. data/features/artifactory.feature +0 -70
  82. data/features/berksfile.feature +0 -46
  83. data/features/commands/apply.feature +0 -41
  84. data/features/commands/contingent.feature +0 -47
  85. data/features/commands/info.feature +0 -141
  86. data/features/commands/install.feature +0 -646
  87. data/features/commands/list.feature +0 -78
  88. data/features/commands/outdated.feature +0 -176
  89. data/features/commands/package.feature +0 -17
  90. data/features/commands/search.feature +0 -17
  91. data/features/commands/shelf/list.feature +0 -32
  92. data/features/commands/shelf/show.feature +0 -113
  93. data/features/commands/shelf/uninstall.feature +0 -96
  94. data/features/commands/show.feature +0 -83
  95. data/features/commands/update.feature +0 -142
  96. data/features/commands/upload.feature +0 -499
  97. data/features/commands/vendor.feature +0 -154
  98. data/features/commands/verify.feature +0 -29
  99. data/features/commands/viz.feature +0 -66
  100. data/features/community_site.feature +0 -37
  101. data/features/help.feature +0 -11
  102. data/features/json_formatter.feature +0 -158
  103. data/features/lifecycle.feature +0 -378
  104. data/features/lockfile.feature +0 -378
  105. data/features/step_definitions/berksfile_steps.rb +0 -54
  106. data/features/step_definitions/chef/config_steps.rb +0 -12
  107. data/features/step_definitions/chef_server_steps.rb +0 -60
  108. data/features/step_definitions/cli_steps.rb +0 -18
  109. data/features/step_definitions/config_steps.rb +0 -46
  110. data/features/step_definitions/environment_steps.rb +0 -11
  111. data/features/step_definitions/filesystem_steps.rb +0 -286
  112. data/features/step_definitions/gem_steps.rb +0 -13
  113. data/features/step_definitions/json_steps.rb +0 -29
  114. data/features/step_definitions/utility_steps.rb +0 -11
  115. data/features/support/aruba.rb +0 -12
  116. data/features/support/env.rb +0 -77
  117. data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
  118. data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
@@ -1,54 +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
40
-
41
- Given /I have a Berksfile pointing at an( authenticated)? Artifactory server with:/ do |authenticated, content|
42
- if ENV["TEST_BERKSHELF_ARTIFACTORY"]
43
- steps %Q{
44
- Given a file named "Berksfile" with:
45
- """
46
- source artifactory: '#{ENV['TEST_BERKSHELF_ARTIFACTORY']}'#{authenticated ? ", api_key: '#{ENV['TEST_BERKSHELF_ARTIFACTORY_API_KEY']}'" : ''}
47
-
48
- #{content}
49
- """
50
- }
51
- else
52
- skip_this_scenario
53
- end
54
- 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 |(dep_name, constraint)|
13
- metadata << "depends '#{dep_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,11 +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
8
-
9
- Given /^the environment variable (.+) is \$TEST_BERKSHELF_ARTIFACTORY_API_KEY$/ do |variable|
10
- set_environment_variable(variable, ENV["TEST_BERKSHELF_ARTIFACTORY_API_KEY"])
11
- end
@@ -1,286 +0,0 @@
1
- require "aruba/api"
2
-
3
- World(Aruba::Api)
4
- World(Berkshelf::RSpec::ChefAPI)
5
- World(Berkshelf::RSpec::FileSystemMatchers)
6
-
7
- Given /^a cookbook named "(.*?)"$/ do |name|
8
- create_directory(name)
9
- write_file(File.join(name, "metadata.rb"), "name '#{name}'")
10
- end
11
-
12
- Given /^the cookbook "(.*?)" has the file "(.*?)" with:$/ do |cookbook_name, file_name, content|
13
- write_file(::File.join(cookbook_name, file_name), content)
14
- end
15
-
16
- Given /^the cookbook store has the cookbooks:$/ do |cookbooks|
17
- cookbooks.raw.each do |name, version, license|
18
- generate_cookbook(cookbook_store.storage_path, name, version, license: license)
19
- end
20
- end
21
-
22
- Given /^the cookbook store has the git cookbooks:$/ do |cookbooks|
23
- cookbooks.raw.each do |name, version, sha|
24
- folder = "#{name}-#{sha}"
25
- metadata = File.join(folder, "metadata.rb")
26
-
27
- create_directory(folder)
28
- write_file(metadata, [
29
- "name '#{name}'",
30
- "version '#{version}'",
31
- ].join("\n"))
32
- end
33
- end
34
-
35
- Given /^the cookbook store contains a cookbook "(.*?)" "(.*?)" with dependencies:$/ do |name, version, dependencies|
36
- generate_cookbook(cookbook_store.storage_path, name, version, dependencies: dependencies.raw)
37
- end
38
-
39
- Given(/^the cookbook store cookbook "(.*?)" "(.*?)" is vendored without a metadata.rb$/) do |name, version|
40
- cookbook_path = File.join(cookbook_store.storage_path, "#{name}-#{version}")
41
- cookbook = Berkshelf::CachedCookbook.from_path(cookbook_path)
42
- cookbook.compile_metadata()
43
- metadata_file = File.join(cookbook_path, "metadata.rb")
44
- File.unlink(metadata_file) if File.file?(metadata_file)
45
- end
46
-
47
- Given(/^the cookbook store cookbook "(.*?)" "(.*?)" is vendored with a metadata.rb$/) do |name, version|
48
- cookbook_path = File.join(cookbook_store.storage_path, "#{name}-#{version}")
49
- cookbook = Berkshelf::CachedCookbook.from_path(cookbook_path)
50
- cookbook.compile_metadata()
51
- metadata_file = File.join(cookbook_path, "metadata.rb")
52
- raise "internal error, fixture cookbook should have a metadata.rb" unless File.file?(metadata_file)
53
- end
54
-
55
- Given(/^the cookbook store is empty$/) do
56
- Berkshelf::CookbookStore.instance.clean!
57
- end
58
-
59
- Then /^the cookbook store should have the cookbooks:$/ do |cookbooks|
60
- cookbooks.raw.each do |name, version|
61
- expect(cookbook_store.storage_path).to have_structure {
62
- directory "#{name}-#{version}" do
63
- file "metadata.{rb,json}" do
64
- contains version
65
- end
66
- end
67
- }
68
- end
69
- end
70
-
71
- Then /^the cookbook store should have the git cookbooks:$/ do |cookbooks|
72
- cookbooks.raw.each do |name, version, sha1|
73
- expect(cookbook_store.storage_path).to have_structure {
74
- directory "#{name}-#{sha1}" do
75
- file "metadata.{rb,json}" do
76
- contains version
77
- end
78
- end
79
- }
80
- end
81
- end
82
-
83
- Then /^the cookbook store should not have the cookbooks:$/ do |cookbooks|
84
- cookbooks.raw.each do |name, version|
85
- expect(cookbook_store.storage_path).to_not have_structure {
86
- directory "#{name}-#{version}"
87
- }
88
- end
89
- end
90
-
91
- Then /^I should have a new cookbook skeleton "(.*?)"$/ do |name|
92
- cb_path = Pathname.new(current_dir).join(name)
93
- expect(cb_path).to have_structure {
94
- directory "attributes"
95
- directory "files" do
96
- directory "default"
97
- end
98
- directory "libraries"
99
- directory "providers"
100
- directory "recipes" do
101
- file "default.rb"
102
- end
103
- directory "resources"
104
- directory "templates" do
105
- directory "default"
106
- end
107
- file ".gitignore"
108
- file "chefignore"
109
- file "Berksfile" do
110
- contains "metadata"
111
- end
112
- file "Gemfile"
113
- file "metadata.rb"
114
- file "README.md"
115
- file "Vagrantfile" do
116
- contains "recipe[#{name}::default]"
117
- end
118
- }
119
- end
120
-
121
- Then /^I should have a new cookbook skeleton "(.*?)" with Chef-Minitest support$/ do |name|
122
- steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
123
-
124
- cb_path = Pathname.new(current_dir).join(name)
125
- expect(cb_path).to have_structure {
126
- file "Berksfile" do
127
- contains "cookbook 'minitest-handler'"
128
- end
129
- file "Vagrantfile" do
130
- contains "recipe[minitest-handler::default]"
131
- end
132
- directory "files" do
133
- directory "default" do
134
- directory "tests" do
135
- directory "minitest" do
136
- file "default_test.rb" do
137
- contains "describe '#{name}::default' do"
138
- contains "include Helpers::#{name.capitalize}"
139
- end
140
- directory "support" do
141
- file "helpers.rb" do
142
- contains "module #{name.capitalize}"
143
- end
144
- end
145
- end
146
- end
147
- end
148
- end
149
- }
150
- end
151
-
152
- Then /^I should have a new cookbook skeleton "(.*?)" with Foodcritic support$/ do |name|
153
- steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
154
-
155
- cb_path = Pathname.new(current_dir).join(name)
156
- expect(cb_path).to have_structure {
157
- file "Gemfile" do
158
- contains "gem 'thor-foodcritic'"
159
- end
160
- file "Thorfile" do
161
- contains "require 'thor/foodcritic'"
162
- end
163
- }
164
- end
165
-
166
- Then /^I should have a new cookbook skeleton "(.*?)" with SCMVersion support$/ do |name|
167
- steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
168
-
169
- cb_path = Pathname.new(current_dir).join(name)
170
- expect(cb_path).to have_structure {
171
- file "Gemfile" do
172
- contains "gem 'thor-scmversion'"
173
- end
174
- file "Thorfile" do
175
- contains "require 'thor/scmversion'"
176
- end
177
- }
178
- end
179
-
180
- Then /^I should have a new cookbook skeleton "(.*?)" with no Bundler support$/ do |name|
181
- cb_path = Pathname.new(current_dir).join(name)
182
- expect(cb_path).to have_structure {
183
- directory "attributes"
184
- directory "files" do
185
- directory "default"
186
- end
187
- directory "libraries"
188
- directory "providers"
189
- directory "recipes" do
190
- file "default.rb"
191
- end
192
- directory "resources"
193
- directory "templates" do
194
- directory "default"
195
- end
196
- file "README.md"
197
- file "metadata.rb"
198
- file "Berksfile" do
199
- contains "metadata"
200
- end
201
- file "chefignore"
202
- file "Berksfile"
203
- no_file "Gemfile"
204
- }
205
- end
206
-
207
- Then /^I should have a new cookbook skeleton "(.*?)" with no Git support$/ do |name|
208
- expect(Pathname.new(current_dir).join(name)).to have_structure {
209
- no_file ".gitignore"
210
- }
211
- end
212
-
213
- Then /^I should have a new cookbook skeleton "(.*?)" with no Vagrant support$/ do |name|
214
- expect(Pathname.new(current_dir).join(name)).to have_structure {
215
- file "Gemfile" do
216
- does_not_contain "gem 'vagrant'"
217
- end
218
- no_file "Vagrantfile"
219
- }
220
- end
221
-
222
- Then(/^I should have a new cookbook skeleton "(.*?)" with no Test Kitchen support$/) do |name|
223
- expect(Pathname.new(current_dir).join(name)).to have_structure {
224
- file "Gemfile" do
225
- does_not_contain "gem 'test-kitchen'"
226
- end
227
- no_file ".kitchen.yml"
228
- no_file ".kitchen.yml.local"
229
- }
230
- end
231
-
232
- Then /^the cookbook "(.*?)" should have the following files:$/ do |name, files|
233
- check_file_presence(files.raw.map { |file_row| ::File.join(name, file_row[0]) }, true)
234
- end
235
-
236
- Then /^the cookbook "(.*?)" should not have the following files:$/ do |name, files|
237
- check_file_presence(files.raw.map { |file_row| ::File.join(name, file_row[0]) }, false)
238
- end
239
-
240
- Then /^the git cookbook "(.*?)" should not have the following directories:$/ do |name, directories|
241
- check_directory_presence(directories.raw.map { |directory_row| ::File.join(cookbook_store.storage_path.to_path, name, directory_row[0]) }, false)
242
- end
243
-
244
- Then /^the file "(.*?)" in the cookbook "(.*?)" should contain:$/ do |file_name, cookbook_name, content|
245
- expect(Pathname.new(current_dir).join(cookbook_name)).to have_structure {
246
- file "Berksfile" do
247
- contains content
248
- end
249
- file "chefignore"
250
- }
251
- end
252
-
253
- Then /^the resulting "(.+)" Vagrantfile should contain:$/ do |cookbook_name, content|
254
- expect(Pathname.new(current_dir).join(cookbook_name)).to have_structure {
255
- file "Vagrantfile" do
256
- if content.respond_to?(:raw)
257
- content.raw.flatten.each { |string| contains string }
258
- else
259
- contains(content)
260
- end
261
- end
262
- }
263
- end
264
-
265
- Then /^the directory "(.*?)" should have the following files:$/ do |name, files|
266
- check_file_presence(files.raw.map { |file_row| ::File.join(name, file_row[0]) }, true)
267
- end
268
-
269
- Then /^the directory "(.*?)" should not have the following files:$/ do |name, files|
270
- check_file_presence(files.raw.map { |file_row| ::File.join(name, file_row[0]) }, false)
271
- end
272
-
273
- Then /^the file "(.*?)" in the directory "(.*?)" should not contain:$/ do |file_name, directory_name, content|
274
- Pathname.new(current_dir).join(directory_name).should_not have_structure {
275
- file "Berksfile" do
276
- contains content
277
- end
278
- }
279
- end
280
-
281
- Then(/^the directory "(.*?)" should contain version "(.*?)" of the "(.*?)" cookbook$/) do |path, version, name|
282
- cookbook_path = File.join(current_dir, path)
283
- cookbook = Berkshelf::CachedCookbook.from_path(cookbook_path)
284
- expect(cookbook.version).to eq(version)
285
- expect(cookbook.cookbook_name).to eq(name)
286
- end