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
24 sh "cp ../#{tpl_cookbook}/#{conf} ./" unless File.exist?(conf)
28 %(-pne '$_.gsub!(/^cookbook-name: .*$/, "cookbook-name: #{cookbook_name}")'),
29 '-i fly-vars.local.yml',
35 next if cookbook_name == tpl_cookbook
44 sh "cp ../#{tpl_cookbook}/#{conf} ./"
48 desc 'fly set-pipeline'
49 task :'set-pipeline' do
51 "fly -t $CC_TARGET sp -p #{cookbook_name}-cookbook -c concourse.yml",
52 '-l fly-vars.yml -l fly-vars.local.yml -l ~/sec/credentials-prod.yml',
55 desc 'rake set-pipeline alias'
56 task sp: 'set-pipeline'
59 desc 'Run Ruby style checks'
60 RuboCop::RakeTask.new(:ruby) do |t|
62 '--auto-gen-config', # creates .rubocop_todo.yml
66 desc 'Run Chef style checks'
67 FoodCritic::Rake::LintTask.new(:chef) do |t|
74 desc 'Run all style checks'
75 task style: ['style:chef', 'style:ruby']
77 desc 'Run ChefSpec examples'
78 RSpec::Core::RakeTask.new(:spec)
80 desc 'Publish cookbook'
81 Stove::RakeTask.new(:publish) do |t|
83 # `--username` and `--key` are set in ~/.stove typically.
84 #'--username', 'somebody',
85 #'--key', '~/chef/chef.io.example.com/somebody.pem',
86 #'--endpoint', 'https://supermarket.io.example.com/api/v1', # default: supermarket.chef.io
89 '--log-level', 'info',
93 task default: ['style', 'spec']