berkshelf 5.2.0 → 8.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +19 -47
- data/Rakefile +14 -4
- data/berkshelf.gemspec +61 -40
- data/bin/berks +2 -2
- data/lib/berkshelf/api-client.rb +1 -0
- data/lib/berkshelf/api_client/chef_server_connection.rb +29 -0
- data/lib/berkshelf/api_client/connection.rb +57 -0
- data/lib/berkshelf/api_client/errors.rb +10 -0
- data/lib/berkshelf/api_client/remote_cookbook.rb +56 -0
- data/lib/berkshelf/api_client/version.rb +5 -0
- data/lib/berkshelf/api_client.rb +24 -0
- data/lib/berkshelf/berksfile.rb +149 -122
- data/lib/berkshelf/cached_cookbook.rb +127 -24
- data/lib/berkshelf/chef_config_compat.rb +51 -0
- data/lib/berkshelf/chef_repo_universe.rb +47 -0
- data/lib/berkshelf/cli.rb +143 -174
- data/lib/berkshelf/commands/shelf.rb +20 -19
- data/lib/berkshelf/community_rest.rb +59 -94
- data/lib/berkshelf/config.rb +97 -127
- data/lib/berkshelf/cookbook_store.rb +7 -6
- data/lib/berkshelf/core_ext/file.rb +1 -1
- data/lib/berkshelf/core_ext/file_utils.rb +4 -4
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/dependency.rb +25 -32
- data/lib/berkshelf/downloader.rb +66 -39
- data/lib/berkshelf/errors.rb +23 -17
- data/lib/berkshelf/file_syncer.rb +24 -47
- data/lib/berkshelf/formatters/human.rb +7 -5
- data/lib/berkshelf/formatters/json.rb +6 -6
- data/lib/berkshelf/installer.rb +120 -111
- data/lib/berkshelf/location.rb +14 -14
- data/lib/berkshelf/locations/base.rb +1 -1
- data/lib/berkshelf/locations/git.rb +16 -24
- data/lib/berkshelf/locations/github.rb +2 -2
- data/lib/berkshelf/locations/path.rb +2 -2
- data/lib/berkshelf/lockfile.rb +326 -328
- data/lib/berkshelf/logger.rb +64 -1
- data/lib/berkshelf/mixin/git.rb +6 -5
- data/lib/berkshelf/packager.rb +44 -10
- data/lib/berkshelf/resolver/graph.rb +1 -1
- data/lib/berkshelf/resolver.rb +4 -4
- data/lib/berkshelf/ridley_compat.rb +109 -0
- data/lib/berkshelf/shell.rb +2 -1
- data/lib/berkshelf/shell_out.rb +18 -0
- data/lib/berkshelf/source.rb +77 -33
- data/lib/berkshelf/source_uri.rb +4 -4
- data/lib/berkshelf/ssl_policies.rb +38 -0
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/thor_ext/hash_with_indifferent_access.rb +1 -1
- data/lib/berkshelf/thor_ext.rb +1 -1
- data/lib/berkshelf/uploader.rb +106 -70
- data/lib/berkshelf/validator.rb +13 -5
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +16 -11
- data/lib/berkshelf.rb +106 -81
- data/spec/config/knife.rb +4 -4
- data/spec/data/trusted_certs/example.crt +22 -0
- data/spec/fixtures/Berksfile +3 -3
- data/spec/fixtures/complex-cookbook-path/cookbooks/app/metadata.rb +2 -0
- data/spec/fixtures/complex-cookbook-path/cookbooks/jenkins/metadata.rb +2 -0
- data/spec/fixtures/complex-cookbook-path/cookbooks/jenkins-config/metadata.rb +4 -0
- data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
- data/spec/fixtures/cookbook-path-uploader/apt-2.3.6/metadata.rb +2 -0
- data/spec/fixtures/cookbook-path-uploader/build-essential-1.4.2/metadata.rb +2 -0
- data/spec/fixtures/cookbook-path-uploader/jenkins-2.0.3/metadata.rb +5 -0
- data/spec/fixtures/cookbook-path-uploader/jenkins-config-0.1.0/metadata.rb +4 -0
- data/spec/fixtures/cookbook-path-uploader/runit-1.5.8/metadata.rb +5 -0
- data/spec/fixtures/cookbook-path-uploader/yum-3.0.6/metadata.rb +2 -0
- data/spec/fixtures/cookbook-path-uploader/yum-epel-0.2.0/metadata.rb +3 -0
- data/spec/fixtures/cookbook-store/jenkins-2.0.3/metadata.rb +5 -5
- data/spec/fixtures/cookbook-store/jenkins-2.0.4/metadata.rb +4 -4
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
- data/spec/spec_helper.rb +56 -64
- data/spec/support/chef_api.rb +15 -16
- data/spec/support/chef_server.rb +71 -69
- data/spec/support/git.rb +59 -58
- data/spec/support/kitchen.rb +0 -14
- data/spec/support/matchers/file_system_matchers.rb +4 -5
- data/spec/support/matchers/filepath_matchers.rb +2 -2
- data/spec/support/path_helpers.rb +17 -17
- data/spec/support/shared_examples/formatter.rb +1 -1
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/metadata.rb +2 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.1.0/templates/default/template.erb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/metadata.rb +2 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-0.2.0/templates/default/template.erb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/attributes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/files/default/file.h +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/metadata.rb +2 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/recipes/default.rb +0 -0
- data/spec/tmp/berkshelf/cookbooks/fake-1.0.0/templates/default/template.erb +0 -0
- data/spec/unit/berkshelf/berksfile_spec.rb +84 -105
- data/spec/unit/berkshelf/berkshelf/api_client/chef_server_connection_spec.rb +65 -0
- data/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +157 -0
- data/spec/unit/berkshelf/berkshelf/api_client/remote_cookbook_spec.rb +23 -0
- data/spec/unit/berkshelf/berkshelf/api_client_spec.rb +9 -0
- data/spec/unit/berkshelf/cached_cookbook_spec.rb +45 -47
- data/spec/unit/berkshelf/chef_repo_universe_spec.rb +37 -0
- data/spec/unit/berkshelf/cli_spec.rb +7 -8
- data/spec/unit/berkshelf/community_rest_spec.rb +82 -90
- data/spec/unit/berkshelf/config_spec.rb +51 -22
- data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +7 -8
- data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
- data/spec/unit/berkshelf/dependency_spec.rb +48 -48
- data/spec/unit/berkshelf/downloader_spec.rb +191 -34
- data/spec/unit/berkshelf/errors_spec.rb +3 -3
- data/spec/unit/berkshelf/file_syncer_spec.rb +87 -87
- data/spec/unit/berkshelf/formatters/base_spec.rb +23 -23
- data/spec/unit/berkshelf/formatters/human_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/json_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/null_spec.rb +3 -3
- data/spec/unit/berkshelf/installer_spec.rb +8 -8
- data/spec/unit/berkshelf/location_spec.rb +11 -11
- data/spec/unit/berkshelf/locations/base_spec.rb +35 -36
- data/spec/unit/berkshelf/locations/git_spec.rb +90 -93
- data/spec/unit/berkshelf/locations/path_spec.rb +40 -41
- data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
- data/spec/unit/berkshelf/lockfile_spec.rb +205 -211
- data/spec/unit/berkshelf/logger_spec.rb +3 -3
- data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -5
- data/spec/unit/berkshelf/packager_spec.rb +2 -2
- data/spec/unit/berkshelf/resolver/graph_spec.rb +10 -8
- data/spec/unit/berkshelf/resolver_spec.rb +17 -17
- data/spec/unit/berkshelf/ridley_compat_spec.rb +16 -0
- data/spec/unit/berkshelf/shell_spec.rb +34 -34
- data/spec/unit/berkshelf/source_spec.rb +186 -20
- data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
- data/spec/unit/berkshelf/ssl_policies_spec.rb +86 -0
- data/spec/unit/berkshelf/uploader_spec.rb +146 -64
- data/spec/unit/berkshelf/validator_spec.rb +23 -16
- data/spec/unit/berkshelf/visualizer_spec.rb +24 -15
- data/spec/unit/berkshelf_spec.rb +18 -18
- metadata +138 -289
- data/.gitignore +0 -29
- data/.travis.yml +0 -64
- data/CHANGELOG.legacy.md +0 -307
- data/CHANGELOG.md +0 -1358
- data/CONTRIBUTING.md +0 -64
- data/Gemfile.lock +0 -399
- data/Guardfile +0 -23
- data/PLUGINS.md +0 -25
- data/README.md +0 -70
- data/Thorfile +0 -61
- data/appveyor.yml +0 -31
- data/docs/berkshelf_for_newcomers.md +0 -65
- data/features/berksfile.feature +0 -46
- data/features/commands/apply.feature +0 -41
- data/features/commands/contingent.feature +0 -48
- data/features/commands/cookbook.feature +0 -35
- data/features/commands/info.feature +0 -99
- data/features/commands/init.feature +0 -27
- data/features/commands/install.feature +0 -636
- data/features/commands/list.feature +0 -78
- data/features/commands/outdated.feature +0 -130
- data/features/commands/package.feature +0 -17
- data/features/commands/search.feature +0 -17
- data/features/commands/shelf/list.feature +0 -32
- data/features/commands/shelf/show.feature +0 -143
- data/features/commands/shelf/uninstall.feature +0 -96
- data/features/commands/show.feature +0 -83
- data/features/commands/update.feature +0 -142
- data/features/commands/upload.feature +0 -426
- data/features/commands/vendor.feature +0 -111
- data/features/commands/verify.feature +0 -29
- data/features/commands/viz.feature +0 -66
- data/features/community_site.feature +0 -37
- data/features/config.feature +0 -111
- data/features/help.feature +0 -11
- data/features/json_formatter.feature +0 -161
- data/features/lifecycle.feature +0 -378
- data/features/lockfile.feature +0 -378
- data/features/step_definitions/berksfile_steps.rb +0 -39
- data/features/step_definitions/chef/config_steps.rb +0 -12
- data/features/step_definitions/chef_server_steps.rb +0 -60
- data/features/step_definitions/cli_steps.rb +0 -18
- data/features/step_definitions/config_steps.rb +0 -46
- data/features/step_definitions/environment_steps.rb +0 -7
- data/features/step_definitions/filesystem_steps.rb +0 -269
- data/features/step_definitions/gem_steps.rb +0 -13
- data/features/step_definitions/json_steps.rb +0 -23
- data/features/step_definitions/utility_steps.rb +0 -11
- data/features/support/aruba.rb +0 -12
- data/features/support/env.rb +0 -82
- data/generator_files/Berksfile.erb +0 -11
- data/generator_files/CHANGELOG.md.erb +0 -3
- data/generator_files/Gemfile.erb +0 -8
- data/generator_files/README.md.erb +0 -42
- data/generator_files/Thorfile.erb +0 -11
- data/generator_files/Vagrantfile.erb +0 -117
- data/generator_files/chefignore +0 -94
- data/generator_files/default_recipe.erb +0 -6
- data/generator_files/default_test.rb.erb +0 -11
- data/generator_files/gitignore.erb +0 -23
- data/generator_files/helpers.rb.erb +0 -7
- data/generator_files/licenses/apachev2.erb +0 -13
- data/generator_files/licenses/gplv2.erb +0 -15
- data/generator_files/licenses/gplv3.erb +0 -14
- data/generator_files/licenses/mit.erb +0 -20
- data/generator_files/licenses/reserved.erb +0 -3
- data/generator_files/metadata.rb.erb +0 -11
- data/lib/berkshelf/base_generator.rb +0 -43
- data/lib/berkshelf/commands/test_command.rb +0 -13
- data/lib/berkshelf/cookbook_generator.rb +0 -133
- data/lib/berkshelf/init_generator.rb +0 -195
- data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
- data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +0 -110
- data/spec/unit/berkshelf/init_generator_spec.rb +0 -263
@@ -1,269 +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 is empty$/) do
|
40
|
-
Berkshelf::CookbookStore.instance.clean!
|
41
|
-
end
|
42
|
-
|
43
|
-
Then /^the cookbook store should have the cookbooks:$/ do |cookbooks|
|
44
|
-
cookbooks.raw.each do |name, version|
|
45
|
-
expect(cookbook_store.storage_path).to have_structure {
|
46
|
-
directory "#{name}-#{version}" do
|
47
|
-
file "metadata.rb" do
|
48
|
-
contains version
|
49
|
-
end
|
50
|
-
end
|
51
|
-
}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
Then /^the cookbook store should have the git cookbooks:$/ do |cookbooks|
|
56
|
-
cookbooks.raw.each do |name, version, sha1|
|
57
|
-
expect(cookbook_store.storage_path).to have_structure {
|
58
|
-
directory "#{name}-#{sha1}" do
|
59
|
-
file "metadata.rb" do
|
60
|
-
contains version
|
61
|
-
end
|
62
|
-
end
|
63
|
-
}
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
Then /^the cookbook store should not have the cookbooks:$/ do |cookbooks|
|
68
|
-
cookbooks.raw.each do |name, version|
|
69
|
-
expect(cookbook_store.storage_path).to_not have_structure {
|
70
|
-
directory "#{name}-#{version}"
|
71
|
-
}
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
Then /^I should have a new cookbook skeleton "(.*?)"$/ do |name|
|
76
|
-
cb_path = Pathname.new(current_dir).join(name)
|
77
|
-
expect(cb_path).to have_structure {
|
78
|
-
directory "attributes"
|
79
|
-
directory "files" do
|
80
|
-
directory "default"
|
81
|
-
end
|
82
|
-
directory "libraries"
|
83
|
-
directory "providers"
|
84
|
-
directory "recipes" do
|
85
|
-
file "default.rb"
|
86
|
-
end
|
87
|
-
directory "resources"
|
88
|
-
directory "templates" do
|
89
|
-
directory "default"
|
90
|
-
end
|
91
|
-
file ".gitignore"
|
92
|
-
file "chefignore"
|
93
|
-
file "Berksfile" do
|
94
|
-
contains "metadata"
|
95
|
-
end
|
96
|
-
file "Gemfile"
|
97
|
-
file "metadata.rb"
|
98
|
-
file "README.md"
|
99
|
-
file "Vagrantfile" do
|
100
|
-
contains "recipe[#{name}::default]"
|
101
|
-
end
|
102
|
-
}
|
103
|
-
end
|
104
|
-
|
105
|
-
Then /^I should have a new cookbook skeleton "(.*?)" with Chef-Minitest support$/ do |name|
|
106
|
-
steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
|
107
|
-
|
108
|
-
cb_path = Pathname.new(current_dir).join(name)
|
109
|
-
expect(cb_path).to have_structure {
|
110
|
-
file "Berksfile" do
|
111
|
-
contains "cookbook 'minitest-handler'"
|
112
|
-
end
|
113
|
-
file "Vagrantfile" do
|
114
|
-
contains "recipe[minitest-handler::default]"
|
115
|
-
end
|
116
|
-
directory "files" do
|
117
|
-
directory "default" do
|
118
|
-
directory "tests" do
|
119
|
-
directory "minitest" do
|
120
|
-
file "default_test.rb" do
|
121
|
-
contains "describe '#{name}::default' do"
|
122
|
-
contains "include Helpers::#{name.capitalize}"
|
123
|
-
end
|
124
|
-
directory "support" do
|
125
|
-
file "helpers.rb" do
|
126
|
-
contains "module #{name.capitalize}"
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
}
|
134
|
-
end
|
135
|
-
|
136
|
-
|
137
|
-
Then /^I should have a new cookbook skeleton "(.*?)" with Foodcritic support$/ do |name|
|
138
|
-
steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
|
139
|
-
|
140
|
-
cb_path = Pathname.new(current_dir).join(name)
|
141
|
-
expect(cb_path).to have_structure {
|
142
|
-
file "Gemfile" do
|
143
|
-
contains "gem 'thor-foodcritic'"
|
144
|
-
end
|
145
|
-
file "Thorfile" do
|
146
|
-
contains "require 'thor/foodcritic'"
|
147
|
-
end
|
148
|
-
}
|
149
|
-
end
|
150
|
-
|
151
|
-
Then /^I should have a new cookbook skeleton "(.*?)" with SCMVersion support$/ do |name|
|
152
|
-
steps %Q{ Then I should have a new cookbook skeleton "#{name}" }
|
153
|
-
|
154
|
-
cb_path = Pathname.new(current_dir).join(name)
|
155
|
-
expect(cb_path).to have_structure {
|
156
|
-
file "Gemfile" do
|
157
|
-
contains "gem 'thor-scmversion'"
|
158
|
-
end
|
159
|
-
file "Thorfile" do
|
160
|
-
contains "require 'thor/scmversion'"
|
161
|
-
end
|
162
|
-
}
|
163
|
-
end
|
164
|
-
|
165
|
-
Then /^I should have a new cookbook skeleton "(.*?)" with no Bundler support$/ do |name|
|
166
|
-
cb_path = Pathname.new(current_dir).join(name)
|
167
|
-
expect(cb_path).to have_structure {
|
168
|
-
directory "attributes"
|
169
|
-
directory "files" do
|
170
|
-
directory "default"
|
171
|
-
end
|
172
|
-
directory "libraries"
|
173
|
-
directory "providers"
|
174
|
-
directory "recipes" do
|
175
|
-
file "default.rb"
|
176
|
-
end
|
177
|
-
directory "resources"
|
178
|
-
directory "templates" do
|
179
|
-
directory "default"
|
180
|
-
end
|
181
|
-
file "README.md"
|
182
|
-
file "metadata.rb"
|
183
|
-
file "Berksfile" do
|
184
|
-
contains "metadata"
|
185
|
-
end
|
186
|
-
file "chefignore"
|
187
|
-
file "Berksfile"
|
188
|
-
no_file "Gemfile"
|
189
|
-
}
|
190
|
-
end
|
191
|
-
|
192
|
-
Then /^I should have a new cookbook skeleton "(.*?)" with no Git support$/ do |name|
|
193
|
-
expect(Pathname.new(current_dir).join(name)).to have_structure {
|
194
|
-
no_file ".gitignore"
|
195
|
-
}
|
196
|
-
end
|
197
|
-
|
198
|
-
Then /^I should have a new cookbook skeleton "(.*?)" with no Vagrant support$/ do |name|
|
199
|
-
expect(Pathname.new(current_dir).join(name)).to have_structure {
|
200
|
-
file "Gemfile" do
|
201
|
-
does_not_contain "gem 'vagrant'"
|
202
|
-
end
|
203
|
-
no_file "Vagrantfile"
|
204
|
-
}
|
205
|
-
end
|
206
|
-
|
207
|
-
Then(/^I should have a new cookbook skeleton "(.*?)" with no Test Kitchen support$/) do |name|
|
208
|
-
expect(Pathname.new(current_dir).join(name)).to have_structure {
|
209
|
-
file "Gemfile" do
|
210
|
-
does_not_contain "gem 'test-kitchen'"
|
211
|
-
end
|
212
|
-
no_file ".kitchen.yml"
|
213
|
-
no_file ".kitchen.yml.local"
|
214
|
-
}
|
215
|
-
end
|
216
|
-
|
217
|
-
Then /^the cookbook "(.*?)" should have the following files:$/ do |name, files|
|
218
|
-
check_file_presence(files.raw.map{|file_row| ::File.join(name, file_row[0])}, true)
|
219
|
-
end
|
220
|
-
|
221
|
-
Then /^the cookbook "(.*?)" should not have the following files:$/ do |name, files|
|
222
|
-
check_file_presence(files.raw.map{|file_row| ::File.join(name, file_row[0])}, false)
|
223
|
-
end
|
224
|
-
|
225
|
-
Then /^the git cookbook "(.*?)" should not have the following directories:$/ do |name, directories|
|
226
|
-
check_directory_presence(directories.raw.map{|directory_row| ::File.join(cookbook_store.storage_path.to_path, name, directory_row[0])}, false)
|
227
|
-
end
|
228
|
-
|
229
|
-
Then /^the file "(.*?)" in the cookbook "(.*?)" should contain:$/ do |file_name, cookbook_name, content|
|
230
|
-
expect(Pathname.new(current_dir).join(cookbook_name)).to have_structure {
|
231
|
-
file "Berksfile" do
|
232
|
-
contains content
|
233
|
-
end
|
234
|
-
file "chefignore"
|
235
|
-
}
|
236
|
-
end
|
237
|
-
|
238
|
-
Then /^the resulting "(.+)" Vagrantfile should contain:$/ do |cookbook_name, content|
|
239
|
-
expect(Pathname.new(current_dir).join(cookbook_name)).to have_structure {
|
240
|
-
file "Vagrantfile" do
|
241
|
-
content.respond_to?(:raw) ?
|
242
|
-
content.raw.flatten.each { |string| contains string } :
|
243
|
-
contains(content)
|
244
|
-
end
|
245
|
-
}
|
246
|
-
end
|
247
|
-
|
248
|
-
Then /^the directory "(.*?)" should have the following files:$/ do |name, files|
|
249
|
-
check_file_presence(files.raw.map{|file_row| ::File.join(name, file_row[0])}, true)
|
250
|
-
end
|
251
|
-
|
252
|
-
Then /^the directory "(.*?)" should not have the following files:$/ do |name, files|
|
253
|
-
check_file_presence(files.raw.map{|file_row| ::File.join(name, file_row[0])}, false)
|
254
|
-
end
|
255
|
-
|
256
|
-
Then /^the file "(.*?)" in the directory "(.*?)" should not contain:$/ do |file_name, directory_name, content|
|
257
|
-
Pathname.new(current_dir).join(directory_name).should_not have_structure {
|
258
|
-
file "Berksfile" do
|
259
|
-
contains content
|
260
|
-
end
|
261
|
-
}
|
262
|
-
end
|
263
|
-
|
264
|
-
Then(/^the directory "(.*?)" should contain version "(.*?)" of the "(.*?)" cookbook$/) do |path, version, name|
|
265
|
-
cookbook_path = File.join(current_dir, path)
|
266
|
-
cookbook = Berkshelf::CachedCookbook.from_path(cookbook_path)
|
267
|
-
expect(cookbook.version).to eq(version)
|
268
|
-
expect(cookbook.cookbook_name).to eq(name)
|
269
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Given /^the gem "(.*)" is not installed$/ do |gem_name|
|
2
|
-
allow(Gem::Specification).to receive(:find_by_name)
|
3
|
-
.with(gem_name)
|
4
|
-
.and_raise(Gem::LoadError)
|
5
|
-
end
|
6
|
-
|
7
|
-
Then /^the output should contain a warning to suggest supporting the option "(.*?)" by installing "(.*?)"$/ do |option, gem_name|
|
8
|
-
step "the output should contain \"This cookbook was generated with --#{option}, however, #{gem_name} is not installed.\nTo make use of --#{option}: gem install #{gem_name}\""
|
9
|
-
end
|
10
|
-
|
11
|
-
Then /^the output should contain a warning to suggest supporting the default for "(.*?)" by installing "(.*?)"$/ do |option, gem_name|
|
12
|
-
step "the output should contain \"By default, this cookbook was generated to support #{gem_name}, however, #{gem_name} is not installed.\nTo skip support for #{gem_name}, use --no-#{option}\"\nTo install #{gem_name}: gem install #{gem_name}"
|
13
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
def sort_by_key(&block)
|
3
|
-
self.keys.sort(&block).reduce({}) do |seed, key|
|
4
|
-
seed[key] = self[key]
|
5
|
-
if seed[key].is_a?(Hash)
|
6
|
-
seed[key] = seed[key].sort_by_key(&block)
|
7
|
-
elsif seed[key].is_a?(Array)
|
8
|
-
seed[key] = seed[key].map do |i|
|
9
|
-
i.respond_to?(:sort_by_key) ? i.sort_by_key(&block) : i
|
10
|
-
end
|
11
|
-
end
|
12
|
-
seed
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^the output should contain JSON:$/ do |data|
|
18
|
-
parsed = ERB.new(data).result
|
19
|
-
target = JSON.pretty_generate(JSON.parse(parsed).sort_by_key)
|
20
|
-
actual = JSON.pretty_generate(JSON.parse(all_commands.map { |c| c.output }.join("\n")).sort_by_key)
|
21
|
-
|
22
|
-
expect(actual).to eq(target)
|
23
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Given /^skip\s+"([^\"]+)"$/ do |msg|
|
2
|
-
skip
|
3
|
-
end
|
4
|
-
|
5
|
-
Then /the output from \`(.+)\` should be the same as \`(.+)\`/ do |actual, expected|
|
6
|
-
run(actual)
|
7
|
-
actual_output = last_command_started.stdout
|
8
|
-
run(expected)
|
9
|
-
expected_output = last_command_started.stdout
|
10
|
-
expect(actual_output).to eql(expected_output)
|
11
|
-
end
|
data/features/support/aruba.rb
DELETED
data/features/support/env.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'spork'
|
2
|
-
|
3
|
-
def windows?
|
4
|
-
!!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
|
5
|
-
end
|
6
|
-
|
7
|
-
Spork.prefork do
|
8
|
-
require 'aruba/cucumber'
|
9
|
-
require 'aruba/in_process'
|
10
|
-
require 'aruba/spawn_process'
|
11
|
-
require 'cucumber/rspec/doubles'
|
12
|
-
require 'berkshelf/api/rspec' unless windows?
|
13
|
-
require 'berkshelf/api/cucumber' unless windows?
|
14
|
-
|
15
|
-
Dir['spec/support/**/*.rb'].each { |f| require File.expand_path(f) }
|
16
|
-
|
17
|
-
World(Berkshelf::RSpec::PathHelpers)
|
18
|
-
World(Berkshelf::RSpec::Kitchen)
|
19
|
-
|
20
|
-
CHEF_SERVER_PORT = 26310
|
21
|
-
BERKS_API_PORT = 26210
|
22
|
-
|
23
|
-
at_exit do
|
24
|
-
Berkshelf::RSpec::ChefServer.stop
|
25
|
-
Berkshelf::API::RSpec::Server.stop unless windows?
|
26
|
-
end
|
27
|
-
|
28
|
-
Before do
|
29
|
-
|
30
|
-
# Legacy ENV variables until we can move over to all InProcess
|
31
|
-
Berkshelf.instance_variable_set(:@berkshelf_path, nil)
|
32
|
-
ENV['BERKSHELF_PATH'] = berkshelf_path.to_s
|
33
|
-
ENV['BERKSHELF_CONFIG'] = Berkshelf.config.path.to_s
|
34
|
-
ENV['BERKSHELF_CHEF_CONFIG'] = chef_config_path.to_s
|
35
|
-
|
36
|
-
aruba.config.command_launcher = :in_process
|
37
|
-
aruba.config.main_class = Berkshelf::Cli::Runner
|
38
|
-
@dirs = ["spec/tmp/aruba"] # set aruba's temporary directory
|
39
|
-
|
40
|
-
stub_kitchen!
|
41
|
-
clean_tmp_path
|
42
|
-
Berkshelf.initialize_filesystem
|
43
|
-
Berkshelf::CookbookStore.instance.initialize_filesystem
|
44
|
-
reload_configs
|
45
|
-
Berkshelf::CachedCookbook.instance_variable_set(:@loaded_cookbooks, nil)
|
46
|
-
|
47
|
-
endpoints = [
|
48
|
-
{
|
49
|
-
type: "chef_server",
|
50
|
-
options: {
|
51
|
-
url: "http://localhost:#{CHEF_SERVER_PORT}",
|
52
|
-
client_name: "reset",
|
53
|
-
client_key: File.expand_path("spec/config/berkshelf.pem")
|
54
|
-
}
|
55
|
-
}
|
56
|
-
]
|
57
|
-
|
58
|
-
Berkshelf::RSpec::ChefServer.start(port: CHEF_SERVER_PORT)
|
59
|
-
Berkshelf::API::RSpec::Server.start(port: BERKS_API_PORT, endpoints: endpoints) unless windows?
|
60
|
-
|
61
|
-
aruba.config.io_wait_timeout = Cucumber::JRUBY ? 7 : 5
|
62
|
-
@aruba_timeout_seconds = Cucumber::JRUBY ? 35 : 15
|
63
|
-
end
|
64
|
-
|
65
|
-
Before('@spawn') do
|
66
|
-
aruba.config.command_launcher = :spawn
|
67
|
-
|
68
|
-
Berkshelf.instance_variable_set(:@berkshelf_path, nil)
|
69
|
-
set_environment_variable('BERKSHELF_PATH', berkshelf_path.to_s)
|
70
|
-
set_environment_variable('BERKSHELF_CONFIG', Berkshelf.config.path.to_s)
|
71
|
-
set_environment_variable('BERKSHELF_CHEF_CONFIG', chef_config_path.to_s)
|
72
|
-
end
|
73
|
-
|
74
|
-
Before('@slow_process') do
|
75
|
-
aruba.config.io_wait_timeout = Cucumber::JRUBY ? 70 : 30
|
76
|
-
@aruba_timeout_seconds = Cucumber::JRUBY ? 140 : 60
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
Spork.each_run do
|
81
|
-
require 'berkshelf/cli'
|
82
|
-
end
|
data/generator_files/Gemfile.erb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# <%= name %>-cookbook
|
2
|
-
|
3
|
-
TODO: Enter the cookbook description here.
|
4
|
-
|
5
|
-
## Supported Platforms
|
6
|
-
|
7
|
-
TODO: List your supported platforms.
|
8
|
-
|
9
|
-
## Attributes
|
10
|
-
|
11
|
-
<table>
|
12
|
-
<tr>
|
13
|
-
<th>Key</th>
|
14
|
-
<th>Type</th>
|
15
|
-
<th>Description</th>
|
16
|
-
<th>Default</th>
|
17
|
-
</tr>
|
18
|
-
<tr>
|
19
|
-
<td><tt>['<%= name %>']['bacon']</tt></td>
|
20
|
-
<td>Boolean</td>
|
21
|
-
<td>whether to include bacon</td>
|
22
|
-
<td><tt>true</tt></td>
|
23
|
-
</tr>
|
24
|
-
</table>
|
25
|
-
|
26
|
-
## Usage
|
27
|
-
|
28
|
-
### <%= name %>::default
|
29
|
-
|
30
|
-
Include `<%= name %>` in your node's `run_list`:
|
31
|
-
|
32
|
-
```json
|
33
|
-
{
|
34
|
-
"run_list": [
|
35
|
-
"recipe[<%= name %>::default]"
|
36
|
-
]
|
37
|
-
}
|
38
|
-
```
|
39
|
-
|
40
|
-
## License and Authors
|
41
|
-
|
42
|
-
Author:: <%= maintainer %> (<<%= maintainer_email %>>)
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
-
VAGRANTFILE_API_VERSION = '2'
|
6
|
-
|
7
|
-
Vagrant.require_version '>= 1.5.0'
|
8
|
-
|
9
|
-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
10
|
-
# All Vagrant configuration is done here. The most common configuration
|
11
|
-
# options are documented and commented below. For a complete reference,
|
12
|
-
# please see the online documentation at vagrantup.com.
|
13
|
-
|
14
|
-
config.vm.hostname = '<%= "#{cookbook_name.gsub('_','-')}-berkshelf" %>'
|
15
|
-
|
16
|
-
# Set the version of chef to install using the vagrant-omnibus plugin
|
17
|
-
# NOTE: You will need to install the vagrant-omnibus plugin:
|
18
|
-
#
|
19
|
-
# $ vagrant plugin install vagrant-omnibus
|
20
|
-
#
|
21
|
-
if Vagrant.has_plugin?("vagrant-omnibus")
|
22
|
-
config.omnibus.chef_version = '<%= berkshelf_config.vagrant.omnibus.version %>'
|
23
|
-
end
|
24
|
-
|
25
|
-
# Every Vagrant virtual environment requires a box to build off of.
|
26
|
-
# If this value is a shorthand to a box in Vagrant Cloud then
|
27
|
-
# config.vm.box_url doesn't need to be specified.
|
28
|
-
config.vm.box = '<%= berkshelf_config.vagrant.vm.box %>'
|
29
|
-
|
30
|
-
<% unless berkshelf_config.vagrant.vm.box_url.nil? -%>
|
31
|
-
# The url from where the 'config.vm.box' box will be fetched if it
|
32
|
-
# is not a Vagrant Cloud box and if it doesn't already exist on the
|
33
|
-
# user's system.
|
34
|
-
config.vm.box_url = '<%= berkshelf_config.vagrant.vm.box_url %>'
|
35
|
-
<% end -%>
|
36
|
-
|
37
|
-
# Assign this VM to a host-only network IP, allowing you to access it
|
38
|
-
# via the IP. Host-only networks can talk to the host machine as well as
|
39
|
-
# any other machines on the same network, but cannot be accessed (through this
|
40
|
-
# network interface) by any external networks.
|
41
|
-
config.vm.network :private_network, type: 'dhcp'
|
42
|
-
|
43
|
-
# Create a forwarded port mapping which allows access to a specific port
|
44
|
-
# within the machine from a port on the host machine. In the example below,
|
45
|
-
# accessing "localhost:8080" will access port 80 on the guest machine.
|
46
|
-
<% berkshelf_config.vagrant.vm.forward_port.each do |guest, host| %>
|
47
|
-
config.vm.network :forwarded_port, guest: <%= guest %>, host: <%= host %>
|
48
|
-
<% end -%>
|
49
|
-
|
50
|
-
# Share an additional folder to the guest VM. The first argument is
|
51
|
-
# the path on the host to the actual folder. The second argument is
|
52
|
-
# the path on the guest to mount the folder. And the optional third
|
53
|
-
# argument is a set of non-required options.
|
54
|
-
# config.vm.synced_folder "../data", "/vagrant_data"
|
55
|
-
|
56
|
-
# Provider-specific configuration so you can fine-tune various
|
57
|
-
# backing providers for Vagrant. These expose provider-specific options.
|
58
|
-
# Example for VirtualBox:
|
59
|
-
#
|
60
|
-
# config.vm.provider :virtualbox do |vb|
|
61
|
-
# # Don't boot with headless mode
|
62
|
-
# vb.gui = true
|
63
|
-
#
|
64
|
-
# # Use VBoxManage to customize the VM. For example to change memory:
|
65
|
-
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
66
|
-
# end
|
67
|
-
#
|
68
|
-
# View the documentation for the provider you're using for more
|
69
|
-
# information on available options.
|
70
|
-
|
71
|
-
# The path to the Berksfile to use with Vagrant Berkshelf
|
72
|
-
# config.berkshelf.berksfile_path = "./Berksfile"
|
73
|
-
|
74
|
-
# Enabling the Berkshelf plugin. To enable this globally, add this configuration
|
75
|
-
# option to your ~/.vagrant.d/Vagrantfile file
|
76
|
-
config.berkshelf.enabled = true
|
77
|
-
|
78
|
-
# An array of symbols representing groups of cookbook described in the Vagrantfile
|
79
|
-
# to exclusively install and copy to Vagrant's shelf.
|
80
|
-
# config.berkshelf.only = []
|
81
|
-
|
82
|
-
# An array of symbols representing groups of cookbook described in the Vagrantfile
|
83
|
-
# to skip installing and copying to Vagrant's shelf.
|
84
|
-
# config.berkshelf.except = []
|
85
|
-
|
86
|
-
<% if berkshelf_config.vagrant.vm.provision == 'chef_client' -%>
|
87
|
-
config.vm.provision :chef_client do |chef|
|
88
|
-
chef.chef_server_url = '<%= berkshelf_config.chef.chef_server_url %>'
|
89
|
-
chef.validation_client_name = '<%= berkshelf_config.chef.validation_client_name %>'
|
90
|
-
chef.validation_key_path = '<%= berkshelf_config.chef.validation_key_path %>'
|
91
|
-
|
92
|
-
chef.run_list = [
|
93
|
-
<% if options[:chef_minitest] %>
|
94
|
-
'recipe[minitest-handler::default]',
|
95
|
-
<% end -%>
|
96
|
-
'recipe[<%= cookbook_name %>::default]'
|
97
|
-
]
|
98
|
-
end
|
99
|
-
<% elsif berkshelf_config.vagrant.vm.provision == 'chef_solo' -%>
|
100
|
-
config.vm.provision :chef_solo do |chef|
|
101
|
-
chef.json = {
|
102
|
-
mysql: {
|
103
|
-
server_root_password: 'rootpass',
|
104
|
-
server_debian_password: 'debpass',
|
105
|
-
server_repl_password: 'replpass'
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
chef.run_list = [
|
110
|
-
<% if options[:chef_minitest] %>
|
111
|
-
'recipe[minitest-handler::default]',
|
112
|
-
<% end -%>
|
113
|
-
'recipe[<%= cookbook_name %>::default]'
|
114
|
-
]
|
115
|
-
end
|
116
|
-
<% end -%>
|
117
|
-
end
|