berkshelf 6.3.4 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +10 -0
- data/.travis.yml +6 -8
- data/CHANGELOG.md +7 -19
- data/Gemfile +10 -0
- data/Gemfile.lock +68 -103
- data/Thorfile +2 -2
- data/berkshelf.gemspec +6 -8
- data/features/commands/info.feature +50 -8
- data/features/commands/shelf/show.feature +10 -40
- data/features/commands/upload.feature +73 -0
- data/features/commands/vendor.feature +43 -0
- data/features/json_formatter.feature +1 -1
- data/features/step_definitions/chef_server_steps.rb +2 -2
- data/features/step_definitions/filesystem_steps.rb +16 -0
- data/features/support/env.rb +11 -10
- data/lib/berkshelf.rb +15 -20
- data/lib/berkshelf/berksfile.rb +57 -47
- data/lib/berkshelf/cached_cookbook.rb +120 -19
- data/lib/berkshelf/chef_config_compat.rb +50 -0
- data/lib/berkshelf/chef_repo_universe.rb +2 -2
- data/lib/berkshelf/cli.rb +3 -42
- data/lib/berkshelf/community_rest.rb +40 -61
- data/lib/berkshelf/config.rb +92 -118
- data/lib/berkshelf/cookbook_store.rb +3 -2
- data/lib/berkshelf/core_ext/file.rb +1 -1
- data/lib/berkshelf/dependency.rb +1 -10
- data/lib/berkshelf/downloader.rb +19 -7
- data/lib/berkshelf/errors.rb +3 -0
- data/lib/berkshelf/location.rb +1 -1
- data/lib/berkshelf/locations/base.rb +1 -1
- data/lib/berkshelf/lockfile.rb +17 -13
- data/lib/berkshelf/logger.rb +62 -1
- data/lib/berkshelf/packager.rb +1 -1
- data/lib/berkshelf/resolver.rb +1 -1
- data/lib/berkshelf/ridley_compat.rb +22 -3
- data/lib/berkshelf/uploader.rb +76 -48
- data/lib/berkshelf/version.rb +1 -1
- 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/spec_helper.rb +2 -2
- data/spec/support/chef_api.rb +4 -4
- data/spec/support/chef_server.rb +1 -1
- data/spec/support/matchers/file_system_matchers.rb +1 -3
- data/spec/support/path_helpers.rb +1 -1
- data/spec/unit/berkshelf/berksfile_spec.rb +3 -24
- data/spec/unit/berkshelf/cached_cookbook_spec.rb +13 -15
- data/spec/unit/berkshelf/community_rest_spec.rb +3 -12
- data/spec/unit/berkshelf/config_spec.rb +4 -4
- data/spec/unit/berkshelf/downloader_spec.rb +6 -11
- data/spec/unit/berkshelf/lockfile_spec.rb +10 -7
- data/spec/unit/berkshelf/source_spec.rb +1 -1
- data/spec/unit/berkshelf/ssl_policies_spec.rb +2 -5
- data/spec/unit/berkshelf/uploader_spec.rb +60 -10
- data/spec/unit/berkshelf/visualizer_spec.rb +2 -2
- metadata +49 -102
- data/features/commands/cookbook.feature +0 -35
- data/features/commands/init.feature +0 -27
- data/features/config.feature +0 -111
- data/lib/berkshelf/base_generator.rb +0 -42
- data/lib/berkshelf/cookbook_generator.rb +0 -133
- data/lib/berkshelf/init_generator.rb +0 -195
- data/lib/berkshelf/streaming_file_adapter.rb +0 -22
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +0 -108
- data/spec/unit/berkshelf/init_generator_spec.rb +0 -265
@@ -1,42 +0,0 @@
|
|
1
|
-
require "thor/group"
|
2
|
-
|
3
|
-
module Berkshelf
|
4
|
-
class BaseGenerator < Thor::Group
|
5
|
-
class << self
|
6
|
-
def source_root
|
7
|
-
Berkshelf.root.join("generator_files")
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
# A list of cookbook patterns accepted by generators inheriting from
|
12
|
-
# this generator.
|
13
|
-
#
|
14
|
-
# @return [Array<String>]
|
15
|
-
PATTERNS = %w{
|
16
|
-
environment
|
17
|
-
application
|
18
|
-
library
|
19
|
-
wrapper}.freeze
|
20
|
-
|
21
|
-
shell = Berkshelf.ui
|
22
|
-
|
23
|
-
argument :path,
|
24
|
-
type: :string,
|
25
|
-
required: true
|
26
|
-
|
27
|
-
class_option :pattern,
|
28
|
-
type: :string,
|
29
|
-
default: "application",
|
30
|
-
desc: "Modifies the generated skeleton based on the given pattern.",
|
31
|
-
aliases: "-p",
|
32
|
-
enum: BaseGenerator::PATTERNS
|
33
|
-
|
34
|
-
include Thor::Actions
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def target
|
39
|
-
@target ||= Pathname.new(File.expand_path(path))
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
module Berkshelf
|
2
|
-
class CookbookGenerator < BaseGenerator
|
3
|
-
require_relative "config"
|
4
|
-
|
5
|
-
LICENSE_MAP = {
|
6
|
-
"apachev2" => "Apache 2.0",
|
7
|
-
"gplv2" => "GNU Public License 2.0",
|
8
|
-
"gplv3" => "GNU Public License 3.0",
|
9
|
-
"mit" => "MIT",
|
10
|
-
"reserved" => "All rights reserved",
|
11
|
-
}.freeze
|
12
|
-
|
13
|
-
(LICENSES = LICENSE_MAP.keys).freeze
|
14
|
-
|
15
|
-
argument :name,
|
16
|
-
type: :string,
|
17
|
-
required: true
|
18
|
-
|
19
|
-
class_option :skip_vagrant,
|
20
|
-
type: :boolean,
|
21
|
-
default: false
|
22
|
-
|
23
|
-
class_option :skip_git,
|
24
|
-
type: :boolean,
|
25
|
-
default: false
|
26
|
-
|
27
|
-
class_option :skip_test_kitchen,
|
28
|
-
type: :boolean,
|
29
|
-
default: false,
|
30
|
-
desc: "Skip adding a testing environment to your cookbook"
|
31
|
-
|
32
|
-
class_option :foodcritic,
|
33
|
-
type: :boolean,
|
34
|
-
default: false
|
35
|
-
|
36
|
-
class_option :chef_minitest,
|
37
|
-
type: :boolean,
|
38
|
-
default: false
|
39
|
-
|
40
|
-
class_option :scmversion,
|
41
|
-
type: :boolean,
|
42
|
-
default: false
|
43
|
-
|
44
|
-
class_option :no_bundler,
|
45
|
-
type: :boolean,
|
46
|
-
default: false
|
47
|
-
|
48
|
-
class_option :license,
|
49
|
-
type: :string,
|
50
|
-
default: Berkshelf.config.cookbook.license
|
51
|
-
|
52
|
-
class_option :maintainer,
|
53
|
-
type: :string,
|
54
|
-
default: Berkshelf.config.cookbook.copyright
|
55
|
-
|
56
|
-
class_option :maintainer_email,
|
57
|
-
type: :string,
|
58
|
-
default: Berkshelf.config.cookbook.email
|
59
|
-
|
60
|
-
def generate
|
61
|
-
case options[:pattern]
|
62
|
-
when "library"
|
63
|
-
empty_directory target.join("libraries")
|
64
|
-
empty_directory target.join("providers")
|
65
|
-
empty_directory target.join("resources")
|
66
|
-
when "wrapper"
|
67
|
-
empty_directory target.join("attributes")
|
68
|
-
empty_directory target.join("recipes")
|
69
|
-
template "default_recipe.erb", target.join("recipes/default.rb")
|
70
|
-
when "environment", "application"
|
71
|
-
empty_directory target.join("files/default")
|
72
|
-
empty_directory target.join("templates/default")
|
73
|
-
empty_directory target.join("attributes")
|
74
|
-
empty_directory target.join("libraries")
|
75
|
-
empty_directory target.join("providers")
|
76
|
-
empty_directory target.join("recipes")
|
77
|
-
empty_directory target.join("resources")
|
78
|
-
template "default_recipe.erb", target.join("recipes/default.rb")
|
79
|
-
end
|
80
|
-
|
81
|
-
template "metadata.rb.erb", target.join("metadata.rb")
|
82
|
-
template license_file, target.join("LICENSE")
|
83
|
-
template "README.md.erb", target.join("README.md")
|
84
|
-
template "CHANGELOG.md.erb", target.join("CHANGELOG.md")
|
85
|
-
|
86
|
-
Berkshelf::InitGenerator.new([target], options.merge(default_options)).invoke_all
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def commented(content)
|
92
|
-
content.split("\n").collect { |s| s == "" ? "#" : "# #{s}" }.join("\n")
|
93
|
-
end
|
94
|
-
|
95
|
-
def license_name
|
96
|
-
LICENSE_MAP.fetch(options[:license]) do |license|
|
97
|
-
raise Berkshelf::LicenseNotFound.new(license)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def license
|
102
|
-
ERB.new(File.read(File.join(self.class.source_root, license_file))).result(binding)
|
103
|
-
end
|
104
|
-
|
105
|
-
def license_file
|
106
|
-
case options[:license]
|
107
|
-
when "apachev2" then "licenses/apachev2.erb"
|
108
|
-
when "gplv2" then "licenses/gplv2.erb"
|
109
|
-
when "gplv3" then "licenses/gplv3.erb"
|
110
|
-
when "mit" then "licenses/mit.erb"
|
111
|
-
when "reserved" then "licenses/reserved.erb"
|
112
|
-
else
|
113
|
-
raise Berkshelf::LicenseNotFound.new(options[:license])
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def copyright_year
|
118
|
-
Time.now.year
|
119
|
-
end
|
120
|
-
|
121
|
-
def maintainer
|
122
|
-
options[:maintainer]
|
123
|
-
end
|
124
|
-
|
125
|
-
def maintainer_email
|
126
|
-
options[:maintainer_email]
|
127
|
-
end
|
128
|
-
|
129
|
-
def default_options
|
130
|
-
{ metadata_entry: true, chefignore: true, cookbook_name: name }
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1,195 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require "kitchen/generator/init"
|
3
|
-
rescue LoadError; end
|
4
|
-
|
5
|
-
module Berkshelf
|
6
|
-
class InitGenerator < BaseGenerator
|
7
|
-
include Mixin::Git
|
8
|
-
|
9
|
-
def initialize(*args)
|
10
|
-
super(*args)
|
11
|
-
if @options[:cookbook_name]
|
12
|
-
@cookbook_name = @options[:cookbook_name]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class_option :metadata_entry,
|
17
|
-
type: :boolean,
|
18
|
-
default: true
|
19
|
-
|
20
|
-
class_option :chefignore,
|
21
|
-
type: :boolean,
|
22
|
-
default: true
|
23
|
-
|
24
|
-
class_option :skip_vagrant,
|
25
|
-
type: :boolean,
|
26
|
-
default: false,
|
27
|
-
desc: "Skips adding a Vagrantfile and adding supporting gems to the Gemfile"
|
28
|
-
|
29
|
-
class_option :skip_git,
|
30
|
-
type: :boolean,
|
31
|
-
default: false,
|
32
|
-
desc: "Skips adding a .gitignore and running git init in the cookbook directory"
|
33
|
-
|
34
|
-
class_option :foodcritic,
|
35
|
-
type: :boolean,
|
36
|
-
default: false,
|
37
|
-
desc: "Creates a Thorfile with Foodcritic support to lint test your cookbook"
|
38
|
-
|
39
|
-
class_option :chef_minitest,
|
40
|
-
type: :boolean,
|
41
|
-
default: false
|
42
|
-
|
43
|
-
class_option :scmversion,
|
44
|
-
type: :boolean,
|
45
|
-
default: false,
|
46
|
-
desc: "Creates a Thorfile with SCMVersion support to manage versions for continuous integration"
|
47
|
-
|
48
|
-
class_option :no_bundler,
|
49
|
-
type: :boolean,
|
50
|
-
default: false,
|
51
|
-
desc: "Skips generation of a Gemfile and other Bundler specific support"
|
52
|
-
|
53
|
-
class_option :cookbook_name,
|
54
|
-
type: :string
|
55
|
-
|
56
|
-
if defined?(Kitchen::Generator::Init)
|
57
|
-
class_option :skip_test_kitchen,
|
58
|
-
type: :boolean,
|
59
|
-
default: false,
|
60
|
-
desc: "Skip adding a testing environment to your cookbook"
|
61
|
-
end
|
62
|
-
|
63
|
-
def generate
|
64
|
-
validate_cookbook
|
65
|
-
validate_configuration
|
66
|
-
check_option_support
|
67
|
-
|
68
|
-
template "Berksfile.erb", target.join("Berksfile")
|
69
|
-
template "Thorfile.erb", target.join("Thorfile")
|
70
|
-
|
71
|
-
if options[:chefignore]
|
72
|
-
copy_file "chefignore", target.join(Ridley::Chef::Chefignore::FILENAME)
|
73
|
-
end
|
74
|
-
|
75
|
-
unless options[:skip_git]
|
76
|
-
template "gitignore.erb", target.join(".gitignore")
|
77
|
-
|
78
|
-
unless File.exists?(target.join(".git"))
|
79
|
-
inside target do
|
80
|
-
git "init"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
if options[:chef_minitest]
|
86
|
-
empty_directory target.join("files/default/tests/minitest/support")
|
87
|
-
template "default_test.rb.erb", target.join("files/default/tests/minitest/default_test.rb")
|
88
|
-
template "helpers.rb.erb", target.join("files/default/tests/minitest/support/helpers.rb")
|
89
|
-
end
|
90
|
-
|
91
|
-
if options[:scmversion]
|
92
|
-
create_file target.join("VERSION"), "0.1.0"
|
93
|
-
end
|
94
|
-
|
95
|
-
unless options[:no_bundler]
|
96
|
-
template "Gemfile.erb", target.join("Gemfile")
|
97
|
-
end
|
98
|
-
|
99
|
-
if defined?(Kitchen::Generator::Init)
|
100
|
-
unless options[:skip_test_kitchen]
|
101
|
-
Kitchen::Generator::Init.new([], {}, destination_root: target).invoke_all
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
unless options[:skip_vagrant]
|
106
|
-
template "Vagrantfile.erb", target.join("Vagrantfile")
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
private
|
111
|
-
|
112
|
-
def berkshelf_config
|
113
|
-
Berkshelf.config
|
114
|
-
end
|
115
|
-
|
116
|
-
# Read the cookbook name from the metadata.rb
|
117
|
-
#
|
118
|
-
# @return [String]
|
119
|
-
# name of the cookbook
|
120
|
-
def cookbook_name
|
121
|
-
@cookbook_name ||= begin
|
122
|
-
metadata = Ridley::Chef::Cookbook::Metadata.from_file(target.join("metadata.rb").to_s)
|
123
|
-
metadata.name.empty? ? File.basename(target) : metadata.name
|
124
|
-
rescue CookbookNotFound, IOError
|
125
|
-
File.basename(target)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
# Assert the current working directory is a cookbook
|
130
|
-
#
|
131
|
-
# @raise [NotACookbook] if the current working directory is
|
132
|
-
# not a cookbook
|
133
|
-
#
|
134
|
-
# @return [nil]
|
135
|
-
def validate_cookbook
|
136
|
-
path = File.expand_path(File.join(target, "metadata.rb"))
|
137
|
-
unless File.exists?(path)
|
138
|
-
raise Berkshelf::NotACookbook.new(path)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
# Assert valid configuration
|
143
|
-
#
|
144
|
-
# @raise [InvalidConfiguration] if the configuration is invalid
|
145
|
-
#
|
146
|
-
# @return [nil]
|
147
|
-
def validate_configuration
|
148
|
-
unless Berkshelf.config.valid?
|
149
|
-
raise InvalidConfiguration.new(Berkshelf.config.errors)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
# Check for supporting gems for provided options
|
154
|
-
#
|
155
|
-
# @return [Boolean]
|
156
|
-
def check_option_support
|
157
|
-
assert_option_supported(:foodcritic) &&
|
158
|
-
assert_option_supported(:scmversion, "thor-scmversion") &&
|
159
|
-
assert_default_supported(:no_bundler, "bundler")
|
160
|
-
end
|
161
|
-
|
162
|
-
# Warn if the supporting gem for an option is not installed
|
163
|
-
#
|
164
|
-
# @return [Boolean]
|
165
|
-
def assert_option_supported(option, gem_name = option.to_s)
|
166
|
-
if options[option]
|
167
|
-
begin
|
168
|
-
Gem::Specification.find_by_name(gem_name)
|
169
|
-
rescue Gem::LoadError
|
170
|
-
Berkshelf.ui.warn "This cookbook was generated with --#{option}, however, #{gem_name} is not installed."
|
171
|
-
Berkshelf.ui.warn "To make use of --#{option}: gem install #{gem_name}"
|
172
|
-
return false
|
173
|
-
end
|
174
|
-
end
|
175
|
-
true
|
176
|
-
end
|
177
|
-
|
178
|
-
# Warn if the supporting gem for a default is not installed
|
179
|
-
#
|
180
|
-
# @return [Boolean]
|
181
|
-
def assert_default_supported(option, gem_name = option.to_s)
|
182
|
-
unless options[option]
|
183
|
-
begin
|
184
|
-
Gem::Specification.find_by_name(gem_name)
|
185
|
-
rescue Gem::LoadError
|
186
|
-
Berkshelf.ui.warn "By default, this cookbook was generated to support #{gem_name}, however, #{gem_name} is not installed."
|
187
|
-
Berkshelf.ui.warn "To skip support for #{gem_name}, use --#{option.to_s.tr('_', '-')}"
|
188
|
-
Berkshelf.ui.warn "To install #{gem_name}: gem install #{gem_name}"
|
189
|
-
return false
|
190
|
-
end
|
191
|
-
end
|
192
|
-
true
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require "faraday/adapter/net_http"
|
2
|
-
|
3
|
-
module Berkshelf
|
4
|
-
class StreamingFileAdapter < Faraday::Adapter::NetHttp
|
5
|
-
def call(env)
|
6
|
-
env[:streaming_file] = env[:request_headers].delete(:streaming_file) if env[:request_headers] && env[:request_headers][:streaming_file]
|
7
|
-
super
|
8
|
-
end
|
9
|
-
|
10
|
-
def perform_request(http, env)
|
11
|
-
if env[:streaming_file]
|
12
|
-
http.request(create_request(env)) do |response|
|
13
|
-
response.read_body do |chunk|
|
14
|
-
env[:streaming_file].write(chunk) if response.code == "200"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
else
|
18
|
-
super
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Berkshelf::CookbookGenerator do
|
4
|
-
let(:name) { "sparkle_motion" }
|
5
|
-
let(:license) { "reserved" }
|
6
|
-
let(:maintainer) { "Berkshelf Core" }
|
7
|
-
let(:maintainer_email) { "core@berkshelf.com" }
|
8
|
-
|
9
|
-
let(:target) { tmp_path.join(name) }
|
10
|
-
let(:kitchen_generator) { double("kitchen-generator", invoke_all: nil) }
|
11
|
-
|
12
|
-
context "with default options" do
|
13
|
-
before do
|
14
|
-
if defined?(Kitchen::Generator::Init)
|
15
|
-
expect(Kitchen::Generator::Init).to receive(:new).with(any_args()).and_return(kitchen_generator)
|
16
|
-
end
|
17
|
-
capture(:stdout) do
|
18
|
-
Berkshelf::CookbookGenerator.new([target, name],
|
19
|
-
license: license,
|
20
|
-
maintainer: maintainer,
|
21
|
-
maintainer_email: maintainer_email
|
22
|
-
).invoke_all
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
it "generates a new cookbook" do
|
27
|
-
expect(target).to have_structure {
|
28
|
-
directory "attributes"
|
29
|
-
directory "files" do
|
30
|
-
directory "default"
|
31
|
-
end
|
32
|
-
directory "libraries"
|
33
|
-
directory "providers"
|
34
|
-
directory "recipes" do
|
35
|
-
file "default.rb" do
|
36
|
-
contains "# Cookbook Name:: sparkle_motion"
|
37
|
-
contains "# Recipe:: default"
|
38
|
-
contains "# Copyright (C) #{Time.now.year} Berkshelf Core"
|
39
|
-
contains "# All rights reserved - Do Not Redistribute"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
directory "resources"
|
43
|
-
directory "templates" do
|
44
|
-
directory "default"
|
45
|
-
end
|
46
|
-
file "LICENSE" do
|
47
|
-
contains "Copyright (C) #{Time.now.year} Berkshelf Core"
|
48
|
-
contains "All rights reserved - Do Not Redistribute"
|
49
|
-
end
|
50
|
-
file "README.md" do
|
51
|
-
contains "# sparkle_motion-cookbook"
|
52
|
-
contains "### sparkle_motion::default"
|
53
|
-
contains " <td><tt>['sparkle_motion']['bacon']</tt></td>"
|
54
|
-
contains "Include `sparkle_motion` in your node's `run_list`:"
|
55
|
-
contains ' "recipe[sparkle_motion::default]"'
|
56
|
-
contains "Author:: Berkshelf Core (<core@berkshelf.com>)"
|
57
|
-
end
|
58
|
-
file "CHANGELOG.md" do
|
59
|
-
contains "# 0.1.0"
|
60
|
-
contains "Initial release of sparkle_motion"
|
61
|
-
end
|
62
|
-
file "metadata.rb" do
|
63
|
-
contains "name 'sparkle_motion'"
|
64
|
-
contains "maintainer 'Berkshelf Core'"
|
65
|
-
contains "maintainer_email 'core@berkshelf.com'"
|
66
|
-
contains "license 'All rights reserved'"
|
67
|
-
contains "description 'Installs/Configures sparkle_motion'"
|
68
|
-
end
|
69
|
-
file "Berksfile" do
|
70
|
-
contains 'source "https://supermarket.chef.io"'
|
71
|
-
contains "metadata"
|
72
|
-
end
|
73
|
-
file "Gemfile"
|
74
|
-
file "chefignore"
|
75
|
-
}
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
context "given a 'maintainer_email' option" do
|
80
|
-
before do
|
81
|
-
capture(:stdout) do
|
82
|
-
if defined?(Kitchen::Generator::Init)
|
83
|
-
expect(Kitchen::Generator::Init).to receive(:new).with(any_args()).and_return(kitchen_generator)
|
84
|
-
end
|
85
|
-
Berkshelf::CookbookGenerator.new([target, name], maintainer_email: "jamie@vialstudios.com").invoke_all
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
it "generates a metadata.rb with the 'maintainer_email' value set" do
|
90
|
-
email = email
|
91
|
-
expect(target).to have_structure {
|
92
|
-
file "metadata.rb" do
|
93
|
-
contains "maintainer_email 'jamie@vialstudios.com'"
|
94
|
-
end
|
95
|
-
}
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context "given an invalid option for :license" do
|
100
|
-
subject(:run) do
|
101
|
-
capture(:stdout) { described_class.new([target, name], license: "not-there").invoke_all }
|
102
|
-
end
|
103
|
-
|
104
|
-
it "raises a LicenseNotFound error" do
|
105
|
-
expect { run }.to raise_error(Berkshelf::LicenseNotFound)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|