diff --git a/bin/chef b/bin/chef new file mode 120000 index 000000000..7fcb3bdcb --- /dev/null +++ b/bin/chef @@ -0,0 +1 @@ +./cinc-workstation-wrapper \ No newline at end of file diff --git a/bin/chef-analyze b/bin/chef-analyze new file mode 120000 index 000000000..7fcb3bdcb --- /dev/null +++ b/bin/chef-analyze @@ -0,0 +1 @@ +./cinc-workstation-wrapper \ No newline at end of file diff --git a/bin/chef-cli b/bin/chef-cli deleted file mode 100755 index f0535f79a..000000000 --- a/bin/chef-cli +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby -# -# Copyright:: Copyright (c) Chef Software Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Set a trap for ctrl-C right away so we don't surface interrupt exceptions inside of rubygems or whatever. -Kernel.trap(:INT) { print("\n"); exit 1 } - -$:.unshift(File.expand_path(File.join(__dir__, "..", "lib"))) -require "chef-cli/cli" - -ChefCLI::CLI.new(ARGV.clone).run(enforce_license: true) diff --git a/bin/chef-cli b/bin/chef-cli new file mode 120000 index 000000000..7fcb3bdcb --- /dev/null +++ b/bin/chef-cli @@ -0,0 +1 @@ +./cinc-workstation-wrapper \ No newline at end of file diff --git a/bin/chef-run b/bin/chef-run new file mode 120000 index 000000000..7fcb3bdcb --- /dev/null +++ b/bin/chef-run @@ -0,0 +1 @@ +./cinc-workstation-wrapper \ No newline at end of file diff --git a/bin/cinc-cli b/bin/cinc-cli new file mode 100755 index 000000000..1199bbad3 --- /dev/null +++ b/bin/cinc-cli @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby +# +# Copyright:: Copyright (c) Chef Software Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Set a trap for ctrl-C right away so we don't surface interrupt exceptions inside of rubygems or whatever. +Kernel.trap(:INT) { print("\n"); exit 1 } + +$:.unshift(File.expand_path(File.join(__dir__, "..", "lib"))) +require "chef-cli/cli" + +ChefCLI::CLI.new(ARGV.clone).run(enforce_license: false) diff --git a/bin/cinc-workstation-wrapper b/bin/cinc-workstation-wrapper new file mode 100755 index 000000000..71154a080 --- /dev/null +++ b/bin/cinc-workstation-wrapper @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +# +# ./cinc-workstation-wrapper - Redirect chef binstubs to cinc one with information on stdout +# +# Copyright:: Copyright (c) 2018-2020, Cinc Project +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Encoding.default_external = Encoding::UTF_8 + +require 'mixlib/shellout' + +command = File.basename($PROGRAM_NAME).sub(/chef/, 'cinc') + +STDERR.puts "Redirecting to #{command}" + +cmd_dir = File.dirname(File.realpath($PROGRAM_NAME)) +cmd = Mixlib::ShellOut.new("#{cmd_dir}/#{command}", *ARGV, live_stream: STDOUT, timeout: 3600) +cmd.run_command +exit cmd.exitstatus diff --git a/chef-cli.gemspec b/chef-cli.gemspec index c98464dfa..6d9bd4174 100644 --- a/chef-cli.gemspec +++ b/chef-cli.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |gem| Dir.glob("Gemfile*") + # Includes Gemfile and locks Dir.glob("*.gemspec") + Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } - gem.executables = %w{ chef-cli } + gem.executables = %w{ cinc-cli cinc-workstation-wrapper chef chef-cli chef-analyze chef-run } gem.test_files = gem.files.grep(%r{^spec/}) gem.require_paths = ["lib"] @@ -47,7 +47,7 @@ Gem::Specification.new do |gem| gem.add_dependency "solve", "< 5.0", "> 2.0" gem.add_dependency "addressable", ">= 2.3.5", "< 2.9" gem.add_dependency "cookbook-omnifetch", "~> 0.5" - gem.add_dependency "diff-lcs", ">= 1.0", "< 1.4" # 1.4 changes the output + gem.add_dependency "diff-lcs", ">= 1.0", "< 1.6" # 1.4 changes the output gem.add_dependency "pastel", "~> 0.7" # used for policyfile differ gem.add_dependency "license-acceptance", ">= 1.0.11", "< 3" end diff --git a/lib/chef-cli/dist.rb b/lib/chef-cli/dist.rb index ead757962..778ed6e72 100644 --- a/lib/chef-cli/dist.rb +++ b/lib/chef-cli/dist.rb @@ -3,47 +3,47 @@ class Dist # This class is not fully implemented, depending on it is not recommended! # The full marketing name of the product - PRODUCT = "Chef Workstation".freeze - PRODUCT_PKG_HOME = "chef-workstation".freeze + PRODUCT = "Cinc Workstation".freeze + PRODUCT_PKG_HOME = "cinc-workstation".freeze # the name of the chef-cli gem - CLI_PRODUCT = "Chef CLI".freeze + CLI_PRODUCT = "Cinc CLI".freeze CLI_GEM = "chef-cli".freeze # the name of the overall infra product - INFRA_PRODUCT = "Chef Infra".freeze + INFRA_PRODUCT = "Cinc Infra".freeze # name of the Infra client product - INFRA_CLIENT_PRODUCT = "Chef Infra Client".freeze + INFRA_CLIENT_PRODUCT = "Cinc Client".freeze # The client's alias (chef-client) - INFRA_CLIENT_CLI = "chef-client".freeze + INFRA_CLIENT_CLI = "cinc-client".freeze # The client's gem INFRA_CLIENT_GEM = "chef".freeze - INSPEC_PRODUCT = "Chef InSpec".freeze - INSPEC_CLI = "inspec".freeze + INSPEC_PRODUCT = "Cinc Auditor".freeze + INSPEC_CLI = "cinc-auditor-bin".freeze # The name of the server product - SERVER_PRODUCT = "Chef Infra Server".freeze - WORKFLOW = "Chef Workflow (Delivery)".freeze + SERVER_PRODUCT = "Cinc Infra Server".freeze + WORKFLOW = "Cinc Workflow (Delivery)".freeze # The chef executable, as in `chef gem install` or `chef generate cookbook` - EXEC = "chef".freeze + EXEC = "cinc".freeze # Chef-Zero's product name - ZERO_PRODUCT = "Chef Infra Zero".freeze + ZERO_PRODUCT = "Cinc Infra Zero".freeze - HAB_PRODUCT = "Chef Habitat".freeze - HAB_SOFTWARE_NAME = "habitat".freeze - HAB_CLI = "hab".freeze + HAB_PRODUCT = "Biome".freeze + HAB_SOFTWARE_NAME = "biome".freeze + HAB_CLI = "bio".freeze # product patents page PATENTS = "https://www.chef.io/patents".freeze # Workstation banner/help text WORKSTATION_DOCS = "https://docs.chef.io/workstation/".freeze - WORKSTATION_HEADER = "The Chef command line tool for managing your infrastructure from your workstation.".freeze + WORKSTATION_HEADER = "The Cinc command line tool for managing your infrastructure from your workstation.".freeze end end