diff --git a/Gemfile b/Gemfile index b963c80..05bd8a8 100644 --- a/Gemfile +++ b/Gemfile @@ -12,20 +12,33 @@ def location_for(place, fake_version = nil) end end -# in the Rakefile, so we require it in all groups -rake_version = '>= 0.9.0' -if ENV['RAKE_VER'] - rake_version = "~> #{ENV['RAKE_VER']}" -end -gem 'rake' , "#{rake_version}" +# unit tests: --without system_tests development +gem 'rake' gem "rototiller", *location_for(ENV['TILLER_VERSION'] || '~> 0.1.0') gem 'rspec' ,'~> 3.4.0' group :system_tests do - gem 'beaker' ,'~> 3.0' + beaker_version = '~> 3.0' + nokogiri_version = '~> 1' # any + public_suffix_version = '~> 1' # any + activesupport_version = '~> 1' # any + # restrict gems to enable ruby versions + # + # nokogiri comes along for the ride but needs some restriction too + if Gem::Version.new(RUBY_VERSION).between?(Gem::Version.new('2.0.0'),Gem::Version.new('2.2.4')) + beaker_version = '< 3.9.0' + nokogiri_version = '< 1.7.0' + elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0') + beaker_version = '~> 2.0' + nokogiri_version = '< 1.7.0' + public_suffix_version = '< 1.5.0' + activesupport_version = '< 5.0.0' + end + gem 'beaker' ,"#{beaker_version}" gem 'beaker-hostgenerator' - gem 'public_suffix' ,'<= 1.4.6' - gem 'nokogiri' ,'<= 1.6.9' + gem 'nokogiri' ,"#{nokogiri_version}" + gem 'public_suffix' ,"#{public_suffix_version}" + gem 'activesupport' ,"#{activesupport_version}" end group :development do @@ -33,14 +46,6 @@ group :development do #Documentation dependencies gem 'yard' ,'~> 0' gem 'markdown' ,'~> 0' - # restrict version to enable ruby 1.9.3 - gem 'mime-types' ,'~> 2.0' - gem 'google-api-client' ,'<= 0.9.4' - gem 'activesupport' ,'< 5.0.0' - # restrict version to enable ruby 1.9.3 <-> 2.0.0 - if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0') - gem 'public_suffix' ,'<= 1.4.6' - end end local_gemfile = "#{__FILE__}.local" diff --git a/Rakefile b/Rakefile index b2f8359..0e6c87a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,3 @@ -require "bundler/gem_tasks" require 'rspec/core/rake_task' require 'fileutils' require 'rototiller' @@ -23,11 +22,13 @@ task :generate_host_config do |t, args| sh "cat acceptance/hosts.cfg" end +default_rake_ver = '11.0' + rototiller_task :acceptance => [:generate_host_config] do |t| t.add_env({:name => 'LAYOUT', :default => 'centos7-64', :message => 'The argument to pass to beaker-hostgenerator', :set_env => true}) - t.add_env({:name => 'RAKE_VER', :default => '12.0', + t.add_env({:name => 'RAKE_VER', :default => default_rake_ver, :message => 'The rake version to use when running unit and acceptance tests', :set_env => true}) @@ -73,7 +74,7 @@ end rototiller_task :check_test do |t| t.add_env({:name => 'SPEC_PATTERN', :default => 'spec/', :message => 'The pattern RSpec will use to find tests', :set_env => true}) - t.add_env({:name => 'RAKE_VER', :default => '11.0', :message => 'The rake version to use when running unit tests', :set_env => true}) + t.add_env({:name => 'RAKE_VER', :default => default_rake_ver, :message => 'The rake version to use when running unit tests', :set_env => true}) end task :yard => [:'docs:gen'] diff --git a/acceptance/lib/test_utilities.rb b/acceptance/lib/test_utilities.rb index 5447836..4a8c026 100644 --- a/acceptance/lib/test_utilities.rb +++ b/acceptance/lib/test_utilities.rb @@ -33,7 +33,7 @@ def execute_task_on(host, task_name=nil, rakefile_path=nil, opts={}) step "Execute task '#{task_name}', ensure success" end - command = "bundle exec rake #{task_name}" + command = "rake #{task_name}" command = command + " --verbose" if opts[:verbose] command = command + " --rakefile #{rakefile_path}" if rakefile_path on(host, command, :accept_all_exit_codes => true) do |result| diff --git a/acceptance/pre-suite/01_install_rototiller.rb b/acceptance/pre-suite/01_install_rototiller.rb index 866b384..2787520 100644 --- a/acceptance/pre-suite/01_install_rototiller.rb +++ b/acceptance/pre-suite/01_install_rototiller.rb @@ -9,9 +9,11 @@ scp_to(sut, gem_name, gem_name) if ENV['RAKE_VER'] - on(sut, "gem install rake --no-document --version #{ENV['RAKE_VER']}") + rake_version = Gem::Version.new(ENV['RAKE_VER']).approximate_recommendation + on(sut, "gem install rake --force --version '#{rake_version}'") else - on(sut, "gem install --no-document rake") + on(sut, "gem install rake --force") end - on(sut, "gem install --no-document ./#{gem_name}") + + on(sut, "gem install ./#{gem_name}") end diff --git a/acceptance/tests/rototillerTask/define_and_list_RototillerTasks.rb b/acceptance/tests/rototillerTask/define_and_list_RototillerTasks.rb index e022c4f..9c7d601 100644 --- a/acceptance/tests/rototillerTask/define_and_list_RototillerTasks.rb +++ b/acceptance/tests/rototillerTask/define_and_list_RototillerTasks.rb @@ -43,7 +43,7 @@ def create_rakefile_task_segment(options) tasks.each do |task| step "Use the -T rake switch to test task '#{task[:task_name]}' description" do - on(sut, "bundle exec rake -T --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result| + on(sut, "rake -T --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result| assert(result.exit_code == 0, 'The expected exit code 0 was not observed') assert_no_match(/error/i, result.output, 'An unexpected error was observed') if task[:description] diff --git a/acceptance/tests/rototillerTask/environment_variables.rb b/acceptance/tests/rototillerTask/environment_variables.rb index 86a6868..5d0bc8e 100644 --- a/acceptance/tests/rototillerTask/environment_variables.rb +++ b/acceptance/tests/rototillerTask/environment_variables.rb @@ -69,7 +69,7 @@ rakefile_path = create_rakefile_on(sut, rakefile_contents) step 'Execute task defined in rake task' do - on(sut, "bundle exec rake #{@task_name} --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result| + on(sut, "rake #{@task_name} --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result| # exit code & no error in output assert(result.exit_code == 1, 'The expected exit code 1 was not observed') diff --git a/rototiller.gemspec b/rototiller.gemspec index 0dcb9b6..c1e7257 100644 --- a/rototiller.gemspec +++ b/rototiller.gemspec @@ -17,5 +17,5 @@ Gem::Specification.new do |s| # RAKE_VER=0.9, 10.0, 11.0 # don't use 11.0.0, which probably installs 11.0.1 which has issues - s.add_runtime_dependency 'rake' + s.add_runtime_dependency 'rake', '< 12.0.0' end