From 3926c3ac36026a7b33b25609d0e2b9efb615b214 Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Thu, 27 Mar 2025 18:38:50 +0530 Subject: [PATCH 1/3] updating the chef refrences to chef-cli Signed-off-by: nikhil2611 --- lib/chef-cli/dist.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chef-cli/dist.rb b/lib/chef-cli/dist.rb index f643ce31..df45d9a8 100644 --- a/lib/chef-cli/dist.rb +++ b/lib/chef-cli/dist.rb @@ -36,7 +36,7 @@ class Dist WORKFLOW = "Chef Workflow (Delivery)".freeze # The chef executable, as in `chef gem install` or `chef generate cookbook` - EXEC = "chef".freeze + EXEC = "chef-cli".freeze # Chef-Zero's product name ZERO_PRODUCT = "Chef Infra Zero".freeze From 5f42084439e38b3c089b1a4bb6a0b23aecd82deb Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Thu, 27 Mar 2025 19:10:08 +0530 Subject: [PATCH 2/3] updating the test cases to fix the chef-cli references Signed-off-by: nikhil2611 --- spec/shared/a_file_generator.rb | 4 ++-- spec/unit/cli_spec.rb | 6 +++--- spec/unit/command/env_spec.rb | 2 +- spec/unit/command/exec_spec.rb | 2 +- spec/unit/command/generate_spec.rb | 2 +- spec/unit/command/generator_commands/cookbook_spec.rb | 2 +- spec/unit/command/generator_commands/policyfile_spec.rb | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/shared/a_file_generator.rb b/spec/shared/a_file_generator.rb index 983ff12b..c5002a29 100644 --- a/spec/shared/a_file_generator.rb +++ b/spec/shared/a_file_generator.rb @@ -40,7 +40,7 @@ def generator_context let(:argv) { [] } it "emits an error message and exits" do - expected_stdout = "Usage: chef generate #{generator_name} [path/to/cookbook] NAME [options]" + expected_stdout = "Usage: chef-cli generate #{generator_name} [path/to/cookbook] NAME [options]" expect(recipe_generator.run).to eq(1) expect(stdout).to include(expected_stdout) @@ -85,7 +85,7 @@ def generator_context let(:argv) { [ new_file_name ] } it "emits an error message and exits" do - expected_stdout = "Usage: chef generate #{generator_name} [path/to/cookbook] NAME [options]" + expected_stdout = "Usage: chef-cli generate #{generator_name} [path/to/cookbook] NAME [options]" expected_stderr = "Error: Directory #{Dir.pwd} is not a cookbook\n" expect(recipe_generator.run).to eq(1) diff --git a/spec/unit/cli_spec.rb b/spec/unit/cli_spec.rb index 10e1515a..f10fcd6e 100644 --- a/spec/unit/cli_spec.rb +++ b/spec/unit/cli_spec.rb @@ -46,9 +46,9 @@ def stderr Patents: #{ChefCLI::Dist::PATENTS} Usage: - chef -h/--help - chef -v/--version - chef command [arguments...] [options...] + chef-cli -h/--help + chef-cli -v/--version + chef-cli command [arguments...] [options...] Available Commands: gem Runs the `gem` command in context of the embedded ruby diff --git a/spec/unit/command/env_spec.rb b/spec/unit/command/env_spec.rb index 66ff1c34..222eb7cc 100644 --- a/spec/unit/command/env_spec.rb +++ b/spec/unit/command/env_spec.rb @@ -29,7 +29,7 @@ let(:omnibus_bin_dir) { "/foo/bin" } it "has a usage banner" do - expect(command_instance.banner).to eq("Usage: chef env") + expect(command_instance.banner).to eq("Usage: chef-cli env") end describe "when running from within an omnibus install" do diff --git a/spec/unit/command/exec_spec.rb b/spec/unit/command/exec_spec.rb index 15fcb46a..d50dc346 100644 --- a/spec/unit/command/exec_spec.rb +++ b/spec/unit/command/exec_spec.rb @@ -28,7 +28,7 @@ def run_command end it "has a usage banner" do - expect(command_instance.banner).to eq("Usage: chef exec SYSTEM_COMMAND") + expect(command_instance.banner).to eq("Usage: chef-cli exec SYSTEM_COMMAND") end describe "when locating omnibus directory" do diff --git a/spec/unit/command/generate_spec.rb b/spec/unit/command/generate_spec.rb index 06933477..9dae86e8 100644 --- a/spec/unit/command/generate_spec.rb +++ b/spec/unit/command/generate_spec.rb @@ -75,7 +75,7 @@ def stderr context "with a generator defined" do let(:expected_help_message) do <<~E - Usage: chef generate GENERATOR [options] + Usage: chef-cli generate GENERATOR [options] Available generators: example this is a test diff --git a/spec/unit/command/generator_commands/cookbook_spec.rb b/spec/unit/command/generator_commands/cookbook_spec.rb index 6e59a2b5..804b2818 100644 --- a/spec/unit/command/generator_commands/cookbook_spec.rb +++ b/spec/unit/command/generator_commands/cookbook_spec.rb @@ -131,7 +131,7 @@ def generator_context context "when given invalid/incomplete arguments" do let(:expected_help_message) do - "Usage: chef generate cookbook NAME [options]\n" + "Usage: chef-cli generate cookbook NAME [options]\n" end def with_argv(argv) diff --git a/spec/unit/command/generator_commands/policyfile_spec.rb b/spec/unit/command/generator_commands/policyfile_spec.rb index d2e12d0d..fdd51cee 100644 --- a/spec/unit/command/generator_commands/policyfile_spec.rb +++ b/spec/unit/command/generator_commands/policyfile_spec.rb @@ -212,7 +212,7 @@ def generator_context let(:argv) { %w{ foo bar baz } } it "shows usage and exits" do - expected_stdout = "Usage: chef generate policyfile [NAME] [options]" + expected_stdout = "Usage: chef-cli generate policyfile [NAME] [options]" expect(generator.run).to eq(1) expect(stderr).to include(expected_stdout) From 427415661303b0848f21f0886d0d8faff1dc40b2 Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Thu, 27 Mar 2025 19:20:15 +0530 Subject: [PATCH 3/3] updating the remaining test cases to fix the chef-cli references Signed-off-by: nikhil2611 --- spec/unit/cli_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/unit/cli_spec.rb b/spec/unit/cli_spec.rb index f10fcd6e..f820c041 100644 --- a/spec/unit/cli_spec.rb +++ b/spec/unit/cli_spec.rb @@ -290,7 +290,7 @@ def test_result run_cli_with_sanity_check(0) expect(stdout).to eq(base_help_message) expect(stderr).to include("please reverse that order") - expect(stderr).to include("chef shell-init") + expect(stderr).to include("chef-cli shell-init") end it "complains if only embedded is present" do @@ -300,7 +300,7 @@ def test_result run_cli_with_sanity_check(0) expect(stdout).to eq(base_help_message) expect(stderr).to include("you must add") - expect(stderr).to include("chef shell-init") + expect(stderr).to include("chef-cli shell-init") end it "passes when both are present in the correct order" do @@ -349,7 +349,7 @@ def test_result run_cli_with_sanity_check(0) expect(stdout).to eq(base_help_message) expect(stderr).to include("please reverse that order") - expect(stderr).to include("chef shell-init") + expect(stderr).to include("chef-cli shell-init") end it "complains if only embedded is present" do @@ -359,7 +359,7 @@ def test_result run_cli_with_sanity_check(0) expect(stdout).to eq(base_help_message) expect(stderr).to include("you must add") - expect(stderr).to include("chef shell-init") + expect(stderr).to include("chef-cli shell-init") end it "passes when both are present in the correct order" do