Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/chef-cli/dist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class Dist
PRODUCT = "Chef Workstation".freeze
PRODUCT_PKG_HOME = "chef-workstation".freeze

CHEF_DK_CLI_PACKAGE = "Chef Development Kit Enterprise".freeze
CHEF_DK_CLI_PACKAGE = "Chef Workstation".freeze
CHEF_CLI_PACKAGE = "Chef-Cli".freeze

# the name of the chef-cli gem
CLI_PRODUCT = "Chef CLI".freeze
CLI_GEM = "chef-cli".freeze

CHEF_DKE_PKG_NAME = "chef/chef-development-kit-enterprise".freeze
CHEF_DKE_PKG_NAME = "chef/chef-workstation".freeze
HAB_PKG_NAME = "chef/chef-cli".freeze

# the name of the overall infra product
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-cli/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def omnibus_install?
File.exist?(expected_omnibus_root) && File.exist?(File.join(expected_omnibus_root, "version-manifest.json"))
end

# The habitat version of the chef-cli can be installed with standalone or chef-development-kit-enterprise
# The habitat version of the chef-cli can be installed with standalone or chef-workstation
# This method checks if the habitat version of chef-cli is installed as standalone
def habitat_standalone?
@hab_standalone ||= (hab_pkg_installed?(ChefCLI::Dist::HAB_PKG_NAME) && !habitat_chef_dke?)
end

# This method checks if the habitat version of chef-cli is installed with chef-development-kit-enterprise
# This method checks if the habitat version of chef-cli is installed with chef-workstation
def habitat_chef_dke?
@hab_dke ||= hab_pkg_installed?(ChefCLI::Dist::CHEF_DKE_PKG_NAME)
end
Expand Down
7 changes: 3 additions & 4 deletions spec/unit/command/env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
require "spec_helper"
autoload :YAML, "yaml"
require "chef-cli/command/env"

describe ChefCLI::Command::Env do
let(:ui) { TestHelpers::TestUI.new }
let(:command_instance) { ChefCLI::Command::Env.new }
Expand Down Expand Up @@ -145,8 +144,8 @@
end
end

describe "when running chef-cli coming with Chef-DKE Habitat package" do
let(:hab_pkg_base) { "/hab/pkgs/chef/chef-development-kit-enterprise" }
describe "when running chef-cli coming with chef-workstation Habitat package" do
let(:hab_pkg_base) { "/hab/pkgs/chef/chef-workstation" }
let(:hab_pkg_version) { "1.0.0" }
let(:hab_pkg_build) { "20240210120000" }
let(:hab_pkg_path) { "#{hab_pkg_base}/#{hab_pkg_version}/#{hab_pkg_build}" }
Expand Down Expand Up @@ -184,7 +183,7 @@
run_command
end

it "should include correct product name for Chef-DKE Habitat package" do
it "should include correct product name for chef-workstation Habitat package" do
expect(yaml).to have_key(ChefCLI::Dist::CHEF_DK_CLI_PACKAGE)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/unit/command/shell_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@
end
end

context "with chef-development-kit-enterprise habitat pkg shell-init on bash" do
context "with chef-workstation habitat pkg shell-init on bash" do

let(:chef_dke_path) { "/hab/pkgs/chef/chef-development-kit-enterprise/1.0.0/123" }
let(:chef_dke_path) { "/hab/pkgs/chef/chef-workstation/1.0.0/123" }
let(:cli_hab_path) { "/hab/pkgs/chef/chef-cli/1.0.0/123" }

let(:argv) { ["bash"] }
Expand All @@ -377,7 +377,7 @@
end

it "should return the correct paths" do
expect(command_instance).to receive(:get_pkg_prefix).with("chef/chef-development-kit-enterprise").and_return(chef_dke_path)
expect(command_instance).to receive(:get_pkg_prefix).with("chef/chef-workstation").and_return(chef_dke_path)
expect(command_instance).to receive(:get_pkg_prefix).with("chef/chef-cli").and_return(cli_hab_path)

command_instance.run(argv)
Expand Down Expand Up @@ -414,7 +414,7 @@
before do
# Stub this or else we'd have to update the test every time a new command
# is added.
allow(command_instance).to receive(:get_pkg_prefix).with("chef/chef-development-kit-enterprise").and_return(chef_dke_path)
allow(command_instance).to receive(:get_pkg_prefix).with("chef/chef-workstation").and_return(chef_dke_path)
allow(command_instance).to receive(:get_pkg_prefix).with("chef/chef-cli").and_return(cli_hab_path)
allow(command_instance.shell_completion_template_context).to receive(:commands)
.and_return(command_descriptions)
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
end

context "when installed with habitat" do
let(:chef_dke_path) { "/hab/pkgs/chef/chef-development-kit-enterprise/1.0.0/123" }
let(:chef_dke_path) { "/hab/pkgs/chef/chef-workstation/1.0.0/123" }
let(:cli_hab_path) { "/hab/pkgs/chef/chef-cli/1.0.0/123" }
let(:expected_gem_root) { Gem.default_dir }
let(:expected_path) { [File.join(chef_dke_path, "bin"), File.join(cli_hab_path, "vendor", "bin"), "/usr/bin:/bin"].flatten }
Expand All @@ -133,7 +133,7 @@

it "should return the habitat env" do
allow(ChefCLI::Helpers).to receive(:fetch_chef_cli_version_pkg).and_return(nil) # Ensure no version override
expect(ChefCLI::Helpers).to receive(:get_pkg_prefix).with("chef/chef-development-kit-enterprise").and_return(chef_dke_path)
expect(ChefCLI::Helpers).to receive(:get_pkg_prefix).with("chef/chef-workstation").and_return(chef_dke_path)
expect(ChefCLI::Helpers).to receive(:get_pkg_prefix).with("chef/chef-cli").and_return(cli_hab_path)

expect(ChefCLI::Helpers.habitat_env).to eq(expected_env)
Expand Down