berkshelf 5.5.0 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -3
- data/Gemfile +31 -31
- data/Gemfile.lock +3 -3
- data/Guardfile +13 -13
- data/Rakefile +1 -0
- data/Thorfile +16 -16
- data/berkshelf.gemspec +35 -35
- data/features/step_definitions/chef/config_steps.rb +4 -4
- data/features/step_definitions/chef_server_steps.rb +6 -6
- data/features/step_definitions/cli_steps.rb +3 -3
- data/features/step_definitions/config_steps.rb +5 -5
- data/features/step_definitions/filesystem_steps.rb +12 -11
- data/features/support/env.rb +21 -21
- data/lib/berkshelf.rb +66 -66
- data/lib/berkshelf/base_generator.rb +10 -11
- data/lib/berkshelf/berksfile.rb +38 -38
- data/lib/berkshelf/cached_cookbook.rb +7 -7
- data/lib/berkshelf/cli.rb +126 -126
- data/lib/berkshelf/commands/shelf.rb +19 -18
- data/lib/berkshelf/commands/test_command.rb +2 -2
- data/lib/berkshelf/community_rest.rb +38 -38
- data/lib/berkshelf/config.rb +42 -41
- data/lib/berkshelf/cookbook_generator.rb +38 -38
- data/lib/berkshelf/cookbook_store.rb +4 -4
- data/lib/berkshelf/core_ext/file_utils.rb +1 -1
- data/lib/berkshelf/dependency.rb +23 -21
- data/lib/berkshelf/downloader.rb +24 -25
- data/lib/berkshelf/errors.rb +17 -17
- data/lib/berkshelf/file_syncer.rb +9 -8
- data/lib/berkshelf/formatters/human.rb +3 -3
- data/lib/berkshelf/formatters/json.rb +2 -2
- data/lib/berkshelf/init_generator.rb +64 -64
- data/lib/berkshelf/installer.rb +103 -102
- data/lib/berkshelf/location.rb +9 -9
- data/lib/berkshelf/locations/git.rb +16 -16
- data/lib/berkshelf/locations/github.rb +1 -1
- data/lib/berkshelf/locations/path.rb +2 -2
- data/lib/berkshelf/lockfile.rb +309 -315
- data/lib/berkshelf/mixin/git.rb +3 -3
- data/lib/berkshelf/packager.rb +4 -4
- data/lib/berkshelf/resolver.rb +2 -2
- data/lib/berkshelf/resolver/graph.rb +1 -1
- data/lib/berkshelf/shell.rb +1 -1
- data/lib/berkshelf/source.rb +6 -6
- data/lib/berkshelf/source_uri.rb +2 -2
- data/lib/berkshelf/ssl_policies.rb +3 -3
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/uploader.rb +48 -48
- data/lib/berkshelf/validator.rb +2 -2
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +11 -11
- data/spec/config/knife.rb +2 -2
- data/spec/fixtures/Berksfile +3 -3
- data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
- 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-0.5.0/metadata.rb +3 -3
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
- data/spec/spec_helper.rb +9 -9
- data/spec/support/chef_api.rb +11 -12
- data/spec/support/chef_server.rb +10 -10
- data/spec/support/git.rb +23 -23
- data/spec/support/kitchen.rb +2 -2
- data/spec/support/matchers/filepath_matchers.rb +2 -2
- data/spec/support/path_helpers.rb +12 -12
- data/spec/support/shared_examples/formatter.rb +1 -1
- data/spec/unit/berkshelf/berksfile_spec.rb +78 -78
- data/spec/unit/berkshelf/cached_cookbook_spec.rb +42 -42
- data/spec/unit/berkshelf/cli_spec.rb +6 -6
- data/spec/unit/berkshelf/community_rest_spec.rb +83 -83
- data/spec/unit/berkshelf/config_spec.rb +13 -13
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +39 -39
- data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +5 -6
- data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
- data/spec/unit/berkshelf/dependency_spec.rb +43 -43
- data/spec/unit/berkshelf/downloader_spec.rb +20 -20
- data/spec/unit/berkshelf/errors_spec.rb +3 -3
- data/spec/unit/berkshelf/file_syncer_spec.rb +86 -86
- 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/init_generator_spec.rb +92 -92
- 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 -35
- data/spec/unit/berkshelf/locations/git_spec.rb +87 -87
- data/spec/unit/berkshelf/locations/path_spec.rb +40 -40
- data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
- data/spec/unit/berkshelf/lockfile_spec.rb +197 -197
- 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 +1 -1
- data/spec/unit/berkshelf/resolver_spec.rb +17 -17
- data/spec/unit/berkshelf/shell_spec.rb +34 -34
- data/spec/unit/berkshelf/source_spec.rb +12 -11
- data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
- data/spec/unit/berkshelf/ssl_policies_spec.rb +25 -25
- data/spec/unit/berkshelf/uploader_spec.rb +54 -54
- data/spec/unit/berkshelf/validator_spec.rb +16 -16
- data/spec/unit/berkshelf/visualizer_spec.rb +17 -17
- data/spec/unit/berkshelf_spec.rb +18 -18
- metadata +5 -5
@@ -18,12 +18,12 @@ module Berkshelf
|
|
18
18
|
private
|
19
19
|
|
20
20
|
# @return [Hash<String, CachedCookbook>]
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
def loaded_cookbooks
|
22
|
+
@loaded_cookbooks ||= {}
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
|
-
DIRNAME_REGEXP = /^(.+)-(.+)
|
26
|
+
DIRNAME_REGEXP = /^(.+)-(.+)$/
|
27
27
|
|
28
28
|
extend Forwardable
|
29
29
|
def_delegator :metadata, :description
|
@@ -75,8 +75,8 @@ module Berkshelf
|
|
75
75
|
|
76
76
|
private
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
def pretty_map(hash, padding)
|
79
|
+
hash.map { |k, v| "#{k} (#{v})" }.join("\n" + " " * padding)
|
80
|
+
end
|
81
81
|
end
|
82
82
|
end
|
data/lib/berkshelf/cli.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
1
|
+
require "berkshelf"
|
2
|
+
require_relative "config"
|
3
|
+
require_relative "init_generator"
|
4
|
+
require_relative "cookbook_generator"
|
5
|
+
require_relative "commands/shelf"
|
6
|
+
require_relative "commands/test_command"
|
7
7
|
|
8
8
|
module Berkshelf
|
9
9
|
class Cli < Thor
|
@@ -28,11 +28,11 @@ module Berkshelf
|
|
28
28
|
@kernel.exit(0)
|
29
29
|
rescue Berkshelf::BerkshelfError => e
|
30
30
|
Berkshelf.ui.error e
|
31
|
-
Berkshelf.ui.error "\t" + e.backtrace.join("\n\t") if ENV[
|
31
|
+
Berkshelf.ui.error "\t" + e.backtrace.join("\n\t") if ENV["BERKSHELF_DEBUG"]
|
32
32
|
@kernel.exit(e.status_code)
|
33
33
|
rescue Ridley::Errors::RidleyError => e
|
34
34
|
Berkshelf.ui.error "#{e.class} #{e}"
|
35
|
-
Berkshelf.ui.error "\t" + e.backtrace.join("\n\t") if ENV[
|
35
|
+
Berkshelf.ui.error "\t" + e.backtrace.join("\n\t") if ENV["BERKSHELF_DEBUG"]
|
36
36
|
@kernel.exit(47)
|
37
37
|
end
|
38
38
|
end
|
@@ -44,13 +44,13 @@ module Berkshelf
|
|
44
44
|
command = given_args.first
|
45
45
|
|
46
46
|
if self.subcommands.include?(command)
|
47
|
-
super(meth, [command,
|
47
|
+
super(meth, [command, "help"].compact, nil, config)
|
48
48
|
else
|
49
|
-
super(meth, [
|
49
|
+
super(meth, ["help", command].compact, nil, config)
|
50
50
|
end
|
51
51
|
else
|
52
52
|
super
|
53
|
-
Berkshelf.formatter.cleanup_hook unless config[:current_command].name ==
|
53
|
+
Berkshelf.formatter.cleanup_hook unless config[:current_command].name == "help"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -79,58 +79,58 @@ module Berkshelf
|
|
79
79
|
@options = options.dup # unfreeze frozen options Hash from Thor
|
80
80
|
end
|
81
81
|
|
82
|
-
namespace
|
82
|
+
namespace "berkshelf"
|
83
83
|
|
84
|
-
map
|
85
|
-
map
|
86
|
-
map
|
87
|
-
map
|
88
|
-
map
|
89
|
-
map [
|
84
|
+
map "in" => :install
|
85
|
+
map "up" => :upload
|
86
|
+
map "ud" => :update
|
87
|
+
map "ls" => :list
|
88
|
+
map "book" => :cookbook
|
89
|
+
map ["ver", "-v", "--version"] => :version
|
90
90
|
|
91
91
|
default_task :install
|
92
92
|
|
93
93
|
class_option :config,
|
94
94
|
type: :string,
|
95
|
-
desc:
|
96
|
-
aliases:
|
97
|
-
banner:
|
95
|
+
desc: "Path to Berkshelf configuration to use.",
|
96
|
+
aliases: "-c",
|
97
|
+
banner: "PATH"
|
98
98
|
class_option :format,
|
99
99
|
type: :string,
|
100
|
-
default:
|
101
|
-
desc:
|
102
|
-
aliases:
|
103
|
-
banner:
|
100
|
+
default: "human",
|
101
|
+
desc: "Output format to use.",
|
102
|
+
aliases: "-F",
|
103
|
+
banner: "FORMAT"
|
104
104
|
class_option :quiet,
|
105
105
|
type: :boolean,
|
106
|
-
desc:
|
107
|
-
aliases:
|
106
|
+
desc: "Silence all informational output.",
|
107
|
+
aliases: "-q",
|
108
108
|
default: false
|
109
109
|
class_option :debug,
|
110
110
|
type: :boolean,
|
111
|
-
desc:
|
112
|
-
aliases:
|
111
|
+
desc: "Output debug information",
|
112
|
+
aliases: "-d",
|
113
113
|
default: false
|
114
114
|
|
115
115
|
method_option :except,
|
116
116
|
type: :array,
|
117
|
-
desc:
|
118
|
-
aliases:
|
117
|
+
desc: "Exclude cookbooks that are in these groups.",
|
118
|
+
aliases: "-e"
|
119
119
|
method_option :only,
|
120
120
|
type: :array,
|
121
|
-
desc:
|
122
|
-
aliases:
|
121
|
+
desc: "Only cookbooks that are in these groups.",
|
122
|
+
aliases: "-o"
|
123
123
|
method_option :berksfile,
|
124
124
|
type: :string,
|
125
125
|
default: nil,
|
126
|
-
desc:
|
127
|
-
aliases:
|
128
|
-
banner:
|
126
|
+
desc: "Path to a Berksfile to operate off of.",
|
127
|
+
aliases: "-b",
|
128
|
+
banner: "PATH"
|
129
129
|
method_option :path,
|
130
130
|
type: :string,
|
131
|
-
aliases:
|
131
|
+
aliases: "-p",
|
132
132
|
hide: true
|
133
|
-
desc
|
133
|
+
desc "install", "Install the cookbooks specified in the Berksfile"
|
134
134
|
def install
|
135
135
|
if options[:path]
|
136
136
|
# TODO: Remove in Berkshelf 4.0
|
@@ -146,18 +146,18 @@ module Berkshelf
|
|
146
146
|
method_option :berksfile,
|
147
147
|
type: :string,
|
148
148
|
default: nil,
|
149
|
-
desc:
|
150
|
-
aliases:
|
151
|
-
banner:
|
149
|
+
desc: "Path to a Berksfile to operate off of.",
|
150
|
+
aliases: "-b",
|
151
|
+
banner: "PATH"
|
152
152
|
method_option :except,
|
153
153
|
type: :array,
|
154
|
-
desc:
|
155
|
-
aliases:
|
154
|
+
desc: "Exclude cookbooks that are in these groups.",
|
155
|
+
aliases: "-e"
|
156
156
|
method_option :only,
|
157
157
|
type: :array,
|
158
|
-
desc:
|
159
|
-
aliases:
|
160
|
-
desc
|
158
|
+
desc: "Only cookbooks that are in these groups.",
|
159
|
+
aliases: "-o"
|
160
|
+
desc "update [COOKBOOKS]", "Update the cookbooks (and dependencies) specified in the Berksfile"
|
161
161
|
def update(*cookbook_names)
|
162
162
|
berksfile = Berksfile.from_options(options)
|
163
163
|
berksfile.update(*cookbook_names)
|
@@ -166,39 +166,39 @@ module Berkshelf
|
|
166
166
|
method_option :berksfile,
|
167
167
|
type: :string,
|
168
168
|
default: nil,
|
169
|
-
desc:
|
170
|
-
aliases:
|
171
|
-
banner:
|
169
|
+
desc: "Path to a Berksfile to operate off of.",
|
170
|
+
aliases: "-b",
|
171
|
+
banner: "PATH"
|
172
172
|
method_option :except,
|
173
173
|
type: :array,
|
174
|
-
desc:
|
175
|
-
aliases:
|
174
|
+
desc: "Exclude cookbooks that are in these groups.",
|
175
|
+
aliases: "-e"
|
176
176
|
method_option :only,
|
177
177
|
type: :array,
|
178
|
-
desc:
|
179
|
-
aliases:
|
178
|
+
desc: "Only cookbooks that are in these groups.",
|
179
|
+
aliases: "-o"
|
180
180
|
method_option :no_freeze,
|
181
181
|
type: :boolean,
|
182
182
|
default: false,
|
183
|
-
desc:
|
183
|
+
desc: "Do not freeze uploaded cookbook(s)."
|
184
184
|
method_option :force,
|
185
185
|
type: :boolean,
|
186
186
|
default: false,
|
187
|
-
desc:
|
187
|
+
desc: "Upload all cookbooks even if a frozen one exists on the Chef Server."
|
188
188
|
method_option :ssl_verify,
|
189
189
|
type: :boolean,
|
190
190
|
default: nil,
|
191
|
-
desc:
|
191
|
+
desc: "Disable/Enable SSL verification when uploading cookbooks."
|
192
192
|
method_option :skip_syntax_check,
|
193
193
|
type: :boolean,
|
194
194
|
default: false,
|
195
|
-
desc:
|
196
|
-
aliases:
|
195
|
+
desc: "Skip Ruby syntax check when uploading cookbooks.",
|
196
|
+
aliases: "-s"
|
197
197
|
method_option :halt_on_frozen,
|
198
198
|
type: :boolean,
|
199
199
|
default: false,
|
200
|
-
desc:
|
201
|
-
desc
|
200
|
+
desc: "Exit with a non zero exit code if the Chef Server already has the version of the cookbook(s)."
|
201
|
+
desc "upload [COOKBOOKS]", "Upload the cookbook specified in the Berksfile to the Chef Server"
|
202
202
|
def upload(*names)
|
203
203
|
berksfile = Berksfile.from_options(options)
|
204
204
|
|
@@ -210,19 +210,19 @@ module Berkshelf
|
|
210
210
|
|
211
211
|
method_option :envfile,
|
212
212
|
type: :string,
|
213
|
-
desc:
|
214
|
-
aliases:
|
213
|
+
desc: "Path to a JSON environment file to update.",
|
214
|
+
aliases: "-f"
|
215
215
|
method_option :lockfile,
|
216
216
|
type: :string,
|
217
217
|
default: Berkshelf::Lockfile::DEFAULT_FILENAME,
|
218
|
-
desc:
|
219
|
-
aliases:
|
220
|
-
banner:
|
218
|
+
desc: "Path to a Berksfile.lock to operate off of.",
|
219
|
+
aliases: "-b",
|
220
|
+
banner: "PATH"
|
221
221
|
method_option :ssl_verify,
|
222
222
|
type: :boolean,
|
223
223
|
default: nil,
|
224
|
-
desc:
|
225
|
-
desc
|
224
|
+
desc: "Disable/Enable SSL verification when locking cookbooks."
|
225
|
+
desc "apply ENVIRONMENT", "Apply version locks from Berksfile.lock to a Chef environment"
|
226
226
|
def apply(environment_name)
|
227
227
|
unless File.exist?(options[:lockfile])
|
228
228
|
raise LockfileNotFound, "No lockfile found at #{options[:lockfile]}"
|
@@ -237,18 +237,18 @@ module Berkshelf
|
|
237
237
|
method_option :berksfile,
|
238
238
|
type: :string,
|
239
239
|
default: nil,
|
240
|
-
desc:
|
241
|
-
aliases:
|
242
|
-
banner:
|
240
|
+
desc: "Path to a Berksfile to operate off of.",
|
241
|
+
aliases: "-b",
|
242
|
+
banner: "PATH"
|
243
243
|
method_option :except,
|
244
244
|
type: :array,
|
245
|
-
desc:
|
246
|
-
aliases:
|
245
|
+
desc: "Exclude cookbooks that are in these groups.",
|
246
|
+
aliases: "-e"
|
247
247
|
method_option :only,
|
248
248
|
type: :array,
|
249
|
-
desc:
|
250
|
-
aliases:
|
251
|
-
desc
|
249
|
+
desc: "Only cookbooks that are in these groups.",
|
250
|
+
aliases: "-o"
|
251
|
+
desc "outdated [COOKBOOKS]", "List dependencies that have new versions available that satisfy their constraints"
|
252
252
|
def outdated(*names)
|
253
253
|
berksfile = Berksfile.from_options(options)
|
254
254
|
outdated = berksfile.outdated(*names)
|
@@ -258,45 +258,45 @@ module Berkshelf
|
|
258
258
|
method_option :source,
|
259
259
|
type: :string,
|
260
260
|
default: Berksfile::DEFAULT_API_URL,
|
261
|
-
desc:
|
262
|
-
banner:
|
263
|
-
desc
|
261
|
+
desc: "URL to search for sources",
|
262
|
+
banner: "URL"
|
263
|
+
desc "search NAME", "Search the remote source for cookbooks matching the partial name"
|
264
264
|
def search(name)
|
265
265
|
source = Source.new(options[:source])
|
266
266
|
cookbooks = source.search(name)
|
267
267
|
Berkshelf.formatter.search(cookbooks)
|
268
268
|
end
|
269
269
|
|
270
|
-
desc
|
271
|
-
def init(path =
|
270
|
+
desc "init [PATH]", "Initialize Berkshelf in the given directory"
|
271
|
+
def init(path = ".")
|
272
272
|
Berkshelf.formatter.deprecation <<EOF
|
273
273
|
This command is being deprecated in favor of `chef generate cookbook` and will soon return an error.
|
274
274
|
Please use `chef generate cookbook` instead of this command.
|
275
275
|
EOF
|
276
|
-
Berkshelf.formatter.deprecation
|
277
|
-
Berkshelf.formatter.deprecation
|
276
|
+
Berkshelf.formatter.deprecation "--git is now the default" if options[:git]
|
277
|
+
Berkshelf.formatter.deprecation "--vagrant is now the default" if options[:vagrant]
|
278
278
|
|
279
279
|
Berkshelf::InitGenerator.new([path], options).invoke_all
|
280
280
|
|
281
|
-
Berkshelf.formatter.msg
|
281
|
+
Berkshelf.formatter.msg "Successfully initialized"
|
282
282
|
end
|
283
|
-
tasks[
|
283
|
+
tasks["init"].options = Berkshelf::InitGenerator.class_options
|
284
284
|
|
285
285
|
method_option :berksfile,
|
286
286
|
type: :string,
|
287
287
|
default: nil,
|
288
|
-
desc:
|
289
|
-
aliases:
|
290
|
-
banner:
|
288
|
+
desc: "Path to a Berksfile to operate off of.",
|
289
|
+
aliases: "-b",
|
290
|
+
banner: "PATH"
|
291
291
|
method_option :except,
|
292
292
|
type: :array,
|
293
|
-
desc:
|
294
|
-
aliases:
|
293
|
+
desc: "Exclude cookbooks that are in these groups.",
|
294
|
+
aliases: "-e"
|
295
295
|
method_option :only,
|
296
296
|
type: :array,
|
297
|
-
desc:
|
298
|
-
aliases:
|
299
|
-
desc
|
297
|
+
desc: "Only cookbooks that are in these groups.",
|
298
|
+
aliases: "-o"
|
299
|
+
desc "list", "List cookbooks and their dependencies specified by your Berksfile"
|
300
300
|
def list
|
301
301
|
berksfile = Berksfile.from_options(options)
|
302
302
|
Berkshelf.formatter.list(berksfile.list)
|
@@ -331,10 +331,10 @@ EOF
|
|
331
331
|
method_option :berksfile,
|
332
332
|
type: :string,
|
333
333
|
default: nil,
|
334
|
-
desc:
|
335
|
-
aliases:
|
336
|
-
banner:
|
337
|
-
desc
|
334
|
+
desc: "Path to a Berksfile to operate off of.",
|
335
|
+
aliases: "-b",
|
336
|
+
banner: "PATH"
|
337
|
+
desc "contingent COOKBOOK", "List all cookbooks that depend on the given cookbook in your Berksfile"
|
338
338
|
def contingent(name)
|
339
339
|
berksfile = Berksfile.from_options(options)
|
340
340
|
dependencies = berksfile.cookbooks.select do |cookbook|
|
@@ -352,9 +352,9 @@ EOF
|
|
352
352
|
method_option :berksfile,
|
353
353
|
type: :string,
|
354
354
|
default: nil,
|
355
|
-
desc:
|
356
|
-
aliases:
|
357
|
-
banner:
|
355
|
+
desc: "Path to a Berksfile to operate off of.",
|
356
|
+
aliases: "-b",
|
357
|
+
banner: "PATH"
|
358
358
|
method_option :except,
|
359
359
|
type: :array,
|
360
360
|
desc: "Exclude cookbooks that are in these groups.",
|
@@ -377,22 +377,22 @@ EOF
|
|
377
377
|
|
378
378
|
method_option :except,
|
379
379
|
type: :array,
|
380
|
-
desc:
|
381
|
-
aliases:
|
380
|
+
desc: "Exclude cookbooks that are in these groups.",
|
381
|
+
aliases: "-e"
|
382
382
|
method_option :delete,
|
383
383
|
type: :boolean,
|
384
384
|
desc: "Clean the target directory before vendoring",
|
385
385
|
default: false
|
386
386
|
method_option :only,
|
387
387
|
type: :array,
|
388
|
-
desc:
|
389
|
-
aliases:
|
388
|
+
desc: "Only cookbooks that are in these groups.",
|
389
|
+
aliases: "-o"
|
390
390
|
method_option :berksfile,
|
391
391
|
type: :string,
|
392
392
|
default: nil,
|
393
|
-
desc:
|
394
|
-
aliases:
|
395
|
-
banner:
|
393
|
+
desc: "Path to a Berksfile to operate off of.",
|
394
|
+
aliases: "-b",
|
395
|
+
banner: "PATH"
|
396
396
|
desc "vendor [PATH]", "Vendor the cookbooks specified by the Berksfile into a directory"
|
397
397
|
def vendor(path = File.join(Dir.pwd, "berks-cookbooks"))
|
398
398
|
berksfile = Berkshelf::Berksfile.from_options(options)
|
@@ -412,21 +412,21 @@ EOF
|
|
412
412
|
method_option :berksfile,
|
413
413
|
type: :string,
|
414
414
|
default: nil,
|
415
|
-
desc:
|
416
|
-
aliases:
|
417
|
-
banner:
|
415
|
+
desc: "Path to a Berksfile to operate off of.",
|
416
|
+
aliases: "-b",
|
417
|
+
banner: "PATH"
|
418
418
|
method_option :outfile,
|
419
419
|
type: :string,
|
420
|
-
default:
|
421
|
-
desc:
|
422
|
-
aliases:
|
423
|
-
banner:
|
420
|
+
default: "graph.png",
|
421
|
+
desc: "The name of the output file",
|
422
|
+
aliases: "-o",
|
423
|
+
banner: "NAME"
|
424
424
|
method_option :outfile_format,
|
425
425
|
type: :string,
|
426
|
-
default:
|
427
|
-
desc:
|
428
|
-
aliases:
|
429
|
-
banner:
|
426
|
+
default: "png",
|
427
|
+
desc: "The format of the output file, either png or dot.",
|
428
|
+
aliases: "-f",
|
429
|
+
banner: "FORMAT"
|
430
430
|
desc "viz", "Visualize the dependency graph"
|
431
431
|
def viz
|
432
432
|
berksfile = Berksfile.from_options(options)
|
@@ -435,24 +435,24 @@ EOF
|
|
435
435
|
Berkshelf.ui.info(path)
|
436
436
|
end
|
437
437
|
|
438
|
-
desc
|
438
|
+
desc "version", "Display version"
|
439
439
|
def version
|
440
440
|
Berkshelf.formatter.version
|
441
441
|
end
|
442
442
|
|
443
|
-
desc
|
443
|
+
desc "cookbook NAME [PATH]", "Create a skeleton for a new cookbook"
|
444
444
|
def cookbook(name, path = nil)
|
445
445
|
Berkshelf.formatter.deprecation <<EOF
|
446
446
|
This command is being deprecated in favor of `chef generate cookbook` and will soon return an error.
|
447
447
|
Please use `chef generate cookbook` instead of this command.
|
448
448
|
EOF
|
449
449
|
path = File.join(Dir.pwd, name) if path.nil?
|
450
|
-
Berkshelf.formatter.deprecation
|
451
|
-
Berkshelf.formatter.deprecation
|
450
|
+
Berkshelf.formatter.deprecation "--git is now the default" if options[:git]
|
451
|
+
Berkshelf.formatter.deprecation "--vagrant is now the default" if options[:vagrant]
|
452
452
|
|
453
453
|
Berkshelf::CookbookGenerator.new([path, name], options).invoke_all
|
454
454
|
end
|
455
|
-
tasks[
|
455
|
+
tasks["cookbook"].options = Berkshelf::CookbookGenerator.class_options
|
456
456
|
|
457
457
|
private
|
458
458
|
|
@@ -461,10 +461,10 @@ EOF
|
|
461
461
|
#
|
462
462
|
# @param [Array<CachedCookbook>] cookbooks
|
463
463
|
#
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
end
|
464
|
+
def print_list(cookbooks)
|
465
|
+
Array(cookbooks).sort.each do |cookbook|
|
466
|
+
Berkshelf.formatter.msg " * #{cookbook.cookbook_name} (#{cookbook.version})"
|
468
467
|
end
|
468
|
+
end
|
469
469
|
end
|
470
470
|
end
|