Skip to content

Commit

Permalink
Merge pull request #15 from ehaselwanter/rubocop
Browse files Browse the repository at this point in the history
update rubocop, add common linter task, fix rubocop issues
  • Loading branch information
arlimus committed Jun 23, 2014
2 parents 2bd0000 + 8e6f01f commit 62c5bd4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source 'https://rubygems.org'

gem 'rake'
gem 'serverspec'
gem 'rubocop', '~> 0.18.1'
gem 'rubocop', '~> 0.23'
20 changes: 9 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
# encoding: utf-8

require 'rake'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

# Rubocop
desc 'Run Rubocop lint checks'
task :rubocop do
Rubocop::RakeTask.new
RuboCop::RakeTask.new
end

# Lint the cookbook
desc "Run linters"
task :lint => [ :rubocop ]
desc 'Run linters'
task :run_all_linters => [:rubocop] # rubocop:disable Style/HashSyntax

# Serverspec tests
suites = Dir.glob('*').select{|entry| File.directory?(entry) }
suites = Dir.glob('*').select { |entry| File.directory?(entry) }

class ServerspecTask < RSpec::Core::RakeTask

attr_accessor :target

def spec_command

if target.nil?
puts "specify either env TARGET_HOST or target_host="
if target.nil?
puts 'specify either env TARGET_HOST or target_host='
exit 1
end

cmd = super
"env TARGET_HOST=#{target} STANDALONE_SPEC=true #{cmd} --format documentation --no-profile"
end

end

namespace :serverspec do
suites.each do |suite|
desc "Run serverspec suite #{suite}"
ServerspecTask.new(suite.to_sym) do |t|
t.rspec_opts = "--no-color --format html --out report.html" if ENV['format'] == 'html'
t.rspec_opts = '--no-color --format html --out report.html' if ENV['format'] == 'html'
t.target = ENV['TARGET_HOST'] || ENV['target_host']
t.ruby_opts = "-I #{suite}/serverspec"
t.pattern = "#{suite}/serverspec/*_spec.rb"
end
end
end

2 changes: 1 addition & 1 deletion default/serverspec/sysctl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
describe 'IP V6 Networking' do

context linux_kernel_parameter('net.ipv6.conf.all.disable_ipv6') do
its(:value) { should eq 1 }
its(:value) { should eq 1 }
end

# GIS: Req 3.21-1
Expand Down

0 comments on commit 62c5bd4

Please sign in to comment.