class Busser::RunnerPlugin::ServerspecEol
A Busser
runner plugin for Serverspec.
@author HIGUCHI Daisuke <d-higuchi@creationline.com>
Public Instance Methods
install_serverspec()
click to toggle source
# File lib/busser/runner_plugin/serverspec-eol.rb, line 69 def install_serverspec Gem::Specification.reset if Array(Gem::Specification.find_all_by_name('serverspec')).size == 0 if is_old_ruby? banner('Installing net-ssh < 2.10') install_gem('net-ssh', '< 2.10') end banner('Installing Serverspec..') spec = install_gem('serverspec') banner "serverspec installed (version #{spec.version})" end end
is_old_ruby?()
click to toggle source
# File lib/busser/runner_plugin/serverspec-eol.rb, line 46 def is_old_ruby? requirement = Gem::Requirement.new "< 2.3.0" ruby_verion = Gem::Version.new RUBY_VERSION requirement.satisfied_by? ruby_version end
run_bundle_install()
click to toggle source
# File lib/busser/runner_plugin/serverspec-eol.rb, line 52 def run_bundle_install banner('Checking for local Gemfile') # Referred from busser-shindo gemfile_path = File.join(suite_path, 'serverspec-eol', 'Gemfile') if File.exists?(gemfile_path) banner('Found local Gemfile') # Bundle install local completes quickly if the gems are already found # locally it fails if it needs to talk to the internet. The || below is # the fallback to the internet-enabled version. It's a speed optimization. banner('Bundle Installing..') ENV['PATH'] = [ENV['PATH'], Gem.bindir, RbConfig::CONFIG['bindir']].join(File::PATH_SEPARATOR) bundle_exec = "#{File.join(RbConfig::CONFIG['bindir'], 'ruby')} " + "#{File.join(Gem.bindir, 'bundle')} install --gemfile #{gemfile_path}" run("#{bundle_exec} --local || #{bundle_exec}") end end
test()
click to toggle source
# File lib/busser/runner_plugin/serverspec-eol.rb, line 36 def test run_bundle_install install_serverspec runner = File.join(File.dirname(__FILE__), %w{.. serverspec runner.rb}) run_ruby_script!("#{runner} #{suite_path('serverspec-eol').to_s}") end