diff --git a/berkshelf.gemspec b/berkshelf.gemspec index 1f6c4263a..5682d82e1 100644 --- a/berkshelf.gemspec +++ b/berkshelf.gemspec @@ -39,10 +39,17 @@ Gem::Specification.new do |s| s.add_dependency "chef-cleanroom", "~> 1.0" - if ruby_version >= "3.1" + if ruby_version >= Gem::Version.new("3.1.0") s.add_dependency "minitar", "~> 1.0" + s.add_dependency "chef", ">= 18.0.0" else s.add_dependency "minitar", "~> 0.12" + + if ruby_version >= Gem::Version.new("3.0.0") + s.add_dependency "chef", "~> 17.0" # needed for --skip-syntax-check + else + s.add_dependency "chef", ">= 15.7.32" + end end s.add_dependency "retryable", ">= 2.0", "< 4.0" @@ -54,11 +61,6 @@ Gem::Specification.new do |s| s.add_dependency "ffi", "~> 1.9", "< 1.16.0" # - if RUBY_VERSION.match?(/3.0/) - s.add_dependency "chef", "~> 17.0" # needed for --skip-syntax-check - elsif - s.add_dependency "chef", ">= 15.7.32" - end s.add_dependency "chef-config" # this is required for Mixlib::Config#from_json s.add_dependency "mixlib-config", ">= 2.2.5" diff --git a/features/commands/install.feature b/features/commands/install.feature index b753281b8..31dfedbf5 100644 --- a/features/commands/install.feature +++ b/features/commands/install.feature @@ -624,24 +624,24 @@ Feature: berks install Resolving cookbook dependencies... """ -# Scenario: when using a chef_repo source -# Given I use a fixture named "complex-cookbook-path" -# And a file named "Berksfile" with: -# """ -# source chef_repo: '.' -# -# cookbook 'jenkins-config' -# """ -# When I successfully run `berks install` -# Then the output should contain: -# """ -# Installing jenkins (2.0.1) from -# """ -# And the output should contain: -# """ -# Installing jenkins-config (0.1.0) from -# """ -# And the cookbook store should have the cookbooks: -# | jenkins | 2.0.1 | -# | jenkins-config | 0.1.0 | -# \ No newline at end of file + Scenario: when using a chef_repo source + Given I use a fixture named "complex-cookbook-path" + And a file named "Berksfile" with: + """ + source chef_repo: '.' + + cookbook 'jenkins-config' + """ + When I successfully run `berks install` + Then the output should contain: + """ + Installing jenkins (2.0.1) from + """ + And the output should contain: + """ + Installing jenkins-config (0.1.0) from + """ + And the cookbook store should have the cookbooks: + | jenkins | 2.0.1 | + | jenkins-config | 0.1.0 | +