Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating common files #7

Merged
merged 2 commits into from
Oct 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
---
AllCops:
Exclude:
- vendor/**
- metadata.rb
- '**/Puppetfile'
- Puppetfile


- vendor/**/*
- "*/puppet/Puppetfile"
Documentation:
Enabled: false
AlignParameters:
Expand All @@ -17,6 +14,10 @@ HashSyntax:
LineLength:
Enabled: false
MethodLength:
Max: 30
Max: 40
NumericLiterals:
MinDigits: 10
Metrics/CyclomaticComplexity:
Max: 10
Metrics/PerceivedComplexity:
Max: 10
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
source 'https://rubygems.org'

gem 'rake'
gem 'serverspec'
gem 'serverspec', '~> 2.3.0'
gem 'rubocop', '~> 0.23'
gem 'highline', '~> 1.6.0'
34 changes: 7 additions & 27 deletions default/serverspec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
require 'net/ssh'
require 'highline/import'

include Serverspec::Helper::Ssh
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
set :backend, :ssh

RSpec.configure do |c|

Expand All @@ -43,41 +41,23 @@
end

if ENV['ASK_LOGIN_USERNAME']
user = ask("\nEnter login username: ") { |q| q.echo = false }
options[:user] = ask("\nEnter login username: ") { |q| q.echo = false }
else
user = ENV['LOGIN_USERNAME'] || ENV['user'] || Etc.getlogin
options[:user] = ENV['LOGIN_USERNAME'] || ENV['user'] || Etc.getlogin
end

if user.nil?
if options[:user].nil?
puts 'specify login user env LOGIN_USERNAME= or user='
exit 1
end

# @see https://github.com/serverspec/serverspec/issues/267
ENV['LANG'] = 'C'
options[:send_env] = options[:send_env] | [/^LANG$/]

c.host = ENV['TARGET_HOST']
options.merge(Net::SSH::Config.for(c.host))
c.ssh = Net::SSH.start(c.host, user, options)
c.os = backend.check_os
c.host = ENV['TARGET_HOST']
c.ssh_options = options.merge(Net::SSH::Config.for(c.host))

end

else
require 'serverspec'
require 'pathname'

include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS

RSpec.configure do |c|

# @see https://github.com/serverspec/serverspec/issues/267
ENV['LANG'] = 'C'

c.before :all do
c.os = backend(Serverspec::Commands::Base).check_os
end
end
set :backend, :exec
end