Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

Rubocop offense fixes #29

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions templates/Guardfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# for testing your chef cookbooks.

guard :rubocop do
watch(%r{.+\.rb$})
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
watch(/.+\.rb$/)
watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
end

guard :foodcritic, cookbook_paths: '.', cli: ['--epic-fail', 'any'] do
watch(%r{attributes/.+\.rb$})
watch(%r{providers/.+\.rb$})
watch(%r{recipes/.+\.rb$})
watch(%r{resources/.+\.rb$})
watch(%r{metadata\.rb$})
end
watch(/(?:.+\/)?\attributes\.+\.rb$/)
watch(/(?:.+\/)?\providers\.+\.rb$/)
watch(/(?:.+\/)?\recipes\.+\.rb$/)
watch(/(?:.+\/)?\resources\.+\.rb$/)
watch('metadata.rb')
end
22 changes: 9 additions & 13 deletions templates/Rakefile.erb
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
# Encoding: utf-8

namespace :prepare do

desc 'Install ChefDK'
task :chefdk do
begin
gem 'chef-dk', '0.2.1'
rescue Gem::LoadError
puts 'ChefDK not found. Installing it for you...'
sh %{wget -O /tmp/meez_chefdk.deb https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.2.1-1_amd64.deb}
sh %{sudo dpkg -i /tmp/meez_chefdk.deb}
sh %(wget -O /tmp/meez_chefdk.deb https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.2.1-1_amd64.deb)
sh %(sudo dpkg -i /tmp/meez_chefdk.deb)
end
end

task :bundle do
if ENV['CI']
sh %{chef exec bundle install --path=.bundle --jobs 1 --retry 3 --verbose}
sh %(chef exec bundle install --path=.bundle --jobs 1 --retry 3 --verbose)
else
sh %{chef exec bundle install --path .bundle}
sh %(chef exec bundle install --path .bundle)
end
end

task :berks do
sh %{chef exec berks install}
sh %(chef exec berks install)
end

end

desc 'Install required Gems and Cookbooks'
task prepare: ['prepare:bundle', 'prepare:berks']

namespace :style do
task :rubocop do
sh %{chef exec rubocop}
sh %(chef exec rubocop)
end

task :foodcritic do
sh %{chef exec foodcritic .}
sh %(chef exec foodcritic .)
end
end

Expand All @@ -53,7 +51,7 @@ task integration: ['integration:kitchen']

namespace :unit do
task :chefspec do
sh %{chef exec rspec test/unit/spec}
sh %(chef exec rspec test/unit/spec)
end
end

Expand All @@ -67,6 +65,4 @@ task test: ['style', 'unit', 'integration']

# The default rake task should just run it all
desc 'Install required Gems and Cookbook then run all tests'
task default: ['prepare', 'test' ]


task default: ['prepare', 'test']
2 changes: 1 addition & 1 deletion templates/Vagrantfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Vagrant.configure('2') do |config|
}

chef.run_list = [
'recipe[<%= cookbook_name %>::default]'
'recipe[<%= cookbook_name %>::default]'
]
end
end
1 change: 0 additions & 1 deletion templates/chefspec/default_spec.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ describe '<%= cookbook_name %>::default' do
it 'writes some chefspec code' do
skip 'todo'
end

end
end
3 changes: 1 addition & 2 deletions templates/serverspec/spec_helper.rb.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Encoding: utf-8
require 'serverspec'

include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
set :backend, :exec

RSpec.configure do |c|
c.before :all do
Expand Down