chef-cli 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef-cli/helpers.rb +4 -4
- data/lib/chef-cli/version.rb +1 -1
- data/spec/unit/helpers_spec.rb +111 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a10a665d45110e002c2e070387a8d91e0f6cdb365c8ed20b7f181739c0612e74
|
4
|
+
data.tar.gz: 8ee4a30784d2f1784a40d3be7bb5ef670970b6e9e55f922b1944d80253567ae1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '019fa209b216d7719c8c53ce8df805bd973edeeb84a386d2fc1d0dcc08e5094953ed952e8d1e21a31d85053ab9b752e40160674139e6e0929433c8d26ab59896'
|
7
|
+
data.tar.gz: 4f147e219f59c6b9d1ddf864c20aed77bdd99dc4165c5035b823f084824f10772518ff9e30a95f110a5270d7fd5a9c2551f9ffc542c7e21bf20e000370083851
|
data/lib/chef-cli/helpers.rb
CHANGED
@@ -117,11 +117,11 @@ module ChefCLI
|
|
117
117
|
@omnibus_env ||=
|
118
118
|
begin
|
119
119
|
user_bin_dir = File.expand_path(File.join(Gem.user_dir, "bin"))
|
120
|
-
path = [ omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"] ]
|
120
|
+
path = [ omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"].split(File::PATH_SEPARATOR) ]
|
121
121
|
path << git_bin_dir if Dir.exist?(git_bin_dir)
|
122
122
|
path << git_windows_bin_dir if Dir.exist?(git_windows_bin_dir)
|
123
123
|
{
|
124
|
-
"PATH" => path.join(File::PATH_SEPARATOR),
|
124
|
+
"PATH" => path.flatten.uniq.join(File::PATH_SEPARATOR),
|
125
125
|
"GEM_ROOT" => Gem.default_dir,
|
126
126
|
"GEM_HOME" => Gem.user_dir,
|
127
127
|
"GEM_PATH" => Gem.path.join(File::PATH_SEPARATOR),
|
@@ -129,8 +129,6 @@ module ChefCLI
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
private
|
133
|
-
|
134
132
|
def omnibus_expand_path(*paths)
|
135
133
|
dir = File.expand_path(File.join(paths))
|
136
134
|
raise OmnibusInstallNotFound.new unless dir && File.directory?(dir)
|
@@ -138,6 +136,8 @@ module ChefCLI
|
|
138
136
|
dir
|
139
137
|
end
|
140
138
|
|
139
|
+
private
|
140
|
+
|
141
141
|
def expected_omnibus_root
|
142
142
|
File.expand_path(File.join(Gem.ruby, "..", "..", ".."))
|
143
143
|
end
|
data/lib/chef-cli/version.rb
CHANGED
@@ -0,0 +1,111 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2014-2018 Chef Software Inc.
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require "spec_helper"
|
18
|
+
require "chef-cli/helpers"
|
19
|
+
|
20
|
+
describe ChefCLI::Helpers do
|
21
|
+
context "path_check!" do
|
22
|
+
|
23
|
+
before do
|
24
|
+
allow(Gem).to receive(:ruby).and_return(ruby_path)
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when installed via omnibus" do
|
28
|
+
before do
|
29
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_install?).and_return true
|
30
|
+
end
|
31
|
+
|
32
|
+
context "on unix" do
|
33
|
+
|
34
|
+
let(:user_bin_dir) { File.expand_path(File.join(Gem.user_dir, "bin")) }
|
35
|
+
let(:omnibus_embedded_bin_dir) { "/opt/chef-workstation/embedded/bin" }
|
36
|
+
let(:omnibus_bin_dir) { "/opt/chef-workstation/bin" }
|
37
|
+
let(:expected_PATH) { [ omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"].split(File::PATH_SEPARATOR) ] }
|
38
|
+
let(:expected_GEM_ROOT) { Gem.default_dir }
|
39
|
+
let(:expected_GEM_HOME) { Gem.user_dir }
|
40
|
+
let(:expected_GEM_PATH) { Gem.path.join(File::PATH_SEPARATOR) }
|
41
|
+
let(:ruby_path) { "/opt/chef-workstation/embedded/bin/ruby" }
|
42
|
+
|
43
|
+
it "#omnibus_env path" do
|
44
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_bin_dir).and_return("/opt/chef-workstation/bin")
|
45
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_embedded_bin_dir).and_return("/opt/chef-workstation/embedded/bin")
|
46
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_env).and_return(
|
47
|
+
"PATH" => expected_PATH.flatten.uniq.join(File::PATH_SEPARATOR),
|
48
|
+
"GEM_ROOT" => expected_GEM_ROOT,
|
49
|
+
"GEM_HOME" => expected_GEM_HOME,
|
50
|
+
"GEM_PATH" => expected_GEM_PATH
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "on windows" do
|
56
|
+
let(:ruby_path) { "c:/opscode/chef-workstation/embedded/bin/ruby.exe" }
|
57
|
+
let(:user_bin_dir) { File.expand_path(File.join(Gem.user_dir, "bin")) }
|
58
|
+
let(:omnibus_embedded_bin_dir) { "c:/opscode/chef-workstation/embedded/bin" }
|
59
|
+
let(:omnibus_bin_dir) { "c:/opscode/chef-workstation/bin" }
|
60
|
+
let(:expected_GEM_ROOT) { Gem.default_dir }
|
61
|
+
let(:expected_GEM_HOME) { Gem.user_dir }
|
62
|
+
let(:expected_GEM_PATH) { Gem.path.join(File::PATH_SEPARATOR) }
|
63
|
+
let(:omnibus_root) { "c:/opscode/chef-workstation" }
|
64
|
+
let(:expected_PATH) { [ omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"].split(File::PATH_SEPARATOR) ] }
|
65
|
+
|
66
|
+
before do
|
67
|
+
allow(ChefCLI::Helpers).to receive(:expected_omnibus_root).and_return(ruby_path)
|
68
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_install?).and_return(true)
|
69
|
+
allow(Chef::Platform).to receive(:windows?).and_return(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "#omnibus_env path" do
|
73
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_bin_dir).and_return("c:/opscode/chef-workstation/bin")
|
74
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_embedded_bin_dir).and_return("c:/opscode/chef-workstation/embedded/bin")
|
75
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_env).and_return(
|
76
|
+
"PATH" => expected_PATH.flatten.uniq.join(File::PATH_SEPARATOR),
|
77
|
+
"GEM_ROOT" => expected_GEM_ROOT,
|
78
|
+
"GEM_HOME" => expected_GEM_HOME,
|
79
|
+
"GEM_PATH" => expected_GEM_PATH
|
80
|
+
)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "when not installed via omnibus" do
|
86
|
+
|
87
|
+
before do
|
88
|
+
allow(ChefCLI::Helpers).to receive(:omnibus_install?).and_return false
|
89
|
+
end
|
90
|
+
let(:ruby_path) { "/Users/bog/.lots_o_rubies/2.1.2/bin/ruby" }
|
91
|
+
let(:expected_root_path) { "/Users/bog/.lots_o_rubies" }
|
92
|
+
|
93
|
+
before do
|
94
|
+
allow(File).to receive(:exist?).with(expected_root_path).and_return(false)
|
95
|
+
|
96
|
+
%i{
|
97
|
+
omnibus_root
|
98
|
+
omnibus_bin_dir
|
99
|
+
omnibus_embedded_bin_dir
|
100
|
+
}.each do |method_name|
|
101
|
+
allow(ChefCLI::Helpers).to receive(method_name).and_raise(ChefCLI::OmnibusInstallNotFound.new)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it "skips the sanity check without error" do
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
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: 4.0.
|
4
|
+
version: 4.0.1
|
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: 2021-04-
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-cli
|
@@ -529,6 +529,7 @@ files:
|
|
529
529
|
- spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb
|
530
530
|
- spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb
|
531
531
|
- spec/unit/generator_spec.rb
|
532
|
+
- spec/unit/helpers_spec.rb
|
532
533
|
- spec/unit/kitchen/provisioner/chef_zero_capture_spec.rb
|
533
534
|
- spec/unit/pager_spec.rb
|
534
535
|
- spec/unit/policyfile/artifactory_cookbook_source_spec.rb
|
@@ -744,6 +745,7 @@ test_files:
|
|
744
745
|
- spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/metadata.rb
|
745
746
|
- spec/unit/fixtures/local_path_cookbooks/noignore-f59ee7a5bca6a4e606b67f7f856b768d847c39bb/recipes/default.rb
|
746
747
|
- spec/unit/generator_spec.rb
|
748
|
+
- spec/unit/helpers_spec.rb
|
747
749
|
- spec/unit/kitchen/provisioner/chef_zero_capture_spec.rb
|
748
750
|
- spec/unit/pager_spec.rb
|
749
751
|
- spec/unit/policyfile/artifactory_cookbook_source_spec.rb
|