chef-cli 3.0.7 → 3.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/chef-cli.gemspec +1 -2
- data/lib/chef-cli/cli.rb +13 -32
- data/lib/chef-cli/command/generator_commands/chef_exts/generator_desc_resource.rb +1 -0
- data/lib/chef-cli/command/update.rb +1 -1
- data/lib/chef-cli/cookbook_profiler/git.rb +1 -1
- data/lib/chef-cli/dist.rb +5 -0
- data/lib/chef-cli/policyfile/chef_server_lock_fetcher.rb +1 -1
- data/lib/chef-cli/policyfile/cookbook_locks.rb +2 -2
- data/lib/chef-cli/policyfile/delivery_supermarket_source.rb +1 -1
- data/lib/chef-cli/policyfile/local_lock_fetcher.rb +1 -1
- data/lib/chef-cli/policyfile/policyfile_location_specification.rb +1 -1
- data/lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb +2 -2
- data/lib/chef-cli/policyfile_compiler.rb +1 -1
- data/lib/chef-cli/policyfile_lock.rb +1 -2
- data/lib/chef-cli/skeletons/code_generator/files/default/chefignore +13 -7
- data/lib/chef-cli/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +1 -1
- data/lib/chef-cli/version.rb +1 -1
- data/lib/kitchen/provisioner/chef_zero_capture.rb +3 -4
- data/lib/kitchen/provisioner/policyfile_zero.rb +1 -2
- data/spec/unit/cli_spec.rb +15 -54
- data/spec/unit/command/clean_policy_cookbooks_spec.rb +2 -2
- data/spec/unit/command/env_spec.rb +1 -1
- data/spec/unit/command/exec_spec.rb +1 -1
- data/spec/unit/commands_map_spec.rb +4 -4
- data/spec/unit/kitchen/provisioner/chef_zero_capture_spec.rb +0 -1
- data/spec/unit/policyfile_includes_spec.rb +0 -1
- data/spec/unit/policyfile_install_with_includes_spec.rb +0 -1
- data/spec/unit/policyfile_lock_build_spec.rb +0 -1
- metadata +10 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ba95803ebaddd3034b21130fda13e0a001c5ef02b304897d7808c0286268d9b
|
4
|
+
data.tar.gz: 7c64aed7f98666dc5677f11036cbbb7671cc9d8d09f410f25222332c1fd10ac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a42c1780fe0865c527c8787bd1122abcb06867b0f3e01e142684ac2cda519215c9801d031c6266ac94c7965d890dd5c6e0af8eebb195aecdfd0fa36f0691422c
|
7
|
+
data.tar.gz: 3133b68e4e51bd548e180bdbf3d8bae0735834118e0c9b81a781b0e869196a4108ea72ea38904cc1662a3d1863af4dcdf92a5508073efcd53408e7704f792c9e
|
data/Gemfile
CHANGED
@@ -13,8 +13,8 @@ group :test do
|
|
13
13
|
gem "rspec", "~> 3.8"
|
14
14
|
gem "rspec-expectations", "~> 3.8"
|
15
15
|
gem "rspec-mocks", "~> 3.8"
|
16
|
-
gem "cookstyle"
|
17
|
-
gem "chefstyle"
|
16
|
+
gem "cookstyle", "6.13.3" # this forces dependabot PRs to open which triggers cookstyle CI on the chef generate command
|
17
|
+
gem "chefstyle", "1.2.0"
|
18
18
|
gem "test-kitchen", "> 2.5"
|
19
19
|
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
|
20
20
|
gem "chef-zero", "~> 14"
|
data/chef-cli.gemspec
CHANGED
@@ -47,8 +47,7 @@ Gem::Specification.new do |gem|
|
|
47
47
|
gem.add_dependency "solve", "< 5.0", "> 2.0"
|
48
48
|
gem.add_dependency "addressable", ">= 2.3.5", "< 2.8"
|
49
49
|
gem.add_dependency "cookbook-omnifetch", "~> 0.5"
|
50
|
-
gem.add_dependency "diff-lcs", "
|
50
|
+
gem.add_dependency "diff-lcs", ">= 1.0", "< 1.4" # 1.4 changes the output
|
51
51
|
gem.add_dependency "paint", ">= 1", "< 3"
|
52
52
|
gem.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.11"
|
53
|
-
gem.add_dependency "ffi", "< 1.13"
|
54
53
|
end
|
data/lib/chef-cli/cli.rb
CHANGED
@@ -99,42 +99,21 @@ module ChefCLI
|
|
99
99
|
if omnibus_install?
|
100
100
|
show_version_via_version_manifest
|
101
101
|
else
|
102
|
-
|
102
|
+
msg("#{ChefCLI::Dist::CLI_PRODUCT} version: #{ChefCLI::VERSION}")
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
def show_version_via_version_manifest
|
107
|
-
msg("#{ChefCLI::Dist::PRODUCT} version: #{
|
108
|
-
|
109
|
-
|
110
|
-
"#{ChefCLI::Dist::
|
107
|
+
msg("#{ChefCLI::Dist::PRODUCT} version: #{component_version("build_version")}")
|
108
|
+
|
109
|
+
{ "#{ChefCLI::Dist::INFRA_CLIENT_PRODUCT}": ChefCLI::Dist::INFRA_CLIENT_GEM,
|
110
|
+
"#{ChefCLI::Dist::INSPEC_PRODUCT}": ChefCLI::Dist::INSPEC_CLI,
|
111
|
+
"#{ChefCLI::Dist::CLI_PRODUCT}": ChefCLI::Dist::CLI_GEM,
|
112
|
+
"#{ChefCLI::Dist::HAB_PRODUCT}": ChefCLI::Dist::HAB_SOFTWARE_NAME,
|
111
113
|
"Test Kitchen": "test-kitchen",
|
112
114
|
"Cookstyle": "cookstyle",
|
113
|
-
}.each do |
|
114
|
-
msg("#{
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def show_version_via_shell_out
|
119
|
-
msg("#{ChefCLI::Dist::PRODUCT} version: #{ChefCLI::VERSION}")
|
120
|
-
{ "#{ChefCLI::Dist::INFRA_CLIENT_PRODUCT}": "#{ChefCLI::Dist::INFRA_CLIENT_CLI}",
|
121
|
-
"#{ChefCLI::Dist::INSPEC_PRODUCT}": "#{ChefCLI::Dist::INSPEC_CLI}",
|
122
|
-
"Test Kitchen": "kitchen",
|
123
|
-
"Cookstyle": "cookstyle",
|
124
|
-
}.each do |name, cli|
|
125
|
-
# @todo when Ruby 2.5/2.6 support goes away this if statement can go away
|
126
|
-
if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new("2")
|
127
|
-
result = Bundler.with_unbundled_env { shell_out("#{cli} --version") }
|
128
|
-
else
|
129
|
-
result = Bundler.with_clean_env { shell_out("#{cli} --version") }
|
130
|
-
end
|
131
|
-
|
132
|
-
if result.exitstatus != 0
|
133
|
-
msg("#{name} version: ERROR")
|
134
|
-
else
|
135
|
-
version = result.stdout.lines.first.scan(/(?:master\s)?[\d+\.\(\)]+\S+/).join("\s")
|
136
|
-
msg("#{name} version: #{version}")
|
137
|
-
end
|
115
|
+
}.each do |prod_name, component|
|
116
|
+
msg("#{prod_name} version: #{component_version(component)}")
|
138
117
|
end
|
139
118
|
end
|
140
119
|
|
@@ -188,11 +167,13 @@ module ChefCLI
|
|
188
167
|
end
|
189
168
|
end
|
190
169
|
|
191
|
-
def
|
170
|
+
def component_version(name)
|
192
171
|
if gem_manifest_hash[name].is_a?(Array)
|
193
172
|
gem_manifest_hash[name].first
|
173
|
+
elsif manifest_hash.key? name
|
174
|
+
manifest_field(name)
|
194
175
|
else
|
195
|
-
"unknown"
|
176
|
+
manifest_hash.dig("software", name, "locked_version") || "unknown"
|
196
177
|
end
|
197
178
|
end
|
198
179
|
|
@@ -70,7 +70,7 @@ module ChefCLI
|
|
70
70
|
|
71
71
|
option :exclude_deps,
|
72
72
|
long: "--exclude-deps",
|
73
|
-
description: "Only update cookbooks
|
73
|
+
description: "Only update cookbooks explicitly mentioned on the command line",
|
74
74
|
boolean: true,
|
75
75
|
default: false
|
76
76
|
|
@@ -31,7 +31,7 @@ module ChefCLI
|
|
31
31
|
@unborn_branch_ref = nil
|
32
32
|
end
|
33
33
|
|
34
|
-
# @return [Hash] Hashed used for pinning cookbook versions within a
|
34
|
+
# @return [Hash] Hashed used for pinning cookbook versions within a Policyfile.lock
|
35
35
|
def profile_data
|
36
36
|
{
|
37
37
|
"scm" => "git",
|
data/lib/chef-cli/dist.rb
CHANGED
@@ -400,8 +400,8 @@ module ChefCLI
|
|
400
400
|
|
401
401
|
dot_git = Pathname.new(".git")
|
402
402
|
Pathname.new(cookbook_path).ascend do |parent_dir|
|
403
|
-
|
404
|
-
if
|
403
|
+
possible_git_dir = parent_dir + dot_git
|
404
|
+
if possible_git_dir.exist?
|
405
405
|
@cookbook_in_git_repo = true
|
406
406
|
break
|
407
407
|
end
|
@@ -39,7 +39,7 @@ module ChefCLI
|
|
39
39
|
# * Version numbers for cookbooks that pass through the Ci pipeline always
|
40
40
|
# increase over time (so that largest version number == newest)
|
41
41
|
#
|
42
|
-
# In the future, alternative approaches may be
|
42
|
+
# In the future, alternative approaches may be pursued to achieve the goal
|
43
43
|
# of continuously integrating at the cookbook level without imposing those
|
44
44
|
# constraints.
|
45
45
|
#
|
@@ -89,9 +89,9 @@ module ChefCLI
|
|
89
89
|
@cookbook_version ||=
|
90
90
|
begin
|
91
91
|
cookbook_version = loader.cookbook_version
|
92
|
-
# TODO:
|
92
|
+
# TODO: don't do this for non-compat mode
|
93
93
|
cookbook_version.version = version_override
|
94
|
-
# TODO:
|
94
|
+
# TODO: don't do this either
|
95
95
|
|
96
96
|
# Fixup manifest.
|
97
97
|
# What happens is, the 'manifest' representation of cookbook
|
@@ -274,7 +274,7 @@ module ChefCLI
|
|
274
274
|
# compared to an unmodified copy upstream. For example, the community site
|
275
275
|
# may have a cookbook "apache2" at version "1.10.4", which the user has
|
276
276
|
# forked on github and modified the dependencies without changing the
|
277
|
-
# version number. To
|
277
|
+
# version number. To accommodate this, the local_artifacts_graph should be
|
278
278
|
# merged over the upstream's artifacts graph.
|
279
279
|
def local_artifacts_graph
|
280
280
|
cookbook_location_specs.inject({}) do |local_artifacts, (cookbook_name, cookbook_location_spec)|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
2
1
|
#
|
3
2
|
# Copyright:: Copyright (c) 2014-2018 Chef Software Inc.
|
4
3
|
# License:: Apache License, Version 2.0
|
@@ -362,7 +361,7 @@ module ChefCLI
|
|
362
361
|
# doubles give 15-17 digits of precision, so we err on the safe side
|
363
362
|
# and only use 15 digits in the string conversion. We use the `g`
|
364
363
|
# format, which is a documented-enough "do what I mean" where floats
|
365
|
-
# >= 0.1 and <
|
364
|
+
# >= 0.1 and < precision are represented as floating point literals, and
|
366
365
|
# other numbers use the exponent notation with a lowercase 'e'. Note
|
367
366
|
# that both Ruby and Erlang document what their `g` does but have some
|
368
367
|
# differences both subtle and non-subtle:
|
@@ -9,10 +9,7 @@ ehthumbs.db
|
|
9
9
|
Icon?
|
10
10
|
nohup.out
|
11
11
|
Thumbs.db
|
12
|
-
|
13
|
-
# SASS #
|
14
|
-
########
|
15
|
-
.sass-cache
|
12
|
+
.envrc
|
16
13
|
|
17
14
|
# EDITORS #
|
18
15
|
###########
|
@@ -26,11 +23,11 @@ Thumbs.db
|
|
26
23
|
*.tmproj
|
27
24
|
*~
|
28
25
|
\#*
|
29
|
-
mkmf.log
|
30
26
|
REVISION
|
31
27
|
TAGS*
|
32
28
|
tmtags
|
33
29
|
.vscode
|
30
|
+
.editorconfig
|
34
31
|
|
35
32
|
## COMPILED ##
|
36
33
|
##############
|
@@ -43,22 +40,29 @@ tmtags
|
|
43
40
|
*.so
|
44
41
|
*/rdoc/
|
45
42
|
a.out
|
43
|
+
mkmf.log
|
46
44
|
|
47
45
|
# Testing #
|
48
46
|
###########
|
49
47
|
.circleci/*
|
50
48
|
.codeclimate.yml
|
49
|
+
.delivery/*
|
51
50
|
.foodcritic
|
52
51
|
.kitchen*
|
52
|
+
.mdlrc
|
53
|
+
.overcommit.yml
|
53
54
|
.rspec
|
54
55
|
.rubocop.yml
|
55
56
|
.travis.yml
|
56
57
|
.watchr
|
58
|
+
.yamllint
|
57
59
|
azure-pipelines.yml
|
60
|
+
Dangerfile
|
58
61
|
examples/*
|
59
62
|
features/*
|
60
63
|
Guardfile
|
61
64
|
kitchen.yml*
|
65
|
+
mlc_config.json
|
62
66
|
Procfile
|
63
67
|
Rakefile
|
64
68
|
spec/*
|
@@ -71,6 +75,7 @@ test/*
|
|
71
75
|
.gitconfig
|
72
76
|
.github/*
|
73
77
|
.gitignore
|
78
|
+
.gitkeep
|
74
79
|
.gitmodules
|
75
80
|
.svn
|
76
81
|
*/.bzr/*
|
@@ -98,10 +103,11 @@ Policyfile.lock.json
|
|
98
103
|
|
99
104
|
# Documentation #
|
100
105
|
#############
|
101
|
-
|
106
|
+
CODE_OF_CONDUCT*
|
102
107
|
CONTRIBUTING*
|
108
|
+
documentation/*
|
103
109
|
TESTING*
|
104
|
-
|
110
|
+
UPGRADING*
|
105
111
|
|
106
112
|
# Vagrant #
|
107
113
|
###########
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# InSpec test for recipe <%= cookbook_name %>::<%= recipe_name %>
|
2
2
|
|
3
3
|
# The InSpec reference, with examples and extensive documentation, can be
|
4
|
-
# found at https://
|
4
|
+
# found at https://docs.chef.io/inspec/resources/
|
5
5
|
|
6
6
|
unless os.windows?
|
7
7
|
# This is an example test, replace with your own test.
|
data/lib/chef-cli/version.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Marc Paradise <marc@chef.io>
|
4
3
|
#
|
@@ -45,7 +44,7 @@ module Kitchen
|
|
45
44
|
#
|
46
45
|
# This provisioner does not do any cookbook dependency
|
47
46
|
# resolution and will not pull in external cookbooks. All cookbooks
|
48
|
-
# or cookbook
|
47
|
+
# or cookbook artifacts + policy data as captured from the live node and are
|
49
48
|
# expected to be available for chef-zero to provide to the client.
|
50
49
|
class ChefZeroCapture < ChefZero
|
51
50
|
# Declaring these ensure that they're available to the sandbox - it's initialized
|
@@ -55,7 +54,7 @@ module Kitchen
|
|
55
54
|
default_config :cookbook_artifacts_path, "cookbook_artifacts"
|
56
55
|
|
57
56
|
# This will load policyfile/berkshelf. We don't want either - the client resolves all
|
58
|
-
# dependencies from chef-zero, exactly as
|
57
|
+
# dependencies from chef-zero, exactly as prepped in the captured repository.
|
59
58
|
def load_needed_dependencies!; end
|
60
59
|
|
61
60
|
def create_sandbox
|
@@ -73,7 +72,7 @@ module Kitchen
|
|
73
72
|
end
|
74
73
|
|
75
74
|
# Overriding the private ProviderChefZero#default_config_rb
|
76
|
-
# so that we can add additional
|
75
|
+
# so that we can add additional configuration required for chef-zero
|
77
76
|
# to be able to locate our policies/, policy groups, and cookbook artifacts
|
78
77
|
# at run-time.
|
79
78
|
def default_config_rb
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -54,7 +53,7 @@ module Kitchen
|
|
54
53
|
# @author Daniel DeLeo <dan@chef.io>
|
55
54
|
class PolicyfileZero < ChefBase
|
56
55
|
|
57
|
-
# This
|
56
|
+
# This provisioner will forcibly set the following config options:
|
58
57
|
# * `use_policyfile`: `true`
|
59
58
|
# * `versioned_cookbooks`: `true`
|
60
59
|
# * `deployment_group`: `POLICY_NAME-local`
|
data/spec/unit/cli_spec.rb
CHANGED
@@ -53,8 +53,6 @@ describe ChefCLI::CLI do
|
|
53
53
|
E
|
54
54
|
end
|
55
55
|
|
56
|
-
let(:version_message) { "#{ChefCLI::Dist::PRODUCT} version: #{ChefCLI::VERSION}\n" }
|
57
|
-
|
58
56
|
def run_cli(expected_exit_code)
|
59
57
|
expect(cli).to receive(:exit).with(expected_exit_code)
|
60
58
|
expect(cli).to receive(:sanity_check!)
|
@@ -66,16 +64,6 @@ describe ChefCLI::CLI do
|
|
66
64
|
cli.run
|
67
65
|
end
|
68
66
|
|
69
|
-
def run_cli_and_validate_tool_versions
|
70
|
-
full_version_message = version_message
|
71
|
-
tools.each do |name, details|
|
72
|
-
expect(cli).to receive(:shell_out).with("#{details["command"]} --version").and_return(mock_shell_out(0, "#{details["version_output"]}", ""))
|
73
|
-
full_version_message += "#{name} version: #{details["expected_version"]}\n"
|
74
|
-
end
|
75
|
-
run_cli(0)
|
76
|
-
expect(stdout).to eq(full_version_message)
|
77
|
-
end
|
78
|
-
|
79
67
|
def mock_shell_out(exitstatus, stdout, stderr)
|
80
68
|
shell_out = double("mixlib_shell_out")
|
81
69
|
allow(shell_out).to receive(:exitstatus).and_return(exitstatus)
|
@@ -121,12 +109,17 @@ describe ChefCLI::CLI do
|
|
121
109
|
context "given -v" do
|
122
110
|
let(:argv) { %w{-v} }
|
123
111
|
|
124
|
-
context "
|
112
|
+
context "when installed via omnibus" do
|
125
113
|
let(:mocked_version_manifest_json) do
|
126
114
|
<<~E
|
127
115
|
{
|
128
116
|
"manifest_format": 2,
|
129
|
-
"build_version": "d.e.v"
|
117
|
+
"build_version": "d.e.v",
|
118
|
+
"software": {
|
119
|
+
"habitat": {
|
120
|
+
"locked_version": "1.2.3"
|
121
|
+
}
|
122
|
+
}
|
130
123
|
}
|
131
124
|
E
|
132
125
|
end
|
@@ -160,6 +153,7 @@ describe ChefCLI::CLI do
|
|
160
153
|
Chef Infra Client version: 0.0.2
|
161
154
|
Chef InSpec version: 0.0.3
|
162
155
|
Chef CLI version: 0.0.1
|
156
|
+
Chef Habitat version: 1.2.3
|
163
157
|
Test Kitchen version: 0.0.4
|
164
158
|
Cookstyle version: 0.0.6
|
165
159
|
E
|
@@ -171,6 +165,7 @@ describe ChefCLI::CLI do
|
|
171
165
|
Chef Infra Client version: unknown
|
172
166
|
Chef InSpec version: unknown
|
173
167
|
Chef CLI version: unknown
|
168
|
+
Chef Habitat version: unknown
|
174
169
|
Test Kitchen version: unknown
|
175
170
|
Cookstyle version: unknown
|
176
171
|
E
|
@@ -195,49 +190,15 @@ describe ChefCLI::CLI do
|
|
195
190
|
end
|
196
191
|
end
|
197
192
|
|
198
|
-
context "
|
199
|
-
let(:
|
200
|
-
|
201
|
-
|
202
|
-
"command" => "chef-client",
|
203
|
-
"version_output" => "Chef Infra Client: 15.0.300",
|
204
|
-
"expected_version" => "15.0.300",
|
205
|
-
},
|
206
|
-
"Chef InSpec" => {
|
207
|
-
"command" => "inspec",
|
208
|
-
"version_output" => "4.6.2\n\nYour version of InSpec is out of date! The latest version is 4.6.4.",
|
209
|
-
"expected_version" => "4.6.2",
|
210
|
-
},
|
211
|
-
"Test Kitchen" => {
|
212
|
-
"command" => "kitchen",
|
213
|
-
"version_output" => "Test Kitchen version 2.2.5",
|
214
|
-
"expected_version" => "2.2.5",
|
215
|
-
},
|
216
|
-
"Cookstyle" => {
|
217
|
-
"command" => "cookstyle",
|
218
|
-
"version_output" => "Cookstyle 4.0.0\n * RuboCop 0.62.0",
|
219
|
-
"expected_version" => "4.0.0",
|
220
|
-
},
|
221
|
-
}
|
222
|
-
end
|
223
|
-
|
224
|
-
it "does not print versions of tools with missing or errored tools" do
|
225
|
-
full_version_message = version_message
|
226
|
-
tools.each do |name, details|
|
227
|
-
if name == "inspec"
|
228
|
-
expect(cli).to receive(:shell_out).with("#{details["command"]} --version").and_return(mock_shell_out(1, "#{details["version_output"]}", ""))
|
229
|
-
full_version_message += "#{name} version: ERROR\n"
|
230
|
-
else
|
231
|
-
expect(cli).to receive(:shell_out).with("#{details["command"]} --version").and_return(mock_shell_out(0, "#{details["version_output"]}", ""))
|
232
|
-
full_version_message += "#{name} version: #{details["expected_version"]}\n"
|
233
|
-
end
|
234
|
-
end
|
235
|
-
run_cli(0)
|
236
|
-
expect(stdout).to eq(full_version_message)
|
193
|
+
context "when installed as a gem" do
|
194
|
+
let(:gem_version_message) { "#{ChefCLI::Dist::CLI_PRODUCT} version: #{ChefCLI::VERSION}\n" }
|
195
|
+
before do
|
196
|
+
allow(cli).to receive(:omnibus_install?).and_return false
|
237
197
|
end
|
238
198
|
|
239
199
|
it "prints the version and versions of chef-cli tools" do
|
240
|
-
|
200
|
+
run_cli(0)
|
201
|
+
expect(stdout).to eq(gem_version_message)
|
241
202
|
end
|
242
203
|
end
|
243
204
|
end
|
@@ -50,9 +50,9 @@ describe ChefCLI::Command::CleanPolicyCookbooks do
|
|
50
50
|
|
51
51
|
context "when given a path to the config" do
|
52
52
|
|
53
|
-
let(:params) { %w{ -c ~/
|
53
|
+
let(:params) { %w{ -c ~/other_stuff/config.rb } }
|
54
54
|
|
55
|
-
let(:config_arg) { "~/
|
55
|
+
let(:config_arg) { "~/other_stuff/config.rb" }
|
56
56
|
|
57
57
|
before do
|
58
58
|
expect(chef_config_loader).to receive(:load)
|
@@ -69,7 +69,7 @@ describe ChefCLI::Command::Env do
|
|
69
69
|
it "output should be valid yaml" do
|
70
70
|
expect { yaml }.not_to raise_error
|
71
71
|
end
|
72
|
-
it "Workstation version should indicate that that we're not
|
72
|
+
it "Workstation version should indicate that that we're not running from a WS install" do
|
73
73
|
expect(yaml).to have_key ChefCLI::Dist::PRODUCT
|
74
74
|
expect(yaml[ChefCLI::Dist::PRODUCT]["Version"]).to eql "Not running from within Workstation"
|
75
75
|
end
|
@@ -59,7 +59,7 @@ describe ChefCLI::Command::Exec do
|
|
59
59
|
before do
|
60
60
|
allow(Gem).to receive(:ruby).and_return(ruby_path)
|
61
61
|
|
62
|
-
# Using a fake path separator to keep to prevent people from
|
62
|
+
# Using a fake path separator to keep to prevent people from accidentally
|
63
63
|
# getting things correct on their system. This enforces that, in general,
|
64
64
|
# you should use the path separator ruby is telling you to use.
|
65
65
|
stub_const("File::PATH_SEPARATOR", "<>")
|
@@ -25,7 +25,7 @@ describe ChefCLI::CommandsMap do
|
|
25
25
|
|
26
26
|
before do
|
27
27
|
mapping.builtin("example", :Example)
|
28
|
-
mapping.builtin("
|
28
|
+
mapping.builtin("hyphenated-example", :HyphenatedExample)
|
29
29
|
mapping.builtin("explicit-path-example", :ExplicitPathExample, require_path: "unit/fixtures/command/explicit_path_example")
|
30
30
|
mapping.builtin("documented-example", :DocumentedExample, desc: "I have documentation")
|
31
31
|
end
|
@@ -34,16 +34,16 @@ describe ChefCLI::CommandsMap do
|
|
34
34
|
expect(mapping.have_command?("example")).to be true
|
35
35
|
end
|
36
36
|
|
37
|
-
it "infers a non-
|
37
|
+
it "infers a non-hyphenated command's require path" do
|
38
38
|
expect(mapping.spec_for("example").require_path).to eq("chef-cli/command/example")
|
39
39
|
end
|
40
40
|
|
41
41
|
it "infers a hyphenated command's require path" do
|
42
|
-
expect(mapping.spec_for("
|
42
|
+
expect(mapping.spec_for("hyphenated-example").require_path).to eq("chef-cli/command/hyphenated_example")
|
43
43
|
end
|
44
44
|
|
45
45
|
it "lists the available commands" do
|
46
|
-
expect(mapping.command_names).to match_array(%w{example
|
46
|
+
expect(mapping.command_names).to match_array(%w{example hyphenated-example explicit-path-example documented-example})
|
47
47
|
end
|
48
48
|
|
49
49
|
it "keeps the docstring of a command" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-cli
|
@@ -156,16 +156,22 @@ dependencies:
|
|
156
156
|
name: diff-lcs
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- - "
|
159
|
+
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
161
|
version: '1.0'
|
162
|
+
- - "<"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '1.4'
|
162
165
|
type: :runtime
|
163
166
|
prerelease: false
|
164
167
|
version_requirements: !ruby/object:Gem::Requirement
|
165
168
|
requirements:
|
166
|
-
- - "
|
169
|
+
- - ">="
|
167
170
|
- !ruby/object:Gem::Version
|
168
171
|
version: '1.0'
|
172
|
+
- - "<"
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '1.4'
|
169
175
|
- !ruby/object:Gem::Dependency
|
170
176
|
name: paint
|
171
177
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,20 +212,6 @@ dependencies:
|
|
206
212
|
- - ">="
|
207
213
|
- !ruby/object:Gem::Version
|
208
214
|
version: 1.0.11
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: ffi
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - "<"
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '1.13'
|
216
|
-
type: :runtime
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - "<"
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '1.13'
|
223
215
|
description: A streamlined development and deployment workflow for Chef platform.
|
224
216
|
email:
|
225
217
|
- info@chef.io
|