-
Notifications
You must be signed in to change notification settings - Fork 83
/
Rakefile
85 lines (72 loc) · 1.92 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
require 'rake'
require 'rake/testtask'
require 'rubocop/rake_task'
require 'foodcritic'
task default: 'test:quick'
def version
File.read('metadata.rb')[/^version\s*'(\d.\d.\d)'/, 1]
end
desc 'Bump the version'
task :bump do
bump_level = ENV['BUMPLEVEL'] || 'patch'
sh "bump #{bump_level} --no-bundle --no-commit"
end
desc 'Update Changelog'
task :changelog do
sh "github_changelog_generator --future-release #{version}"
end
desc 'Tag the release'
task :tag do
sh "github-release release -u bdangit -r chef-influxdb --tag #{version}"
end
desc 'Print version of cookbook'
task :version do
puts version
end
desc 'Publish cookbook into Supermarket'
task :publish do
sh "cd ..; knife supermarket share influxdb 'Monitoring & Trending' -o ."
end
# rubocop:disable Metrics/BlockLength
namespace :test do
RuboCop::RakeTask.new
Rake::TestTask.new do |t|
t.name = :minitest
t.test_files = Dir.glob('test/spec/**/*_spec.rb')
end
FoodCritic::Rake::LintTask.new do |t|
t.name = :foodcritic
t.options = {
tags: ['~FC016', '~FC121'],
fail_tags: ['any']
}
end
begin
require 'kitchen'
namespace :integration do
desc 'Run Test Kitchen with Vagrant'
task :vagrant do
Kitchen.logger = Kitchen.default_file_logger
Kitchen::Config.new.instances.each do |instance|
instance.test(:always)
end
end
end
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
desc 'Run all of the quick tests.'
task :quick do
Rake::Task['test:rubocop'].invoke
Rake::Task['test:minitest'].invoke
Rake::Task['test:foodcritic'].invoke
end
desc 'Run all tests, including test-kitchen.'
task :complete do
Rake::Task['test:rubocop'].invoke
Rake::Task['test:minitest'].invoke
Rake::Task['test:foodcritic'].invoke
Rake::Task['test:integration:vagrant'].invoke
end
end
# rubocop:enable Metrics/BlockLength