1 require 'rspec/core/rake_task'
2 require 'rubocop/rake_task'
4 require 'stove/rake_task'
6 tpl_cookbook = '00cookbook'
7 cookbook_name = File.basename(Dir.pwd)
9 desc 'Initialize project'
11 next if cookbook_name == tpl_cookbook
25 sh "cp ../#{tpl_cookbook}/#{conf} ./" unless File.exist?(conf)
29 %(-pne '$_.gsub!(/^cookbook-name: .*$/, "cookbook-name: #{cookbook_name}")'),
30 '-i fly-vars.local.yml',
36 next if cookbook_name == tpl_cookbook
46 sh "cp ../#{tpl_cookbook}/#{conf} ./"
50 desc 'fly set-pipeline'
51 task :'set-pipeline' do
53 "fly -t $CC_TARGET sp -p #{cookbook_name}-cookbook -c concourse.yml",
54 '-l fly-vars.yml -l fly-vars.local.yml -l ~/sec/credentials-prod.yml',
57 desc 'rake set-pipeline alias'
58 task sp: 'set-pipeline'
61 desc 'Run Ruby style checks'
62 RuboCop::RakeTask.new(:ruby) do |t|
64 '--auto-gen-config', # creates .rubocop_todo.yml
68 desc 'Run Chef style checks'
69 FoodCritic::Rake::LintTask.new(:chef) do |t|
76 desc 'Run all style checks'
77 task style: ['style:chef', 'style:ruby']
79 desc 'Run ChefSpec examples'
80 RSpec::Core::RakeTask.new(:spec)
82 desc 'Publish cookbook'
83 Stove::RakeTask.new(:publish) do |t|
85 # `--username` and `--key` are set in ~/.stove typically.
86 #'--username', 'somebody',
87 #'--key', '~/chef/chef.io.example.com/somebody.pem',
88 #'--endpoint', 'https://supermarket.io.example.com/api/v1', # default: supermarket.chef.io
91 '--log-level', 'info',
95 task default: ['style', 'spec']