chef-cli 3.0.16 → 3.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ba95803ebaddd3034b21130fda13e0a001c5ef02b304897d7808c0286268d9b
4
- data.tar.gz: 7c64aed7f98666dc5677f11036cbbb7671cc9d8d09f410f25222332c1fd10ac6
3
+ metadata.gz: f4ad30b471d00e7b8b9d9b2c94a9722d4fa2dbd5a2b8db6eaf6340ad5cbee006
4
+ data.tar.gz: e925152292893332d5f846db05bc52299823f6e4e7043cc23783ed1ffd7b3a17
5
5
  SHA512:
6
- metadata.gz: a42c1780fe0865c527c8787bd1122abcb06867b0f3e01e142684ac2cda519215c9801d031c6266ac94c7965d890dd5c6e0af8eebb195aecdfd0fa36f0691422c
7
- data.tar.gz: 3133b68e4e51bd548e180bdbf3d8bae0735834118e0c9b81a781b0e869196a4108ea72ea38904cc1662a3d1863af4dcdf92a5508073efcd53408e7704f792c9e
6
+ metadata.gz: 7f1860d196d449214a2e5511c4add38e0b50a39c660837a1f6052fe145e274706f80dc44c474f0480c2b16518c08f77b424c902b1664cfa9bb7ab63408d3dc07
7
+ data.tar.gz: b1ad7b8563c1389e9ae62e906c998be45ee23d3bb2f044c7cc62fe4fd061577d33d70ab46e00445cb3d84d3754d033432c8cdbd553b9a263b8a5bc5eddb1ce23
data/Gemfile CHANGED
@@ -13,7 +13,7 @@ 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", "6.13.3" # this forces dependabot PRs to open which triggers cookstyle CI on the chef generate command
16
+ gem "cookstyle", "6.14.7" # this forces dependabot PRs to open which triggers cookstyle CI on the chef generate command
17
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")
@@ -59,7 +59,7 @@ module ChefCLI
59
59
  end
60
60
 
61
61
  def run(enforce_license: false)
62
- sanity_check!
62
+ path_check!
63
63
 
64
64
  subcommand_name, *subcommand_params = argv
65
65
 
@@ -149,8 +149,15 @@ module ChefCLI
149
149
  commands_map.command_specs
150
150
  end
151
151
 
152
+ #
153
+ # Is a passed parameter actually an option aka does it start with '-'
154
+ #
155
+ # @param [String] param The passed parameter to check
156
+ #
157
+ # @return [Boolean]
158
+ #
152
159
  def option?(param)
153
- param =~ /^-/
160
+ param[0] == "-"
154
161
  end
155
162
 
156
163
  def instantiate_subcommand(name)
@@ -178,12 +185,12 @@ module ChefCLI
178
185
  end
179
186
 
180
187
  def manifest_hash
181
- require "json"
188
+ require "json" unless defined?(JSON)
182
189
  @manifest_hash ||= JSON.parse(read_version_manifest_json)
183
190
  end
184
191
 
185
192
  def gem_manifest_hash
186
- require "json"
193
+ require "json" unless defined?(JSON)
187
194
  @gem_manifest_hash ||= JSON.parse(read_gem_version_manifest_json)
188
195
  end
189
196
 
@@ -224,7 +231,7 @@ module ChefCLI
224
231
  # catch the cases where users setup only the embedded_bin_dir in their path, or
225
232
  # when they have the embedded_bin_dir before the omnibus_bin_dir -- both of which will
226
233
  # defeat appbundler and interact very badly with our intent.
227
- def sanity_check!
234
+ def path_check!
228
235
  # When installed outside of omnibus, trust the user to configure their PATH
229
236
  return true unless omnibus_install?
230
237
 
@@ -21,7 +21,7 @@ require_relative "../ui"
21
21
  require_relative "../version"
22
22
  require_relative "../dist"
23
23
  require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
24
- require "yaml"
24
+ require "yaml" unless defined?(YAML)
25
25
 
26
26
  module ChefCLI
27
27
  module Command
@@ -20,7 +20,6 @@ require_relative "../dist"
20
20
  require "rubygems" unless defined?(Gem)
21
21
  require "rubygems/gem_runner"
22
22
  require "rubygems/exceptions"
23
- require "pp" unless defined?(PP)
24
23
 
25
24
  module ChefCLI
26
25
  module Command
@@ -16,7 +16,6 @@
16
16
  #
17
17
 
18
18
  require "mixlib/cli" unless defined?(Mixlib::CLI)
19
- require "rbconfig"
20
19
  require "pathname" unless defined?(Pathname)
21
20
  require_relative "base"
22
21
  require_relative "../chef_runner"
@@ -38,7 +37,7 @@ module ChefCLI
38
37
  long: "--license LICENSE",
39
38
  description: "all_rights, apachev2, mit, gplv2, gplv3 - defaults to all_rights",
40
39
  proc: Proc.new { |l|
41
- l =~ /apache2/ ? "apachev2" : l
40
+ /apache2/.match?(l) ? "apachev2" : l
42
41
  },
43
42
  default: nil
44
43
 
@@ -187,27 +187,30 @@ module ChefCLI
187
187
  @verbose
188
188
  end
189
189
 
190
+ #
191
+ # Is there a .delivery/cli.toml in the current dir or any of the parent dirs
192
+ #
193
+ # @return [Boolean]
194
+ #
190
195
  def have_delivery_config?
191
196
  # delivery-cli's logic is to look recursively upward for
192
197
  # .delivery/cli.toml starting from pwd:
