Skip to content

Commit

Permalink
Rename inspec-bin gems to cinc-auditor-bin
Browse files Browse the repository at this point in the history
We need the ability to publish our own rubygems which include the cinc-auditor
binary. This will also assist in allowing us easily to install this into other
products (Cinc Client, Cinc Workstation, etc) which rely on gems for their
omnibus installation.

In addition, this pulls in our lib/inspec/dist.rb which provides fixes for the
Chef trademarks.
  • Loading branch information
ramereth committed Feb 5, 2025
1 parent 01834a3 commit 3db5169
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 88 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gem "inspec", path: "."
#
# However, AppBundler requires a top-level Gemfile.lock with inspec-bin
# in it in order to package the executable. Hence the odd backwards dependency.
gem "inspec-bin", path: "./inspec-bin"
gem "cinc-auditor-bin", path: "./inspec-bin"

# ffi version v1.17.0 is breaking verify pipeline as it requires
# rubygems version to be upgraded to >= 3.3.22 Ref:https://buildkite.com/chef/inspec-inspec-main-verify-private/builds/812#018fe177-2ccb-45ed-a25e-213c8a6453df/698-707
Expand Down
6 changes: 3 additions & 3 deletions inspec-bin/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"
main_gemspec = File.expand_path("inspec-bin.gemspec", __dir__)
main_gemspec = File.expand_path("cinc-auditor-bin.gemspec", __dir__)
if File.exist?(main_gemspec)
gemspec name: "inspec-bin"
gemspec name: "cinc-auditor-bin"
else
gemspec name: "inspec-core-bin"
gemspec name: "cinc-auditor-core-bin"
end
27 changes: 27 additions & 0 deletions inspec-bin/cinc-auditor-bin.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "inspec-bin/version"

Gem::Specification.new do |spec|
spec.name = "cinc-auditor-bin"
spec.version = InspecBin::VERSION
spec.authors = ["Chef InSpec Core Engineering", "Cinc Project"]
spec.email = ["[email protected]", "[email protected]"]
spec.summary = "Infrastructure and compliance testing."
spec.description = "Cinc Auditor (a community distribution of InSpec) executable for inspec gem."
spec.homepage = "https://gitlab.com/cinc-project/auditor"
spec.license = "Apache-2.0"

spec.require_paths = ["lib"]
spec.required_ruby_version = ">= 3.1.0"

spec.add_dependency "inspec", "= #{InspecBin::VERSION}"
spec.add_development_dependency "rake"

spec.files = %w{README.md LICENSE Gemfile} + Dir.glob("*.gemspec") +
Dir.glob("{lib,bin}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }

spec.bindir = "bin"
spec.executables = %w{cinc-auditor}

end
31 changes: 31 additions & 0 deletions inspec-bin/cinc-auditor-core-bin.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "inspec-bin/version"

# This is just link inspec-bin, but relies on inspec-core instead of inspec
# inspec-core is a stripped-down version of the inspec gem with fewer exotic dependencies

Gem::Specification.new do |spec|
spec.name = "cinc-auditor-core-bin" # dallas multi-pass
spec.version = InspecBin::VERSION
spec.authors = ["Chef InSpec Core Engineering", "Cinc Project"]
spec.email = ["[email protected]", "[email protected]"]
spec.summary = "Infrastructure and compliance testing."
spec.description = "Cinc Auditor (a community distribution of InSpec) executable for inspec-core gem."
spec.homepage = "https://gitlab.com/cinc-project/auditor"
spec.license = "Apache-2.0"

spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 3.1.0"

spec.add_dependency "inspec-core", "= #{InspecBin::VERSION}"
spec.add_development_dependency "rake"

spec.files = %w{README.md LICENSE Gemfile} + ["cinc-auditor-core-bin.gemspec"] +
Dir.glob("{lib,bin}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }

spec.bindir = "bin"
spec.executables = %w{cinc-auditor}

end
35 changes: 0 additions & 35 deletions inspec-bin/inspec-bin.gemspec

This file was deleted.

39 changes: 0 additions & 39 deletions inspec-bin/inspec-core-bin.gemspec

This file was deleted.

2 changes: 1 addition & 1 deletion omnibus/config/projects/cinc-auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
instance_eval(File.read(overrides_path), overrides_path)

dependency "preparation"
dependency "inspec"
dependency "cinc-auditor"

# Remove all .dll.a and .a files needed for static linkage.
dependency "ruby-cleanup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
require_relative "../../../lib/inspec/version"

name "inspec"
name "cinc-auditor"

dependency "ruby"

Expand All @@ -32,24 +32,25 @@
env = with_standard_compiler_flags(with_embedded_path)

# Remove existing built gems in case they exist in the current dir
delete "#{name}-*.gem"
delete "inspec-*.gem"
delete "inspec-bin/#{name}-*.gem"

# We bundle install to ensure the versions of gems we are going to
# appbundle-lock to are definitely installed
bundle "config set --local without test kitchen", env: env
bundle "install", env: env

gem "build #{name}-core.gemspec", env: env
gem "install #{name}-core*.gem --no-document", env: env
gem "build inspec-core.gemspec", env: env
gem "install inspec-core*.gem --no-document", env: env

gem "build #{name}.gemspec", env: env
gem "install #{name}-*.gem --no-document", env: env
gem "build inspec.gemspec", env: env
gem "install inspec-*.gem --no-document", env: env

gem "build inspec-bin.gemspec", env: env, cwd: "#{project_dir}/inspec-bin"
gem "install inspec-bin-*.gem --no-document", env: env, cwd: "#{project_dir}/inspec-bin"
gem "build cinc-auditor-bin.gemspec", env: env, cwd: "#{project_dir}/inspec-bin"
gem "install cinc-auditor-bin-*.gem --no-document", env: env, cwd: "#{project_dir}/inspec-bin"

block do
appbundle "inspec", lockdir: project_dir, gem: "inspec-bin", env: env
appbundle "cinc-auditor", lockdir: project_dir, gem: "cinc-auditor-bin", env: env
end

block "Delete test folder from problem gems" do
Expand Down

0 comments on commit 3db5169

Please sign in to comment.