lib/serverspec/setup.rb in serverspec-1.16.0 vs lib/serverspec/setup.rb in serverspec-2.0.0.beta1

- old
+ new

@@ -12,15 +12,15 @@ else ask_windows_backend end if @backend_type == 'Ssh' - print 'Vagrant instance y/n: ' + print "Vagrant instance y/n: " @vagrant = $stdin.gets.chomp if @vagrant =~ (/(true|t|yes|y|1)$/i) @vagrant = true - print 'Auto-configure Vagrant from Vagrantfile? y/n: ' + print "Auto-configure Vagrant from Vagrantfile? y/n: " auto_config = $stdin.gets.chomp if auto_config =~ (/(true|t|yes|y|1)$/i) auto_vagrant_configuration else print("Input vagrant instance name: ") @@ -33,11 +33,11 @@ end else @hostname = 'localhost' end - ['spec', "spec/#{@hostname}"].each { |dir| safe_mkdir(dir) } + [ 'spec', "spec/#{@hostname}" ].each { |dir| safe_mkdir(dir) } safe_create_spec safe_create_spec_helper safe_create_rakefile end @@ -53,11 +53,11 @@ print prompt.chop num = $stdin.gets.to_i - 1 puts - @os_type = ['UN*X', 'Windows'][num] || 'UN*X' + @os_type = [ 'UN*X', 'Windows' ][num] || 'UN*X' end def self.ask_unix_backend prompt = <<-EOF Select a backend type: @@ -69,11 +69,11 @@ EOF print prompt.chop num = $stdin.gets.to_i - 1 puts - @backend_type = ['Ssh', 'Exec'][num] || 'Exec' + @backend_type = [ 'Ssh', 'Exec' ][num] || 'Exec' end def self.ask_windows_backend prompt = <<-EOF Select a backend type: @@ -85,11 +85,11 @@ EOF print prompt.chop num = $stdin.gets.to_i - 1 puts - @backend_type = ['WinRM', 'Cmd'][num] || 'Exec' + @backend_type = [ 'WinRM', 'Cmd' ][num] || 'Exec' end def self.safe_create_spec content = <<-EOF require 'spec_helper' @@ -136,10 +136,11 @@ puts " + #{dir}/" end end def self.safe_create_spec_helper + requirements = [] content = ERB.new(spec_helper_template, nil, '-').result(binding) if File.exists? 'spec/spec_helper.rb' old_content = File.read('spec/spec_helper.rb') if old_content != content $stderr.puts "!! spec/spec_helper.rb already exists and differs from template" @@ -164,11 +165,11 @@ task :default => :spec EOF if File.exists? 'Rakefile' old_content = File.read('Rakefile') if old_content != content - $stderr.puts '!! Rakefile already exists and differs from template' + $stderr.puts "!! Rakefile already exists and differs from template" end else File.open('Rakefile', 'w') do |f| f.puts content end @@ -176,11 +177,11 @@ end end def self.find_vagrantfile Pathname.new(Dir.pwd).ascend do |dir| - path = File.expand_path('Vagrantfile', dir) + path = File.expand_path("Vagrantfile", dir) return path if File.exists?(path) end nil end @@ -196,19 +197,19 @@ end if list_of_vms.length == 1 @hostname = list_of_vms[0] else list_of_vms.each_with_index { |vm, index | puts "#{index}) #{vm}\n" } - print 'Choose a VM from the Vagrantfile: ' + print "Choose a VM from the Vagrantfile: " chosen_vm = $stdin.gets.chomp @hostname = list_of_vms[chosen_vm.to_i] end else - $stderr.puts 'Vagrant status error - Check your Vagrantfile or .vagrant' + $stderr.puts "Vagrant status error - Check your Vagrantfile or .vagrant" exit 1 end else - $stderr.puts 'Vagrantfile not found in directory!' + $stderr.puts "Vagrantfile not found in directory!" exit 1 end end def self.spec_helper_template