From 8512ebe88c16cf4b30cc002fc618551aa5c2b22a Mon Sep 17 00:00:00 2001 From: laddanki Date: Fri, 25 Oct 2019 11:10:10 +0800 Subject: [PATCH] upgraded ruby gems --- CHANGELOG.md | 4 ++++ lib/poise_ruby/resources/ruby_gem.rb | 18 ++++++++++++++ lib/poise_ruby/ruby_providers/scl.rb | 3 ++- lib/poise_ruby/version.rb | 2 +- poise-ruby.gemspec | 2 +- test/cookbook/recipes/bundle_install.rb | 6 ++++- test/cookbook/recipes/default.rb | 10 +++++--- test/gemfiles/chef-12.10.gemfile | 23 ------------------ test/gemfiles/chef-12.11.gemfile | 23 ------------------ ...{chef-12.13.gemfile => chef-12.20.gemfile} | 7 ++---- ...{chef-12.12.gemfile => chef-12.21.gemfile} | 7 ++---- test/gemfiles/chef-12.3.gemfile | 23 ------------------ test/gemfiles/chef-12.4.gemfile | 24 ------------------- test/gemfiles/chef-12.5.gemfile | 23 ------------------ test/gemfiles/chef-12.6.gemfile | 23 ------------------ test/gemfiles/chef-12.7.gemfile | 23 ------------------ test/gemfiles/chef-12.8.gemfile | 23 ------------------ test/gemfiles/chef-12.9.gemfile | 23 ------------------ test/gemfiles/chef-12.gemfile | 2 +- .../{chef-12.1.gemfile => chef-13.1.gemfile} | 8 ++----- .../{chef-12.2.gemfile => chef-13.2.gemfile} | 8 ++----- test/gemfiles/chef-13.3.gemfile | 19 +++++++++++++++ test/gemfiles/chef-13.4.gemfile | 19 +++++++++++++++ test/gemfiles/chef-13.5.gemfile | 19 +++++++++++++++ test/gemfiles/chef-13.6.gemfile | 19 +++++++++++++++ test/gemfiles/chef-13.8.gemfile | 19 +++++++++++++++ test/gemfiles/chef-13.gemfile | 2 +- test/gemfiles/chef-14.0.gemfile | 19 +++++++++++++++ test/gemfiles/chef-14.gemfile | 19 +++++++++++++++ .../default/serverspec/bundle_install_spec.rb | 21 ++++++++-------- test/spec/resources/bundle_install_spec.rb | 8 +++---- test/spec/resources/ruby_execute_spec.rb | 2 ++ test/spec/ruby_providers/scl_spec.rb | 16 +++++++++---- 33 files changed, 208 insertions(+), 259 deletions(-) delete mode 100644 test/gemfiles/chef-12.10.gemfile delete mode 100644 test/gemfiles/chef-12.11.gemfile rename test/gemfiles/{chef-12.13.gemfile => chef-12.20.gemfile} (81%) rename test/gemfiles/{chef-12.12.gemfile => chef-12.21.gemfile} (81%) delete mode 100644 test/gemfiles/chef-12.3.gemfile delete mode 100644 test/gemfiles/chef-12.4.gemfile delete mode 100644 test/gemfiles/chef-12.5.gemfile delete mode 100644 test/gemfiles/chef-12.6.gemfile delete mode 100644 test/gemfiles/chef-12.7.gemfile delete mode 100644 test/gemfiles/chef-12.8.gemfile delete mode 100644 test/gemfiles/chef-12.9.gemfile rename test/gemfiles/{chef-12.1.gemfile => chef-13.1.gemfile} (79%) rename test/gemfiles/{chef-12.2.gemfile => chef-13.2.gemfile} (79%) create mode 100644 test/gemfiles/chef-13.3.gemfile create mode 100644 test/gemfiles/chef-13.4.gemfile create mode 100644 test/gemfiles/chef-13.5.gemfile create mode 100644 test/gemfiles/chef-13.6.gemfile create mode 100644 test/gemfiles/chef-13.8.gemfile create mode 100644 test/gemfiles/chef-14.0.gemfile create mode 100644 test/gemfiles/chef-14.gemfile diff --git a/CHANGELOG.md b/CHANGELOG.md index d78dc3a..22d7ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v2.4.0 + +* Add support for the rh-ruby24 SCL package. + ## v2.3.0 * Chef 13 support. diff --git a/lib/poise_ruby/resources/ruby_gem.rb b/lib/poise_ruby/resources/ruby_gem.rb index 17d10c3..5e1d480 100644 --- a/lib/poise_ruby/resources/ruby_gem.rb +++ b/lib/poise_ruby/resources/ruby_gem.rb @@ -21,6 +21,24 @@ require 'poise_ruby/ruby_command_mixin' +# Monkey patch test +if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7") + require 'chef/provider/package/rubygems' + Chef::Provider::Package::Rubygems::AlternateGemEnvironment.prepend(Module.new { + def installed_versions(gem_dep) + # Load installed stubs. + stubs = gem_specification.send(:installed_stubs, gem_specification.dirs, "#{gem_dep.name}-*.gemspec") + stubs.select! {|stub| stub.name == gem_dep.name } + stubs.uniq!(&:full_name) + stubs.select! {|stub| gem_dep.requirement.satisfied_by?(stub.version) } + stubs.sort_by! {|stub| stub.version } + stubs.reverse! + stubs + end + }) +end + + module PoiseRuby module Resources # (see RubyGem::Resource) diff --git a/lib/poise_ruby/ruby_providers/scl.rb b/lib/poise_ruby/ruby_providers/scl.rb index c04f59e..795a9a1 100644 --- a/lib/poise_ruby/ruby_providers/scl.rb +++ b/lib/poise_ruby/ruby_providers/scl.rb @@ -25,7 +25,8 @@ module RubyProviders class Scl < Base include PoiseLanguages::Scl::Mixin provides(:scl) - scl_package('2.3.0', 'rh-ruby23', 'rh-ruby23-ruby-devel', '>= 7.0') + scl_package('2.4.0', 'rh-ruby24', 'rh-ruby24-ruby-devel') + scl_package('2.3.1', 'rh-ruby23', 'rh-ruby23-ruby-devel') scl_package('2.2.2', 'rh-ruby22', 'rh-ruby22-ruby-devel') # On EL7, the system package is Ruby 2.0.0 and is newer than the SCL build. scl_package('2.0.0', 'ruby200', 'ruby200-ruby-devel', '~> 6.0') diff --git a/lib/poise_ruby/version.rb b/lib/poise_ruby/version.rb index 22d7b2a..f789353 100644 --- a/lib/poise_ruby/version.rb +++ b/lib/poise_ruby/version.rb @@ -16,5 +16,5 @@ module PoiseRuby - VERSION = '2.3.1.pre' + VERSION = '2.4.1.pre' end diff --git a/poise-ruby.gemspec b/poise-ruby.gemspec index 3c8759c..403d6c4 100644 --- a/poise-ruby.gemspec +++ b/poise-ruby.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = %w{lib} - spec.add_dependency 'chef', '>= 12.1', '< 14' + spec.add_dependency 'chef', '>= 12.14', '< 15' spec.add_dependency 'halite', '~> 1.0' spec.add_dependency 'poise', '~> 2.0' spec.add_dependency 'poise-languages', '~> 2.0' diff --git a/test/cookbook/recipes/bundle_install.rb b/test/cookbook/recipes/bundle_install.rb index ef8b5c3..b624b2a 100644 --- a/test/cookbook/recipes/bundle_install.rb +++ b/test/cookbook/recipes/bundle_install.rb @@ -16,7 +16,11 @@ ruby_runtime 'bundle_install test' do version '' - provider :system + if platform_family?('rhel') && node['platform_version'].start_with?('6') + provider :scl + else + provider :system + end end directory '/opt/bundle1' diff --git a/test/cookbook/recipes/default.rb b/test/cookbook/recipes/default.rb index e621eb5..0c0565f 100644 --- a/test/cookbook/recipes/default.rb +++ b/test/cookbook/recipes/default.rb @@ -29,9 +29,13 @@ runtime_provider :chef end -ruby_runtime_test 'system' do - version '' - runtime_provider :system +if platform_family?('rhel') && node['platform_version'].start_with?('6') + file '/no_system' +else + ruby_runtime_test 'system' do + version '' + runtime_provider :system + end end if platform_family?('rhel') diff --git a/test/gemfiles/chef-12.10.gemfile b/test/gemfiles/chef-12.10.gemfile deleted file mode 100644 index a98cfc0..0000000 --- a/test/gemfiles/chef-12.10.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.10.24' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.11.gemfile b/test/gemfiles/chef-12.11.gemfile deleted file mode 100644 index 302cf79..0000000 --- a/test/gemfiles/chef-12.11.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.11.18' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.13.gemfile b/test/gemfiles/chef-12.20.gemfile similarity index 81% rename from test/gemfiles/chef-12.13.gemfile rename to test/gemfiles/chef-12.20.gemfile index 67e00b8..24473c3 100644 --- a/test/gemfiles/chef-12.13.gemfile +++ b/test/gemfiles/chef-12.20.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.13.37' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' +gem 'chef', '~> 12.20.3' diff --git a/test/gemfiles/chef-12.12.gemfile b/test/gemfiles/chef-12.21.gemfile similarity index 81% rename from test/gemfiles/chef-12.12.gemfile rename to test/gemfiles/chef-12.21.gemfile index 4724162..b15de0b 100644 --- a/test/gemfiles/chef-12.12.gemfile +++ b/test/gemfiles/chef-12.21.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.12.15' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' +gem 'chef', '~> 12.21.31' diff --git a/test/gemfiles/chef-12.3.gemfile b/test/gemfiles/chef-12.3.gemfile deleted file mode 100644 index 8700b6c..0000000 --- a/test/gemfiles/chef-12.3.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.3.0' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.4.gemfile b/test/gemfiles/chef-12.4.gemfile deleted file mode 100644 index 00fc198..0000000 --- a/test/gemfiles/chef-12.4.gemfile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.4.3' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'gh', '0.14.0' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.5.gemfile b/test/gemfiles/chef-12.5.gemfile deleted file mode 100644 index d0c73a4..0000000 --- a/test/gemfiles/chef-12.5.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.5.1' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.6.gemfile b/test/gemfiles/chef-12.6.gemfile deleted file mode 100644 index fdd4417..0000000 --- a/test/gemfiles/chef-12.6.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.6.0' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.7.gemfile b/test/gemfiles/chef-12.7.gemfile deleted file mode 100644 index 9c22595..0000000 --- a/test/gemfiles/chef-12.7.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.7.2' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.8.gemfile b/test/gemfiles/chef-12.8.gemfile deleted file mode 100644 index 2b390eb..0000000 --- a/test/gemfiles/chef-12.8.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.8.1' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.9.gemfile b/test/gemfiles/chef-12.9.gemfile deleted file mode 100644 index b67456e..0000000 --- a/test/gemfiles/chef-12.9.gemfile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2016-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.9.41' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' diff --git a/test/gemfiles/chef-12.gemfile b/test/gemfiles/chef-12.gemfile index bd22a0f..1209719 100644 --- a/test/gemfiles/chef-12.gemfile +++ b/test/gemfiles/chef-12.gemfile @@ -16,4 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.19' +gem 'chef', '~> 12.21' diff --git a/test/gemfiles/chef-12.1.gemfile b/test/gemfiles/chef-13.1.gemfile similarity index 79% rename from test/gemfiles/chef-12.1.gemfile rename to test/gemfiles/chef-13.1.gemfile index 170e314..8c1dc72 100644 --- a/test/gemfiles/chef-12.1.gemfile +++ b/test/gemfiles/chef-13.1.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2015-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.1.2' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' +gem 'chef', '~> 13.1.31' diff --git a/test/gemfiles/chef-12.2.gemfile b/test/gemfiles/chef-13.2.gemfile similarity index 79% rename from test/gemfiles/chef-12.2.gemfile rename to test/gemfiles/chef-13.2.gemfile index 3b3d674..015a6f8 100644 --- a/test/gemfiles/chef-12.2.gemfile +++ b/test/gemfiles/chef-13.2.gemfile @@ -1,5 +1,5 @@ # -# Copyright 2015-2017, Noah Kantrowitz +# Copyright 2018, Noah Kantrowitz # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 12.2.1' -gem 'chefspec', '< 6' -gem 'fauxhai', '<= 3.9.0' -gem 'foodcritic', '< 8' -gem 'rack', '< 2' +gem 'chef', '~> 13.2.20' diff --git a/test/gemfiles/chef-13.3.gemfile b/test/gemfiles/chef-13.3.gemfile new file mode 100644 index 0000000..cf2a9bc --- /dev/null +++ b/test/gemfiles/chef-13.3.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# 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. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.3.42' diff --git a/test/gemfiles/chef-13.4.gemfile b/test/gemfiles/chef-13.4.gemfile new file mode 100644 index 0000000..ea6fbee --- /dev/null +++ b/test/gemfiles/chef-13.4.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# 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. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.4.24' diff --git a/test/gemfiles/chef-13.5.gemfile b/test/gemfiles/chef-13.5.gemfile new file mode 100644 index 0000000..ecffdfa --- /dev/null +++ b/test/gemfiles/chef-13.5.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# 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. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.5.3' diff --git a/test/gemfiles/chef-13.6.gemfile b/test/gemfiles/chef-13.6.gemfile new file mode 100644 index 0000000..315d54e --- /dev/null +++ b/test/gemfiles/chef-13.6.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# 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. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.6.4' diff --git a/test/gemfiles/chef-13.8.gemfile b/test/gemfiles/chef-13.8.gemfile new file mode 100644 index 0000000..60aa2c3 --- /dev/null +++ b/test/gemfiles/chef-13.8.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# 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. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 13.8.0' diff --git a/test/gemfiles/chef-13.gemfile b/test/gemfiles/chef-13.gemfile index f7f40e8..e052337 100644 --- a/test/gemfiles/chef-13.gemfile +++ b/test/gemfiles/chef-13.gemfile @@ -16,4 +16,4 @@ eval_gemfile File.expand_path('../../../Gemfile', __FILE__) -gem 'chef', '~> 13.0' +gem 'chef', '~> 13.8' diff --git a/test/gemfiles/chef-14.0.gemfile b/test/gemfiles/chef-14.0.gemfile new file mode 100644 index 0000000..31ec48c --- /dev/null +++ b/test/gemfiles/chef-14.0.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# 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. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.0.202' diff --git a/test/gemfiles/chef-14.gemfile b/test/gemfiles/chef-14.gemfile new file mode 100644 index 0000000..e197a6f --- /dev/null +++ b/test/gemfiles/chef-14.gemfile @@ -0,0 +1,19 @@ +# +# Copyright 2018, Noah Kantrowitz +# +# 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. +# + +eval_gemfile File.expand_path('../../../Gemfile', __FILE__) + +gem 'chef', '~> 14.0' diff --git a/test/integration/default/serverspec/bundle_install_spec.rb b/test/integration/default/serverspec/bundle_install_spec.rb index 2529c45..9996cab 100644 --- a/test/integration/default/serverspec/bundle_install_spec.rb +++ b/test/integration/default/serverspec/bundle_install_spec.rb @@ -18,6 +18,12 @@ set :backend, :exec describe 'bundle_install' do + scl_prefix = if os[:family] == 'redhat' && os[:release] =~ /^6/ + 'scl enable rh-ruby24 -- ' + else + '' + end + describe 'system-level install' do rake_binary = case os[:family] when 'debian', 'ubuntu' @@ -25,7 +31,7 @@ when 'redhat' case os[:release] when /^6/ - '/usr/bin/rake' + '/opt/rh/rh-ruby24/root/usr/local/bin/rake' else '/usr/local/bin/rake' end @@ -35,7 +41,7 @@ it { is_expected.to be_a_file } end - describe command("#{rake_binary} --version") do + describe command("#{scl_prefix}#{rake_binary} --version") do its(:exit_status) { is_expected.to eq 0 } end end @@ -45,7 +51,7 @@ it { is_expected.to be_a_file } end - describe command('/opt/bundle2/bin/rake --version') do + describe command("#{scl_prefix}/opt/bundle2/bin/rake --version") do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to include('10.4.2') } end @@ -66,14 +72,7 @@ it { is_expected.to be_a_file } end - scl_name = case os[:release] - when /^6/ - 'rh-ruby22' - else - 'rh-ruby23' - end - - describe command("scl enable #{scl_name} \"/opt/bundle3/bin/rake --version\"") do + describe command("scl enable rh-ruby24 -- /opt/bundle3/bin/rake --version") do its(:exit_status) { is_expected.to eq 0 } end end diff --git a/test/spec/resources/bundle_install_spec.rb b/test/spec/resources/bundle_install_spec.rb index f8eca9f..b9cb8a1 100644 --- a/test/spec/resources/bundle_install_spec.rb +++ b/test/spec/resources/bundle_install_spec.rb @@ -40,7 +40,7 @@ end # /describe PoiseRuby::Resources::BundleInstall::Resource describe PoiseRuby::Resources::BundleInstall::Provider do - let(:new_resource) { double('new_resource', parent_ruby: nil, timeout: 900, ruby: '/usr/bin/ruby', user: nil) } + let(:new_resource) { double('new_resource', name: 'test', cookbook_name: 'test', parent_ruby: nil, timeout: 900, ruby: '/usr/bin/ruby', user: nil) } let(:provider) { described_class.new(new_resource, nil) } describe '#action_install' do @@ -114,7 +114,7 @@ end # /describe #run_bundler describe '#gem_bin' do - let(:new_resource) { double('new_resource', gem_binary: '/usr/local/bin/gem', parent_ruby: nil, timeout: 900, ruby: '/usr/bin/ruby') } + let(:new_resource) { double('new_resource', name: 'test', cookbook_name: 'test', gem_binary: '/usr/local/bin/gem', parent_ruby: nil, timeout: 900, ruby: '/usr/bin/ruby') } let(:gem_environment) { '' } subject { provider.send(:poise_gem_bindir) } before do @@ -197,7 +197,7 @@ end # /describe #gem_bin describe '#bundler_options' do - let(:default_options) { %i{binstubs deployment without jobs retry vendor}.inject({}) {|memo, v| memo[v] = nil; memo } } + let(:default_options) { %i{binstubs deployment without jobs retry vendor}.inject({name: 'test', cookbook_name: 'test'}) {|memo, v| memo[v] = nil; memo } } let(:options) { {} } let(:new_resource) { double('new_resource', default_options.merge(options)) } subject { provider.send(:bundler_options) } @@ -270,7 +270,7 @@ describe '#gemfile_path' do let(:path) { '' } let(:files) { [] } - let(:new_resource) { double('new_resource', path: path) } + let(:new_resource) { double('new_resource', name: 'test', cookbook_name: 'test', path: path) } subject { provider.send(:gemfile_path) } before do allow(File).to receive(:file?).and_return(false) diff --git a/test/spec/resources/ruby_execute_spec.rb b/test/spec/resources/ruby_execute_spec.rb index 4535b5a..1985421 100644 --- a/test/spec/resources/ruby_execute_spec.rb +++ b/test/spec/resources/ruby_execute_spec.rb @@ -33,6 +33,8 @@ let(:parent_bundle) { nil } let(:new_resource) do double('new_resource', + name: 'test', + cookbook_name: 'test', command: command, environment: environment, ruby: ruby, diff --git a/test/spec/ruby_providers/scl_spec.rb b/test/spec/ruby_providers/scl_spec.rb index e2be852..48a8ce3 100644 --- a/test/spec/ruby_providers/scl_spec.rb +++ b/test/spec/ruby_providers/scl_spec.rb @@ -18,7 +18,7 @@ describe PoiseRuby::RubyProviders::Scl do let(:ruby_version) { '' } - let(:chefspec_options) { {platform: 'centos', version: '7.0'} } + let(:chefspec_options) { {platform: 'centos', version: '7.3.1611'} } let(:default_attributes) { {poise_ruby_version: ruby_version} } let(:ruby_runtime) { chef_run.ruby_runtime('test') } step_into(:ruby_runtime) @@ -45,7 +45,7 @@ context 'with version ""' do let(:ruby_version) { '' } - it_behaves_like 'scl provider', 'rh-ruby23' + it_behaves_like 'scl provider', 'rh-ruby24' end # /context with version "" context 'with version "2.2"' do @@ -53,16 +53,22 @@ it_behaves_like 'scl provider', 'rh-ruby22' end # /context with version "2.2" + context 'with version "2.3"' do + let(:ruby_version) { '2.3' } + it_behaves_like 'scl provider', 'rh-ruby23' + end # /context with version "2.3" + + context 'with version "2"' do let(:ruby_version) { '2' } - it_behaves_like 'scl provider', 'rh-ruby23' + it_behaves_like 'scl provider', 'rh-ruby24' end # /context with version "2" context 'with version "" on CentOS 6' do - let(:chefspec_options) { {platform: 'centos', version: '6.0'} } + let(:chefspec_options) { {platform: 'centos', version: '6.8'} } let(:ruby_version) { '' } - it_behaves_like 'scl provider', 'rh-ruby22' + it_behaves_like 'scl provider', 'rh-ruby24' end # /context with version "" on CentOS 6 context 'action :uninstall' do