This repository has been archived by the owner on Dec 16, 2020. It is now read-only.
forked from ehlertij/chef-wkhtmltopdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
# Berkshelf | ||
Berksfile.lock | ||
/cookbooks | ||
|
||
# Bundler | ||
.bundle | ||
.cache | ||
bin/ | ||
Gemfile.lock | ||
|
||
# Chef | ||
metadata.json | ||
tmp/ | ||
|
||
# Editors | ||
*~ | ||
*# | ||
.#* | ||
\#*# | ||
.*.sw[a-z] | ||
*.sublime-project | ||
*.sublime-workspace | ||
*.un~ | ||
|
||
# OS files | ||
.DS_Store | ||
|
||
# rbenv | ||
.ruby-version | ||
|
||
# Test Kitchen | ||
.kitchen/ | ||
.kitchen.local.yml | ||
|
||
# Vagrant | ||
.vagrant | ||
Berksfile.lock | ||
Gemfile.lock | ||
\#*# | ||
tmp/ | ||
|
||
# vagrant-cache | ||
.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
language: ruby | ||
bundler_args: --without integration | ||
rvm: | ||
- 1.9.3 | ||
bundler_args: --without development | ||
before_script: | ||
- bundle exec berks install | ||
script: | ||
# - bundle exec knife cookbook test -a -o . | ||
- bundle exec foodcritic -f any . | ||
- bundle exec rubocop | ||
script: | ||
- bundle exec rake travis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
# rubocop:disable RegexpLiteral | ||
guard 'kitchen' do | ||
watch(%r{test/.+}) | ||
watch(%r{^recipes/(.+)\.rb$}) | ||
watch(%r{^attributes/(.+)\.rb$}) | ||
watch(%r{^files/(.+)}) | ||
watch(%r{^templates/(.+)}) | ||
watch(%r{^providers/(.+)\.rb}) | ||
watch(%r{^resources/(.+)\.rb}) | ||
end | ||
# rubocop:enable RegexpLiteral |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,64 @@ | ||
#!/usr/bin/env rake | ||
|
||
task :default => 'foodcritic' | ||
# Style tests. Rubocop and Foodcritic | ||
namespace :style do | ||
begin | ||
require 'rubocop/rake_task' | ||
desc 'Run Ruby style checks' | ||
Rubocop::RakeTask.new(:ruby) | ||
rescue LoadError | ||
puts '>>>>> Rubocop gem not loaded, omitting tasks' unless ENV['CI'] | ||
end | ||
|
||
desc "Runs foodcritic linter" | ||
task :foodcritic do | ||
Rake::Task[:prepare_sandbox].execute | ||
begin | ||
require 'foodcritic' | ||
|
||
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup) | ||
sh "foodcritic -f any #{sandbox_path}" | ||
else | ||
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2." | ||
desc 'Run Chef style checks' | ||
FoodCritic::Rake::LintTask.new(:chef) do |t| | ||
t.options = { | ||
fail_tags: ['any'] | ||
} | ||
end | ||
rescue LoadError | ||
puts '>>>>> foodcritic gem not loaded, omitting tasks' unless ENV['CI'] | ||
end | ||
end | ||
|
||
desc "Runs knife cookbook test" | ||
task :knife do | ||
Rake::Task[:prepare_sandbox].execute | ||
|
||
sh "bundle exec knife cookbook test cookbook -c test/.chef/knife.rb -o #{sandbox_path}/../" | ||
end | ||
desc 'Run all style checks' | ||
task style: ['style:chef', 'style:ruby'] | ||
|
||
task :prepare_sandbox do | ||
files = %w{*.md *.rb attributes definitions libraries files providers recipes resources templates} | ||
# Integration tests. Kitchen.ci | ||
namespace :integration do | ||
begin | ||
require 'kitchen/rake_tasks' | ||
|
||
rm_rf sandbox_path | ||
mkdir_p sandbox_path | ||
cp_r Dir.glob("{#{files.join(',')}}"), sandbox_path | ||
desc 'Run kitchen integration tests' | ||
Kitchen::RakeTasks.new | ||
rescue LoadError | ||
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI'] | ||
end | ||
end | ||
|
||
private | ||
def sandbox_path | ||
File.join(File.dirname(__FILE__), %w(tmp cookbooks cookbook)) | ||
# Unit tests with rspec/chefspec | ||
namespace :unit do | ||
begin | ||
require 'rspec/core/rake_task' | ||
desc 'Run unit tests with RSpec/ChefSpec' | ||
RSpec::Core::RakeTask.new(:rspec) do |t| | ||
t.rspec_opts = [].tap do |a| | ||
a.push('--color') | ||
a.push('--format progress') | ||
end.join(' ') | ||
end | ||
rescue LoadError | ||
puts '>>>>> rspec gem not loaded, omitting tasks' unless ENV['CI'] | ||
end | ||
end | ||
|
||
task unit: ['unit:rspec'] | ||
|
||
desc 'Run all tests on Travis' | ||
task travis: %w(style unit) | ||
|
||
# Default | ||
task default: ['style', 'unit', 'integration:kitchen:all'] |