Skip to content

Commit

Permalink
Merge pull request #78 from chef/ruby_revert
Browse files Browse the repository at this point in the history
Revert Ruby requirements to allow for 2.5 or later
  • Loading branch information
tyler-ball committed Jun 4, 2020
2 parents 8be25a2 + a93dcb0 commit b6064af
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
27 changes: 26 additions & 1 deletion .expeditor/verify.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ expeditor:

steps:

- label: run-specs-ruby-2.5
command:
- .expeditor/run_linux_tests.sh rspec
expeditor:
executor:
docker:
image: ruby:2.5-buster

- label: run-specs-ruby-2.6
command:
- .expeditor/run_linux_tests.sh rspec
expeditor:
executor:
docker:
image: ruby:2.6-buster

- label: run-specs-ruby-2.7
command:
- .expeditor/run_linux_tests.sh rspec
Expand All @@ -19,7 +35,16 @@ steps:
docker:
image: ruby:2.7-buster

- label: run-specs-windows
- label: run-specs-windows-2.6
command:
- powershell .expeditor/run_windows_tests.ps1 rspec
expeditor:
executor:
docker:
host_os: windows
image: rubydistros/windows-2019:2.6

- label: run-specs-windows-2.7
command:
- powershell .expeditor/run_windows_tests.ps1 rspec
expeditor:
Expand Down
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ group :test do
gem "rspec-mocks", "~> 3.8"
gem "cookstyle"
gem "chefstyle"
gem "test-kitchen", "> 2.5"
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
gem "chef-zero", "~> 14"
gem "chef", "~> 15"
end
end

group :development do
gem "pry"
gem "pry-byebug"
gem "pry-stack_explorer"
gem "pry-stack_explorer", "~> 0.4.0"
gem "rb-readline"
end
3 changes: 1 addition & 2 deletions chef-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
gem.license = "Apache-2.0"
gem.homepage = "https://www.chef.io/"

gem.required_ruby_version = ">= 2.7"
gem.required_ruby_version = ">= 2.5"

gem.files = %w{Rakefile LICENSE} +
Dir.glob("Gemfile*") + # Includes Gemfile and locks
Expand All @@ -50,6 +50,5 @@ Gem::Specification.new do |gem|
gem.add_dependency "diff-lcs", "~> 1.0"
gem.add_dependency "paint", ">= 1", "< 3"
gem.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.11"
gem.add_development_dependency "test-kitchen", "> 2.5"
gem.add_dependency "ffi", "< 1.13"
end
8 changes: 7 additions & 1 deletion lib/chef-cli/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ def show_version_via_shell_out
"Test Kitchen": "kitchen",
"Cookstyle": "cookstyle",
}.each do |name, cli|
result = Bundler.with_unbundled_env { shell_out("#{cli} --version") }
# @todo when Ruby 2.5/2.6 support goes away this if statement can go away
if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new("2")
result = Bundler.with_unbundled_env { shell_out("#{cli} --version") }
else
result = Bundler.with_clean_env { shell_out("#{cli} --version") }
end

if result.exitstatus != 0
msg("#{name} version: ERROR")
else
Expand Down

0 comments on commit b6064af

Please sign in to comment.