berkshelf 7.0.7 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Rakefile +4 -4
- data/berkshelf.gemspec +10 -12
- data/bin/berks +5 -0
- data/lib/berkshelf.rb +8 -9
- data/lib/berkshelf/api_client/chef_server_connection.rb +3 -2
- data/lib/berkshelf/api_client/connection.rb +1 -1
- data/lib/berkshelf/api_client/remote_cookbook.rb +1 -1
- data/lib/berkshelf/berksfile.rb +41 -39
- data/lib/berkshelf/cached_cookbook.rb +6 -4
- data/lib/berkshelf/chef_config_compat.rb +2 -1
- data/lib/berkshelf/chef_repo_universe.rb +6 -4
- data/lib/berkshelf/cli.rb +6 -6
- data/lib/berkshelf/commands/shelf.rb +1 -1
- data/lib/berkshelf/community_rest.rb +6 -6
- data/lib/berkshelf/config.rb +3 -3
- data/lib/berkshelf/cookbook_store.rb +2 -4
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/core_ext/file_utils.rb +3 -3
- data/lib/berkshelf/dependency.rb +1 -1
- data/lib/berkshelf/downloader.rb +9 -6
- data/lib/berkshelf/errors.rb +5 -2
- data/lib/berkshelf/file_syncer.rb +7 -12
- data/lib/berkshelf/formatters/human.rb +1 -1
- data/lib/berkshelf/formatters/json.rb +4 -4
- data/lib/berkshelf/installer.rb +1 -1
- data/lib/berkshelf/location.rb +3 -3
- data/lib/berkshelf/locations/git.rb +6 -12
- data/lib/berkshelf/lockfile.rb +14 -14
- data/lib/berkshelf/logger.rb +4 -2
- data/lib/berkshelf/mixin/git.rb +3 -3
- data/lib/berkshelf/packager.rb +5 -7
- data/lib/berkshelf/resolver.rb +1 -1
- data/lib/berkshelf/ridley_compat.rb +1 -1
- data/lib/berkshelf/shell.rb +2 -1
- data/lib/berkshelf/shell_out.rb +4 -3
- data/lib/berkshelf/source.rb +8 -7
- data/lib/berkshelf/source_uri.rb +1 -1
- data/lib/berkshelf/ssl_policies.rb +5 -9
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/thor_ext.rb +1 -1
- data/lib/berkshelf/uploader.rb +11 -9
- data/lib/berkshelf/validator.rb +2 -8
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +3 -3
- data/spec/config/knife.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/chef_server.rb +2 -2
- data/spec/support/git.rb +18 -18
- data/spec/support/path_helpers.rb +4 -4
- data/spec/unit/berkshelf/berksfile_spec.rb +7 -7
- data/spec/unit/berkshelf/cli_spec.rb +1 -2
- data/spec/unit/berkshelf/community_rest_spec.rb +1 -1
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +2 -2
- data/spec/unit/berkshelf/dependency_spec.rb +5 -5
- data/spec/unit/berkshelf/downloader_spec.rb +4 -8
- data/spec/unit/berkshelf/locations/base_spec.rb +1 -2
- data/spec/unit/berkshelf/locations/git_spec.rb +2 -5
- data/spec/unit/berkshelf/locations/path_spec.rb +1 -2
- data/spec/unit/berkshelf/lockfile_spec.rb +9 -18
- data/spec/unit/berkshelf/ridley_compat_spec.rb +2 -2
- data/spec/unit/berkshelf/source_spec.rb +30 -19
- data/spec/unit/berkshelf/ssl_policies_spec.rb +3 -6
- data/spec/unit/berkshelf/uploader_spec.rb +6 -10
- data/spec/unit/berkshelf/validator_spec.rb +0 -13
- metadata +39 -193
- data/.github/lock.yml +0 -1
- data/.gitignore +0 -30
- data/.rubocop.yml +0 -12
- data/.travis.yml +0 -73
- data/CHANGELOG.legacy.md +0 -307
- data/CHANGELOG.md +0 -1589
- data/CONTRIBUTING.md +0 -68
- data/Gemfile.lock +0 -292
- data/PLUGINS.md +0 -25
- data/README.md +0 -72
- data/Thorfile +0 -61
- data/appveyor.yml +0 -31
- data/docs/berkshelf_for_newcomers.md +0 -64
- data/features/artifactory.feature +0 -70
- data/features/berksfile.feature +0 -46
- data/features/commands/apply.feature +0 -41
- data/features/commands/contingent.feature +0 -47
- data/features/commands/info.feature +0 -141
- data/features/commands/install.feature +0 -646
- data/features/commands/list.feature +0 -78
- data/features/commands/outdated.feature +0 -176
- 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 -113
- 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 -499
- data/features/commands/vendor.feature +0 -154
- data/features/commands/verify.feature +0 -29
- data/features/commands/viz.feature +0 -66
- data/features/community_site.feature +0 -37
- data/features/help.feature +0 -11
- data/features/json_formatter.feature +0 -158
- data/features/lifecycle.feature +0 -378
- data/features/lockfile.feature +0 -378
- data/features/step_definitions/berksfile_steps.rb +0 -54
- 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 -11
- data/features/step_definitions/filesystem_steps.rb +0 -286
- data/features/step_definitions/gem_steps.rb +0 -13
- data/features/step_definitions/json_steps.rb +0 -29
- data/features/step_definitions/utility_steps.rb +0 -11
- data/features/support/aruba.rb +0 -12
- data/features/support/env.rb +0 -77
- data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
- 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
|