193
198
  # https://github.com/chef/delivery-cli/blob/22cbef3987ebd0aee98405b7e161a100edc87e49/src/delivery/config/mod.rs#L225-L247
194
199
 
195
- path_to_check = File.expand_path(Dir.pwd)
196
- result = false
197
-
198
- Pathname.new(path_to_check).ascend do |path|
199
- if contains_delivery_cli_toml?(path)
200
- result = true
201
- break
202
- end
200
+ Pathname.new(Dir.pwd).ascend do |path|
201
+ return true if contains_delivery_cli_toml?(path)
203
202
  end
204
203
 
205
- result
204
+ false # nothing was found
206
205
  end
207
206
 
207
+ #
208
+ # @param [Pathname] path a directory
209
+ #
210
+ # @return [Boolean] delivery cli.toml exists
211
+ #
208
212
  def contains_delivery_cli_toml?(path)
209
- delivery_cli_path = path.join(".delivery/cli.toml")
210
- delivery_cli_path.exist?
213
+ path.join(".delivery/cli.toml").exist?
211
214
  end
212
215
 
213
216
  def read_and_validate_params
@@ -215,7 +218,7 @@ module ChefCLI
215
218
  @cookbook_name_or_path = arguments[0]
216
219
  if !@cookbook_name_or_path
217
220
  @params_valid = false
218
- elsif /-/ =~ File.basename(@cookbook_name_or_path)
221
+ elsif File.basename(@cookbook_name_or_path).include?("-")
219
222
  msg("Hyphens are discouraged in cookbook names as they may cause problems with custom resources. See https://docs.chef.io/ctl_chef/#chef-generate-cookbook for more information.")
220
223
  end
221
224
 
@@ -15,8 +15,6 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "ostruct"
19
-
20
18
  require_relative "base"
21
19
  require_relative "../chef_runner"
22
20
  require_relative "../dist"
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "erb"
18
+ require "erb" unless defined?(ERB)
19
19
 
20
20
  require_relative "../commands_map"
21
21
  require_relative "../builtin_commands"
@@ -15,11 +15,11 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "json"
18
+ require "json" unless defined?(JSON)
19
19
  require_relative "../cookbook_omnifetch"
20
20
  require_relative "source_uri"
21
21
  require_relative "../exceptions"
22
- require "chef/http/simple"
22
+ require "chef/http/simple" unless defined?(Chef::HTTP::Simple)
23
23
 
24
24
  module ChefCLI
25
25
  module Policyfile
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "chef/mash"
18
+ require "chef/mash" unless defined?(Mash)
19
19
 
20
20
  module ChefCLI
21
21
  module Policyfile
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "json"
18
+ require "json" unless defined?(JSON)
19
19
  require_relative "../cookbook_omnifetch"
20
20
  require_relative "../exceptions"
21
21
  require "chef/http/simple"
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "semverse"
18
+ require "semverse" unless defined?(Semverse)
19
19
  require_relative "../cookbook_omnifetch"
20
20
  require_relative "storage_config"
21
21
 
@@ -16,9 +16,7 @@
16
16
  #
17
17
 
18
18
  require "forwardable" unless defined?(Forwardable)
19
-
20
- require "semverse"
21
-
19
+ require "semverse" unless defined?(Semverse)
22
20
  require_relative "community_cookbook_source"
23
21
 
24
22
  module ChefCLI
@@ -233,7 +233,7 @@ module ChefCLI
233
233
  message = "#{run_list_desc} has invalid cookbook name '#{cookbook}'.\nCookbook names can only contain alphanumerics, hyphens, and underscores."
234
234
 
235
235
  # Special case when there's only one colon instead of two:
236
- if cookbook =~ /[^:]:[^:]/
236
+ if /[^:]:[^:]/.match?(cookbook)
237
237
  message << "\nDid you mean '#{item.sub(":", "::")}'?"
238
238
  end
239
239
 
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefCLI
19
- VERSION = "3.0.16".freeze
19
+ VERSION = "3.0.22".freeze
20
20
  end
@@ -15,7 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
- require "json"
18
+ require "json" unless defined?(JSON)
19
19
  require "kitchen"
20
20
  require "kitchen/provisioner/base"
21
21
  require "kitchen/provisioner/chef_zero"
@@ -55,7 +55,7 @@ describe ChefCLI::CLI do
55
55
 
56
56
  def run_cli(expected_exit_code)
57
57
  expect(cli).to receive(:exit).with(expected_exit_code)
58
- expect(cli).to receive(:sanity_check!)
58
+ expect(cli).to receive(:path_check!)
59
59
  cli.run
60
60
  end
61
61
 
@@ -256,7 +256,7 @@ describe ChefCLI::CLI do
256
256
  end
257
257
  end
258
258
 
259
- context "sanity_check!" do
259
+ context "path_check!" do
260
260
 
261
261
  before do
262
262
  allow(Gem).to receive(:ruby).and_return(ruby_path)
@@ -16,7 +16,7 @@
16
16
  #
17
17
 
18
18
  require "spec_helper"
19
- require "yaml"
19
+ require "yaml" unless defined?(YAML)
20
20
  require "chef-cli/command/env"
21
21
 
22
22
  describe ChefCLI::Command::Env do
@@ -1,6 +1,6 @@
1
1
  require "openssl"
2
2
  require "net/https"
3
- require "json"
3
+ require "json" unless defined?(JSON)
4
4
  require "pp"
5
5
  require "uri"
6
6
 
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.16
4
+ version: 3.0.22
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-08-03 00:00:00.000000000 Z
11
+ date: 2020-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-cli