Skip to content

Commit e6d17f2

Browse files
committed
update Rakefile
Signed-off-by: Patrick Münch <patrick.muench1111@gmail.com>
1 parent 0c6c56f commit e6d17f2

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

Rakefile

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#!/usr/bin/env rake
12
# encoding: utf-8
23

3-
require 'rake'
4-
require 'rspec/core/rake_task'
4+
require 'rake/testtask'
55
require 'rubocop/rake_task'
66

77
# Rubocop
@@ -10,37 +10,30 @@ task :rubocop do
1010
RuboCop::RakeTask.new
1111
end
1212

13-
# Lint the cookbook
14-
desc 'Run linters'
15-
task :run_all_linters => [:rubocop] # rubocop:disable Style/HashSyntax
16-
task :default => :run_all_linters # rubocop:disable Style/HashSyntax
13+
# lint the project
14+
desc 'Run robocop linter'
15+
task lint: [:rubocop]
1716

18-
# Serverspec tests
19-
suites = Dir.glob('*').select { |entry| File.directory?(entry) }
17+
# run tests
18+
task default: [:lint, 'test:check']
2019

21-
class ServerspecTask < RSpec::Core::RakeTask
22-
attr_accessor :target
23-
24-
def spec_command
25-
if target.nil?
26-
puts 'specify either env TARGET_HOST or target_host='
27-
exit 1
28-
end
29-
30-
cmd = super
31-
"env TARGET_HOST=#{target} STANDALONE_SPEC=true #{cmd} --format documentation --no-profile"
20+
namespace :test do
21+
# run inspec check to verify that the profile is properly configured
22+
task :check do
23+
dir = File.join(File.dirname(__FILE__))
24+
sh("bundle exec inspec check #{dir}")
3225
end
3326
end
3427

35-
namespace :serverspec do
36-
suites.each do |suite|
37-
desc "Run serverspec suite #{suite}"
38-
ServerspecTask.new(suite.to_sym) do |t|
39-
t.rspec_opts = '--no-color --format html --out report.html' if ENV['format'] == 'html'
40-
t.rspec_opts = '--no-color --format json --out report.json' if ENV['format'] == 'json'
41-
t.target = ENV['TARGET_HOST'] || ENV['target_host']
42-
t.ruby_opts = "-I #{suite}/serverspec"
43-
t.pattern = "#{suite}/serverspec/*_spec.rb"
44-
end
28+
# Automatically generate a changelog for this project. Only loaded if
29+
# the necessary gem is installed.
30+
# use `rake changelog to=1.2.0`
31+
begin
32+
v = ENV['to']
33+
require 'github_changelog_generator/task'
34+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
35+
config.future_release = v
4536
end
37+
rescue LoadError
38+
puts '>>>>> GitHub Changelog Generator not loaded, omitting tasks'
4639
end

0 commit comments

Comments
 (0)