From 789a88021605ab0a8ae9708a5cf324283831493e Mon Sep 17 00:00:00 2001 From: Luke Malinowski Date: Thu, 21 Nov 2019 08:05:34 -0500 Subject: [PATCH 01/26] Add lib/inspec-objects.rb so inspec-objects can be required Previously, require "inspec-objects" would throw an error. With this commit the gem can be pulled in directly. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as Indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: Luke Malinowski --- lib/inspec-objects.rb | 2 ++ test/unit/objects_test.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 lib/inspec-objects.rb diff --git a/lib/inspec-objects.rb b/lib/inspec-objects.rb new file mode 100644 index 0000000..d1fb74d --- /dev/null +++ b/lib/inspec-objects.rb @@ -0,0 +1,2 @@ +require "inspec-objects/version" +require_relative "inspec/objects" diff --git a/test/unit/objects_test.rb b/test/unit/objects_test.rb index bae197f..a27d301 100644 --- a/test/unit/objects_test.rb +++ b/test/unit/objects_test.rb @@ -1,5 +1,5 @@ require "spec_helper" -require "inspec/objects" +require "inspec-objects" describe "Objects" do describe "Inspec::Object::Test" do From d007ab98e7225a5912f7a08eda0e7dfb674f38c9 Mon Sep 17 00:00:00 2001 From: Robert Clark Date: Thu, 2 Apr 2020 13:28:16 -0400 Subject: [PATCH 02/26] Restructure objects imports When using autoload, the path was nondeterministic since the inspec/objects folder would sometimes be loaded. This moves over to using require_relative which guarantees we are loading from inspec_objects. Note that some imports had to be reordered since they were dependent on one another. --- lib/inspec/objects.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/inspec/objects.rb b/lib/inspec/objects.rb index ed77d52..f5ab1e7 100644 --- a/lib/inspec/objects.rb +++ b/lib/inspec/objects.rb @@ -1,14 +1,14 @@ module Inspec module Object - autoload :Tag, "inspec/objects/tag" - autoload :Control, "inspec/objects/control" - autoload :Describe, "inspec/objects/describe" - autoload :EachLoop, "inspec/objects/each_loop" - autoload :List, "inspec/objects/list" - autoload :OrTest, "inspec/objects/or_test" - autoload :RubyHelper, "inspec/objects/ruby_helper" - autoload :Test, "inspec/objects/test" - autoload :Value, "inspec/objects/value" - autoload :Input, "inspec/objects/input" + require_relative "objects/tag" + require_relative "objects/control" + require_relative "objects/ruby_helper" + require_relative "objects/describe" + require_relative "objects/value" + require_relative "objects/list" + require_relative "objects/each_loop" + require_relative "objects/or_test" + require_relative "objects/test" + require_relative "objects/input" end end From b441bf0187608c4a4693cd7e12122d67d444424d Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 19:21:03 -0500 Subject: [PATCH 03/26] Setup unit tests and linting for project - added Bundle file - added cookstyle - ran the rake unit tests --- .github/workflows/ruby.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..57ae60c --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,37 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Ruby + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.6', '2.7', '3.0'] + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, + # change this to (see https://github.com/ruby/setup-ruby#versioning): + # uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: | + - bundle exec cookstyle + - bundle exec unit From 0f6dd26b4225e93069b85682b4482f9182d773e1 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 19:30:40 -0500 Subject: [PATCH 04/26] changed to the chefstyle gem for now --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 57ae60c..a803908 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -33,5 +33,5 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests run: | - - bundle exec cookstyle + - bundle exec chefstyle -a - bundle exec unit From 2d912922894abf8734f97850be5d9f3d27f40502 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 19:33:03 -0500 Subject: [PATCH 05/26] Update ruby.yml --- .github/workflows/ruby.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a803908..fc46f08 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -33,5 +33,5 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests run: | - - bundle exec chefstyle -a - - bundle exec unit + bundle exec chefstyle -a + bundle exec unit From 1f01e17e3e1286f310b9bfb640c1eba5ef9ddc31 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 19:34:55 -0500 Subject: [PATCH 06/26] added missing rake command --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index fc46f08..f7a9ec7 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -34,4 +34,4 @@ jobs: - name: Run tests run: | bundle exec chefstyle -a - bundle exec unit + bundle exec rake unit From e6d1075ed45e02a553406a09351f238fca465cc5 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 20:36:30 -0500 Subject: [PATCH 07/26] removed autocorrect --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index f7a9ec7..c69016b 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -33,5 +33,5 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests run: | - bundle exec chefstyle -a + bundle exec chefstyle bundle exec rake unit From 59144fad5bead9981c1d2577c1ecd5ad93d968b4 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 20:51:51 -0500 Subject: [PATCH 08/26] Control Header Object (#5) - inital support for adding headers to controls - simplifed logic for adding the header per peer review - implementation is a basic string block - Setup unit tests and linting for project - added Bundle and added cookstyle - ran the rake unit tests Signed-off-by: Aaron Lippold --- .gitignore | 1 + Gemfile | 4 +++- Rakefile | 6 +++-- inspec-objects.gemspec | 2 ++ lib/inspec-objects.rb | 2 ++ lib/inspec-objects/version.rb | 4 +++- lib/inspec/objects.rb | 3 +++ lib/inspec/objects/control.rb | 16 ++++++++++--- lib/inspec/objects/describe.rb | 14 +++++++----- lib/inspec/objects/each_loop.rb | 2 ++ lib/inspec/objects/header.rb | 25 +++++++++++++++++++++ lib/inspec/objects/input.rb | 3 ++- lib/inspec/objects/list.rb | 2 ++ lib/inspec/objects/or_test.rb | 5 +++-- lib/inspec/objects/ruby_helper.rb | 2 ++ lib/inspec/objects/tag.rb | 2 ++ lib/inspec/objects/test.rb | 6 +++-- lib/inspec/objects/value.rb | 2 ++ test/spec_helper.rb | 2 ++ test/unit/objects_test.rb | 37 ++++++++++++++++++++++++++++++- 20 files changed, 121 insertions(+), 19 deletions(-) create mode 100644 lib/inspec/objects/header.rb diff --git a/.gitignore b/.gitignore index 6c0498a..ba330a7 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ Gemfile.lock # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc +.vscode/* \ No newline at end of file diff --git a/Gemfile b/Gemfile index 54e69ca..80ca553 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,12 @@ +# frozen_string_literal: true + source "https://rubygems.org" gem "inspec-objects", path: "." group :test do + gem "chef-utils", "~> 16.6.14" gem "chefstyle", "0.13.0" gem "minitest", "~> 5.5" gem "rake", ">= 10" - gem "chef-utils", "~> 16.6.14" end diff --git a/Rakefile b/Rakefile index 485de7c..fc12320 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "bundler" require "rake/testtask" @@ -6,8 +8,8 @@ Bundler::GemHelper.install_tasks name: "inspec-objects" Rake::TestTask.new(:unit) do |t| t.libs << "test" t.test_files = Dir.glob([ - "test/unit/**/*_test.rb", - ]) + "test/unit/**/*_test.rb", + ]) end begin diff --git a/inspec-objects.gemspec b/inspec-objects.gemspec index e19b39f..dde1a60 100644 --- a/inspec-objects.gemspec +++ b/inspec-objects.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) diff --git a/lib/inspec-objects.rb b/lib/inspec-objects.rb index d1fb74d..434371f 100644 --- a/lib/inspec-objects.rb +++ b/lib/inspec-objects.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + require "inspec-objects/version" require_relative "inspec/objects" diff --git a/lib/inspec-objects/version.rb b/lib/inspec-objects/version.rb index d3b404b..eb62fe9 100644 --- a/lib/inspec-objects/version.rb +++ b/lib/inspec-objects/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module InspecObjects - VERSION = "0.1.0".freeze + VERSION = "0.1.0" end diff --git a/lib/inspec/objects.rb b/lib/inspec/objects.rb index f5ab1e7..070beaf 100644 --- a/lib/inspec/objects.rb +++ b/lib/inspec/objects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec module Object require_relative "objects/tag" @@ -10,5 +12,6 @@ module Object require_relative "objects/or_test" require_relative "objects/test" require_relative "objects/input" + require_relative "objects/header" end end diff --git a/lib/inspec/objects/control.rb b/lib/inspec/objects/control.rb index 0a83e23..6d12d29 100644 --- a/lib/inspec/objects/control.rb +++ b/lib/inspec/objects/control.rb @@ -1,13 +1,20 @@ +# frozen_string_literal: true + module Inspec::Object class Control - attr_accessor :id, :title, :descriptions, :impact, :tests, :tags, :refs, :only_if + attr_accessor :header, :id, :title, :descriptions, :impact, :tests, :tags, :refs, :only_if def initialize + @header = "" @tests = [] @tags = [] @refs = [] @descriptions = {} end + def add_header(header) + @header = header + end + def add_test(t) @tests.push(t) end @@ -18,6 +25,7 @@ def add_tag(t) def to_hash { + header: header, id: id, title: title, descriptions: descriptions, @@ -27,8 +35,10 @@ def to_hash } end - def to_ruby # rubocop:disable Metrics/AbcSize - res = ["control #{id.inspect} do"] + def to_ruby + res = [] + res.push header unless header.nil? || header.empty? + res.push "control #{id.inspect} do" res.push " title #{title.inspect}" unless title.to_s.empty? descriptions.each do |label, text| if label == :default diff --git a/lib/inspec/objects/describe.rb b/lib/inspec/objects/describe.rb index 673cb5e..2125aad 100644 --- a/lib/inspec/objects/describe.rb +++ b/lib/inspec/objects/describe.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object class Describe # Internal helper to structure test objects. @@ -11,11 +13,11 @@ def negate! def to_ruby itsy = "it" unless its.nil? - if its.is_a? Array - itsy = "its(" + its.inspect + ")" - else - itsy = "its(" + its.to_s.inspect + ")" - end + itsy = if its.is_a? Array + "its(" + its.inspect + ")" + else + "its(" + its.to_s.inspect + ")" + end end naughty = negated ? "_not" : "" xpect = if expectation.nil? @@ -72,7 +74,7 @@ def to_hash end def resource - return nil if qualifier.empty? || qualifier[0].empty? || qualifier[0][0].empty? + return if qualifier.empty? || qualifier[0].empty? || qualifier[0][0].empty? qualifier[0][0] end diff --git a/lib/inspec/objects/each_loop.rb b/lib/inspec/objects/each_loop.rb index a483138..5b8920f 100644 --- a/lib/inspec/objects/each_loop.rb +++ b/lib/inspec/objects/each_loop.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object class EachLoop < List attr_reader :variables diff --git a/lib/inspec/objects/header.rb b/lib/inspec/objects/header.rb new file mode 100644 index 0000000..1f0ebde --- /dev/null +++ b/lib/inspec/objects/header.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Inspec::Object + class Header + attr_accessor :header + + def initialize(header) + @header = header + end + + def to_hash + { + header: header, + } + end + + def to_ruby + header.inspect.to_s + end + + def to_s + "Header #{header}" + end + end +end diff --git a/lib/inspec/objects/input.rb b/lib/inspec/objects/input.rb index 1640c7d..07fa045 100644 --- a/lib/inspec/objects/input.rb +++ b/lib/inspec/objects/input.rb @@ -1,8 +1,9 @@ +# frozen_string_literal: true + require "inspec/input" module Inspec::Object class Input < ::Inspec::Input - # NOTE: No initialize method or accessors for the reasons listed above #--------------------------------------------------------------------------# diff --git a/lib/inspec/objects/list.rb b/lib/inspec/objects/list.rb index 230f5d9..c6f88fd 100644 --- a/lib/inspec/objects/list.rb +++ b/lib/inspec/objects/list.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object class List < Value def map diff --git a/lib/inspec/objects/or_test.rb b/lib/inspec/objects/or_test.rb index a3ed9a5..80bc9c5 100644 --- a/lib/inspec/objects/or_test.rb +++ b/lib/inspec/objects/or_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object class OrTest attr_reader :tests @@ -18,12 +20,11 @@ def to_ruby if @negated # We don't use the describe.one wrapper when negated because: # !(test1 || test2) same as (!test1 && !test2) where && is implicit in inspec - all_tests = @tests.map do |test| + @tests.map do |test| test.negate! test end.map(&:to_ruby).join("\n") - all_tests else all_tests = @tests.map(&:to_ruby).join("\n").gsub("\n", "\n ") diff --git a/lib/inspec/objects/ruby_helper.rb b/lib/inspec/objects/ruby_helper.rb index 51c8c1a..1912b6d 100644 --- a/lib/inspec/objects/ruby_helper.rb +++ b/lib/inspec/objects/ruby_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object module RubyHelper def ruby_qualifier(q) diff --git a/lib/inspec/objects/tag.rb b/lib/inspec/objects/tag.rb index 753cbac..8d9394a 100644 --- a/lib/inspec/objects/tag.rb +++ b/lib/inspec/objects/tag.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object class Tag attr_accessor :key, :value diff --git a/lib/inspec/objects/test.rb b/lib/inspec/objects/test.rb index 8d96031..2952102 100644 --- a/lib/inspec/objects/test.rb +++ b/lib/inspec/objects/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object class Test attr_accessor :qualifier, :matcher, :expectation, :skip, :negated, :variables, :only_if @@ -39,7 +41,7 @@ def remove_expectation private def describe_chain - return nil if @qualifier.empty? + return if @qualifier.empty? resource = @qualifier.length > 1 ? @qualifier[0..-2] : [@qualifier[0]] res = resource.map { |q| ruby_qualifier(q) }.join(".") @@ -75,7 +77,7 @@ def rb_describe " " + expectation.inspect end format("%s%sdescribe %s do\n %s { should%s %s%s }\nend", - only_if_clause, vars, res, itsy, naughty, matcher, xpect) + only_if_clause, vars, res, itsy, naughty, matcher, xpect) end def rb_skip diff --git a/lib/inspec/objects/value.rb b/lib/inspec/objects/value.rb index 4a35eda..c1932f4 100644 --- a/lib/inspec/objects/value.rb +++ b/lib/inspec/objects/value.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Inspec::Object class Value include ::Inspec::Object::RubyHelper diff --git a/test/spec_helper.rb b/test/spec_helper.rb index 9a4ca35..a93651f 100644 --- a/test/spec_helper.rb +++ b/test/spec_helper.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + require "minitest/autorun" diff --git a/test/unit/objects_test.rb b/test/unit/objects_test.rb index a27d301..5e76180 100644 --- a/test/unit/objects_test.rb +++ b/test/unit/objects_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "spec_helper" require "inspec-objects" @@ -468,6 +470,7 @@ '.strip control_hash = { + header: "", id: "tag.control.id", title: nil, descriptions: {}, @@ -485,6 +488,38 @@ end end + describe "Inspec::Object::Tag" do + it "constructs a control with a company header" do + control = Inspec::Object::Control.new + res1 = { name: "key", value: "value" } + tag1 = Inspec::Object::Tag.new(res1[:name], res1[:value]) + _(tag1.to_hash).must_equal res1 + control.add_header("# my company header") + control.id = "tag.control.id" + control.add_tag(tag1) + _(control.to_ruby).must_equal ' +# my company header +control "tag.control.id" do + tag key: "value" +end +'.strip + + control_hash = { + header: "# my company header", + id: "tag.control.id", + title: nil, + descriptions: {}, + impact: nil, + tests: [], + tags: [{ + name: "key", + value: "value", + }], + } + _(control.to_hash).must_equal control_hash + end + end + describe "Inspec::Object::Input" do describe "to_ruby method" do it "generates the code for the input" do @@ -510,7 +545,7 @@ end end - # TODO - deprecate this, not sure it is used + # TODO: - deprecate this, not sure it is used describe "to_hash method" do it "generates a similar hash" do ipt = Inspec::Object::Input.new( From d1cd83433cfb1087f4ec51eb7b90cc1eb58cfec2 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 21:10:13 -0500 Subject: [PATCH 09/26] Control Post-Body Object (#6) * Post-Body Object - added inital object for post body of a control - a post-body should usually be a block of ruby/inspec code - the assumption will be that we just dump it as is into the control Signed-off-by: Aaron Lippold * updated .gitignore file removed .vscode dir from repo Signed-off-by: Aaron Lippold * added an ignore to our rubocop file given testing issues and whitespace using standard linting gem that the chef folks used before Signed-off-by: Aaron Lippold --- .gitignore | 2 +- .rubocop.yml | 14 +++++++ lib/inspec/objects.rb | 1 + lib/inspec/objects/control.rb | 9 ++++- lib/inspec/objects/post_body.rb | 25 ++++++++++++ test/unit/objects_test.rb | 69 +++++++++++++++++++++++++++++++++ 6 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 .rubocop.yml create mode 100644 lib/inspec/objects/post_body.rb diff --git a/.gitignore b/.gitignore index ba330a7..d6fcb9a 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,4 @@ Gemfile.lock # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc -.vscode/* \ No newline at end of file +.vscode/* diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..bede519 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,14 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2022-02-07 20:29:42 -0500 using RuboCop version 0.72.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'test/unit/objects_test.rb' \ No newline at end of file diff --git a/lib/inspec/objects.rb b/lib/inspec/objects.rb index 070beaf..65a5b34 100644 --- a/lib/inspec/objects.rb +++ b/lib/inspec/objects.rb @@ -12,6 +12,7 @@ module Object require_relative "objects/or_test" require_relative "objects/test" require_relative "objects/input" + require_relative "objects/post_body" require_relative "objects/header" end end diff --git a/lib/inspec/objects/control.rb b/lib/inspec/objects/control.rb index 6d12d29..639be07 100644 --- a/lib/inspec/objects/control.rb +++ b/lib/inspec/objects/control.rb @@ -2,13 +2,14 @@ module Inspec::Object class Control - attr_accessor :header, :id, :title, :descriptions, :impact, :tests, :tags, :refs, :only_if + attr_accessor :header, :id, :title, :descriptions, :impact, :tests, :post_body, :tags, :refs, :only_if def initialize @header = "" @tests = [] @tags = [] @refs = [] @descriptions = {} + @post_body = "" end def add_header(header) @@ -23,6 +24,10 @@ def add_tag(t) @tags.push(t) end + def add_post_body(post_body) + @post_body = post_body + end + def to_hash { header: header, @@ -32,6 +37,7 @@ def to_hash impact: impact, tests: tests.map(&:to_hash), tags: tags.map(&:to_hash), + post_body: post_body, } end @@ -54,6 +60,7 @@ def to_ruby refs.each { |t| res.push(" ref #{print_ref(t)}") } res.push " only_if { #{only_if} }" if only_if tests.each { |t| res.push(indent(t.to_ruby, 2)) } + res.push(indent(post_body, 2)) unless post_body.nil? || post_body.empty? res.push "end" res.join("\n") end diff --git a/lib/inspec/objects/post_body.rb b/lib/inspec/objects/post_body.rb new file mode 100644 index 0000000..8f8f214 --- /dev/null +++ b/lib/inspec/objects/post_body.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Inspec::Object + class PostBody + attr_accessor :post_body + + def initialize(post_body) + @post_body = post_body + end + + def to_hash + { + post_body: post_body, + } + end + + def to_ruby + post_body.inspect.to_s + end + + def to_s + "Post Body #{post_body}" + end + end +end diff --git a/test/unit/objects_test.rb b/test/unit/objects_test.rb index 5e76180..e567df6 100644 --- a/test/unit/objects_test.rb +++ b/test/unit/objects_test.rb @@ -483,6 +483,74 @@ name: "key2", value: %w{a b}, }], + post_body: "", + } + _(control.to_hash).must_equal control_hash + end + end + + describe "Inspec::Object::PostBody" do + it "constructs a control with a simple post body" do + control = Inspec::Object::Control.new + control.id = "tag.control.id" + control.add_post_body("my body") + _(control.to_ruby).must_equal ' +control "tag.control.id" do + my body +end + '.strip + + control_hash = { + header: "", + id: "tag.control.id", + title: nil, + descriptions: {}, + impact: nil, + tests: [], + tags: [], + post_body: "my body", + } + _(control.to_hash).must_equal control_hash + end + end + + describe "Inspec::Object::PostBody" do + it "constructs a control with a complex post body" do + control = Inspec::Object::Control.new + control.id = "tag.control.id" + control.add_post_body(%q(unless package('gnome-settings-daemon').installed? + impact 0.0 + describe "The system does not have GNOME installed" do + skip "The system does not have GNOME installed, this requirement is Not Applicable." + end +else + describe command("gsettings get org.gnome.settings-daemon.media-keys logout") do + its('stdout.strip') { should cmp "''" } + end +end)) + _(control.to_ruby).must_equal %q( +control "tag.control.id" do + unless package('gnome-settings-daemon').installed? + impact 0.0 + describe "The system does not have GNOME installed" do + skip "The system does not have GNOME installed, this requirement is Not Applicable." + end + else + describe command("gsettings get org.gnome.settings-daemon.media-keys logout") do + its('stdout.strip') { should cmp "''" } + end + end +end +).strip + control_hash = { + header: "", + id: "tag.control.id", + title: nil, + descriptions: {}, + impact: nil, + tests: [], + tags: [], + post_body: "unless package('gnome-settings-daemon').installed?\n impact 0.0\n describe \"The system does not have GNOME installed\" do\n skip \"The system does not have GNOME installed, this requirement is Not Applicable.\"\n end\nelse \n describe command(\"gsettings get org.gnome.settings-daemon.media-keys logout\") do\n its('stdout.strip') { should cmp \"''\" }\n end \nend", } _(control.to_hash).must_equal control_hash end @@ -515,6 +583,7 @@ name: "key", value: "value", }], + post_body: "", } _(control.to_hash).must_equal control_hash end From 9f3db795e82021000345509afae76dd1a721fc96 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 21:14:05 -0500 Subject: [PATCH 10/26] updated github actions to simplify things Signed-off-by: Aaron Lippold --- .github/workflows/ruby.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index c69016b..3d02d25 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -33,5 +33,4 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests run: | - bundle exec chefstyle - bundle exec rake unit + bundle exec rake From 6eac6a6ba9cdffdca63ceb9dfb67ac8c9cff4fa7 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 21:15:34 -0500 Subject: [PATCH 11/26] removed ruby 3 since it doesn't seem to be happy with chefstyle Signed-off-by: Aaron Lippold --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 3d02d25..f7f7158 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.6', '2.7', '3.0'] + ruby-version: ['2.6', '2.7'] steps: - uses: actions/checkout@v2 From b3cd495150a7546014f0442db7920b01b4f11b04 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 21:25:07 -0500 Subject: [PATCH 12/26] Updated version to account for post-body & header --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6e8bf73..0d91a54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.3.0 From f2de22d5e18907a95a1510b59b85fe284a2cf850 Mon Sep 17 00:00:00 2001 From: Aaron Lippold Date: Mon, 7 Feb 2022 21:31:58 -0500 Subject: [PATCH 13/26] Update version.rb --- lib/inspec-objects/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/inspec-objects/version.rb b/lib/inspec-objects/version.rb index eb62fe9..f49e6f6 100644 --- a/lib/inspec-objects/version.rb +++ b/lib/inspec-objects/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InspecObjects - VERSION = "0.1.0" + VERSION = "0.3.0" end From 0c00d3c4ccb2dd0a0d87af2f969ce594bab02220 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 15:55:04 -0500 Subject: [PATCH 14/26] Rename package to mitre-inspec-objects --- .expeditor/config.yml | 4 +- .github/workflows/release.yml | 43 +++++++++++++++++++ Gemfile | 2 +- Rakefile | 2 +- ...ts.gemspec => mitre-inspec-objects.gemspec | 8 ++-- test/unit/objects_test.rb | 2 +- 6 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/release.yml rename inspec-objects.gemspec => mitre-inspec-objects.gemspec (73%) diff --git a/.expeditor/config.yml b/.expeditor/config.yml index 3ec092a..43b6c4d 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -1,12 +1,12 @@ --- project: - alias: inspec-objects + alias: mitre-inspec-objects slack: notify_channel: "compliance-profile" rubygems: - - inspec-objects + - mitre-inspec-objects github: # This deletes the GitHub PR branch after successfully merged into the release branch diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a9869fc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release Management + +on: + release: + types: [published] + +jobs: + release: + name: Release to gem hosts and docker registry + runs-on: ubuntu-latest + steps: + - name: Setup ruby + uses: actions/setup-ruby@v1 + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + lfs: true + - run: git fetch origin +refs/tags/*:refs/tags/* + - name: Setup credentials and versioning + run: | + gem install git-lite-version-bump keycutter roo + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials + printf -- ":github: Bearer ${GPR_API_KEY}\n" >> $HOME/.gem/credentials + env: + RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}} + GPR_API_KEY: ${{secrets.GITHUB_TOKEN}} + - name: Build gem + run: gem build ./mitre-inspec-objects.gemspec + - name: Get gem version + run: echo "::set-env name=VERSION::$(ls *.gem | grep -Po '(\d+.)+\d+')" + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + - name: Publish to RubyGems + run: | + gem push --KEY rubygems --host https://rubygems.org *.gem + - name: Publish to GPR + run: | + gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem + env: + OWNER: mitre \ No newline at end of file diff --git a/Gemfile b/Gemfile index 80ca553..53c7138 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "inspec-objects", path: "." +gem "mitre-inspec-objects", path: "." group :test do gem "chef-utils", "~> 16.6.14" diff --git a/Rakefile b/Rakefile index fc12320..cb1657a 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ require "bundler" require "rake/testtask" -Bundler::GemHelper.install_tasks name: "inspec-objects" +Bundler::GemHelper.install_tasks name: "mitre-inspec-objects" Rake::TestTask.new(:unit) do |t| t.libs << "test" diff --git a/inspec-objects.gemspec b/mitre-inspec-objects.gemspec similarity index 73% rename from inspec-objects.gemspec rename to mitre-inspec-objects.gemspec index dde1a60..8011916 100644 --- a/inspec-objects.gemspec +++ b/mitre-inspec-objects.gemspec @@ -6,17 +6,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "inspec-objects/version" Gem::Specification.new do |spec| - spec.name = "inspec-objects" + spec.name = "mitre-inspec-objects" spec.version = InspecObjects::VERSION - spec.authors = ["Dominik Richter", "Christoph Hartmann"] + spec.authors = ["Dominik Richter", "Christoph Hartmann", "Aaron Lippold"] spec.email = ["dominik.richter@gmail.com", "chris@lollyrock.com"] spec.summary = "InSpec Objects library" spec.description = "Library that provides an API for programmatically creating InSpec profiles" - spec.homepage = "https://github.com/inspec/inspec-objects" + spec.homepage = "https://github.com/mitre/inspec-objects" spec.license = "Apache-2.0" spec.files = %w{ - README.md inspec-objects.gemspec Gemfile + README.md mitre-inspec-objects.gemspec Gemfile } + Dir.glob("{lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } spec.require_paths = ["lib"] diff --git a/test/unit/objects_test.rb b/test/unit/objects_test.rb index e567df6..9d2b066 100644 --- a/test/unit/objects_test.rb +++ b/test/unit/objects_test.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "spec_helper" -require "inspec-objects" +require "mitre-inspec-objects" describe "Objects" do describe "Inspec::Object::Test" do From 5e0d1c304ee827f010631f0795c5f8b127233149 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 15:58:10 -0500 Subject: [PATCH 15/26] Rename folders to mitre-inspec-objects as well --- lib/{inspec-objects.rb => mitre-inspec-objects.rb} | 2 +- lib/{inspec-objects => mitre-inspec-objects}/version.rb | 0 mitre-inspec-objects.gemspec | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename lib/{inspec-objects.rb => mitre-inspec-objects.rb} (62%) rename lib/{inspec-objects => mitre-inspec-objects}/version.rb (100%) diff --git a/lib/inspec-objects.rb b/lib/mitre-inspec-objects.rb similarity index 62% rename from lib/inspec-objects.rb rename to lib/mitre-inspec-objects.rb index 434371f..cf379d7 100644 --- a/lib/inspec-objects.rb +++ b/lib/mitre-inspec-objects.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -require "inspec-objects/version" +require "mitre-inspec-objects/version" require_relative "inspec/objects" diff --git a/lib/inspec-objects/version.rb b/lib/mitre-inspec-objects/version.rb similarity index 100% rename from lib/inspec-objects/version.rb rename to lib/mitre-inspec-objects/version.rb diff --git a/mitre-inspec-objects.gemspec b/mitre-inspec-objects.gemspec index 8011916..1721335 100644 --- a/mitre-inspec-objects.gemspec +++ b/mitre-inspec-objects.gemspec @@ -3,7 +3,7 @@ lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require "inspec-objects/version" +require "mitre-inspec-objects/version" Gem::Specification.new do |spec| spec.name = "mitre-inspec-objects" From e6b8a4861195bc2aab3fca3e040c161932968f84 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:00:24 -0500 Subject: [PATCH 16/26] Update Gem Version badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8392c7c..2629e89 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # inspec-objects -[![Gem Version](https://badge.fury.io/rb/inspec-objects.svg)](https://badge.fury.io/rb/inspec-objects) +[![Gem Version](https://badge.fury.io/rb/mitre-inspec-objects.svg)](https://badge.fury.io/rb/mitre-inspec-objects) **Umbrella Project**: [InSpec](https://github.com/chef/chef-oss-practices/blob/master/projects/inspec.md) From 722093ea3177f820b56bc4ee1aed2aa4111f894b Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:04:51 -0500 Subject: [PATCH 17/26] 0.3.1 --- VERSION | 2 +- lib/mitre-inspec-objects/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 0d91a54..a2268e2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 +0.3.1 \ No newline at end of file diff --git a/lib/mitre-inspec-objects/version.rb b/lib/mitre-inspec-objects/version.rb index f49e6f6..52778f3 100644 --- a/lib/mitre-inspec-objects/version.rb +++ b/lib/mitre-inspec-objects/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InspecObjects - VERSION = "0.3.0" + VERSION = "0.3.1" end From bf216ce72f298e4905c2b2c83c558a5400ca3543 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:08:39 -0500 Subject: [PATCH 18/26] Update push action --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9869fc..9c02137 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: jobs: release: - name: Release to gem hosts and docker registry + name: Release to gem hosts runs-on: ubuntu-latest steps: - name: Setup ruby @@ -22,7 +22,7 @@ jobs: mkdir -p $HOME/.gem touch $HOME/.gem/credentials chmod 0600 $HOME/.gem/credentials - printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials + printf -- "---\n:push_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials printf -- ":github: Bearer ${GPR_API_KEY}\n" >> $HOME/.gem/credentials env: RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}} @@ -35,7 +35,7 @@ jobs: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - name: Publish to RubyGems run: | - gem push --KEY rubygems --host https://rubygems.org *.gem + gem push -k push_api_key --host https://rubygems.org *.gem - name: Publish to GPR run: | gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem From 52788d7049d7a632bd577ccca3c6ef18ea4bb797 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:10:54 -0500 Subject: [PATCH 19/26] Revert "0.3.1" This reverts commit 722093ea3177f820b56bc4ee1aed2aa4111f894b. --- VERSION | 2 +- lib/mitre-inspec-objects/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index a2268e2..0d91a54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.0 diff --git a/lib/mitre-inspec-objects/version.rb b/lib/mitre-inspec-objects/version.rb index 52778f3..f49e6f6 100644 --- a/lib/mitre-inspec-objects/version.rb +++ b/lib/mitre-inspec-objects/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InspecObjects - VERSION = "0.3.1" + VERSION = "0.3.0" end From 74217c9dd1a5155f7d34bd32b19b35dcd7dc2e28 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:11:51 -0500 Subject: [PATCH 20/26] Update github release workflow --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9c02137..ed1485f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: touch $HOME/.gem/credentials chmod 0600 $HOME/.gem/credentials printf -- "---\n:push_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials - printf -- ":github: Bearer ${GPR_API_KEY}\n" >> $HOME/.gem/credentials + printf -- ":github_api_key: Bearer ${GPR_API_KEY}\n" >> $HOME/.gem/credentials env: RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}} GPR_API_KEY: ${{secrets.GITHUB_TOKEN}} @@ -38,6 +38,6 @@ jobs: gem push -k push_api_key --host https://rubygems.org *.gem - name: Publish to GPR run: | - gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem + gem push -k github_api_key --host https://rubygems.pkg.github.com/${OWNER} *.gem env: OWNER: mitre \ No newline at end of file From 7ff83d5c771075901cd5901b5eeba6fdb377db7a Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:11:59 -0500 Subject: [PATCH 21/26] 0.3.1 --- VERSION | 2 +- lib/mitre-inspec-objects/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 0d91a54..9e11b32 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 +0.3.1 diff --git a/lib/mitre-inspec-objects/version.rb b/lib/mitre-inspec-objects/version.rb index f49e6f6..52778f3 100644 --- a/lib/mitre-inspec-objects/version.rb +++ b/lib/mitre-inspec-objects/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InspecObjects - VERSION = "0.3.0" + VERSION = "0.3.1" end From 04749db7526827183eaa34cd2cc9989fe78c28c4 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:15:48 -0500 Subject: [PATCH 22/26] 0.3.2 --- VERSION | 2 +- lib/mitre-inspec-objects/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 9e11b32..9fc80f9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.1 +0.3.2 \ No newline at end of file diff --git a/lib/mitre-inspec-objects/version.rb b/lib/mitre-inspec-objects/version.rb index 52778f3..be53e03 100644 --- a/lib/mitre-inspec-objects/version.rb +++ b/lib/mitre-inspec-objects/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InspecObjects - VERSION = "0.3.1" + VERSION = "0.3.2" end From 8a4a6f2eaab0e7288ed9c95094db310d6cf14fa1 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:20:50 -0500 Subject: [PATCH 23/26] Add repo to gemspec metadata --- mitre-inspec-objects.gemspec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mitre-inspec-objects.gemspec b/mitre-inspec-objects.gemspec index 1721335..e7b9a83 100644 --- a/mitre-inspec-objects.gemspec +++ b/mitre-inspec-objects.gemspec @@ -15,6 +15,11 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/mitre/inspec-objects" spec.license = "Apache-2.0" + spec.metadata = { + 'github_repo' => 'ssh://github.com/mitre/inspec-objects' + } + + spec.files = %w{ README.md mitre-inspec-objects.gemspec Gemfile } + Dir.glob("{lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } From a6485bfa31338b59d378c2eeab26574c6d643495 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:22:20 -0500 Subject: [PATCH 24/26] Satisfy rubocop for gemspec metadata --- mitre-inspec-objects.gemspec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mitre-inspec-objects.gemspec b/mitre-inspec-objects.gemspec index e7b9a83..bcab595 100644 --- a/mitre-inspec-objects.gemspec +++ b/mitre-inspec-objects.gemspec @@ -15,9 +15,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/mitre/inspec-objects" spec.license = "Apache-2.0" - spec.metadata = { - 'github_repo' => 'ssh://github.com/mitre/inspec-objects' - } + spec.metadata = { "github_repo" => "ssh://github.com/mitre/inspec-objects" } spec.files = %w{ From 8924abf561a93dd5ed63e09ee6bcdae3dd8a8862 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:23:32 -0500 Subject: [PATCH 25/26] Remove extra blank line --- mitre-inspec-objects.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/mitre-inspec-objects.gemspec b/mitre-inspec-objects.gemspec index bcab595..c80034d 100644 --- a/mitre-inspec-objects.gemspec +++ b/mitre-inspec-objects.gemspec @@ -17,7 +17,6 @@ Gem::Specification.new do |spec| spec.metadata = { "github_repo" => "ssh://github.com/mitre/inspec-objects" } - spec.files = %w{ README.md mitre-inspec-objects.gemspec Gemfile } + Dir.glob("{lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } From 0c697713d05900cf1d63cb4ff23e3ef2b20cf153 Mon Sep 17 00:00:00 2001 From: Camden Moors <66680985+camdenmoors@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:26:41 -0500 Subject: [PATCH 26/26] 0.3.3 --- VERSION | 2 +- lib/mitre-inspec-objects/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 9fc80f9..87a0871 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.2 \ No newline at end of file +0.3.3 \ No newline at end of file diff --git a/lib/mitre-inspec-objects/version.rb b/lib/mitre-inspec-objects/version.rb index be53e03..59a63c2 100644 --- a/lib/mitre-inspec-objects/version.rb +++ b/lib/mitre-inspec-objects/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InspecObjects - VERSION = "0.3.2" + VERSION = "0.3.3" end