279580ac6529df660df7bde66b45e9e9250f6da9
[mirror/dsa-puppet.git] / 3rdparty / modules / rabbitmq / Rakefile
1 require 'puppetlabs_spec_helper/rake_tasks'
2
3 # load optional tasks for releases
4 # only available if gem group releases is installed
5 begin
6   require 'puppet_blacksmith/rake_tasks'
7   require 'voxpupuli/release/rake_tasks'
8   require 'puppet-strings/tasks'
9 rescue LoadError
10 end
11
12 PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
13 PuppetLint.configuration.fail_on_warnings = true
14 PuppetLint.configuration.send('relative')
15 PuppetLint.configuration.send('disable_140chars')
16 PuppetLint.configuration.send('disable_class_inherits_from_params_class')
17 PuppetLint.configuration.send('disable_documentation')
18 PuppetLint.configuration.send('disable_single_quote_string_with_variables')
19
20 exclude_paths = %w(
21   pkg/**/*
22   vendor/**/*
23   .vendor/**/*
24   spec/**/*
25 )
26 PuppetLint.configuration.ignore_paths = exclude_paths
27 PuppetSyntax.exclude_paths = exclude_paths
28
29 desc 'Auto-correct puppet-lint offenses'
30 task 'lint:auto_correct' do
31   PuppetLint.configuration.fix = true
32   Rake::Task[:lint].invoke
33 end
34
35 desc 'Run acceptance tests'
36 RSpec::Core::RakeTask.new(:acceptance) do |t|
37   t.pattern = 'spec/acceptance'
38 end
39
40 desc 'Run tests metadata_lint, release_checks'
41 task test: [
42   :metadata_lint,
43   :release_checks,
44 ]
45
46 desc "Run main 'test' task and report merged results to coveralls"
47 task test_with_coveralls: [:test] do
48   if Dir.exist?(File.expand_path('../lib', __FILE__))
49     require 'coveralls/rake/task'
50     Coveralls::RakeTask.new
51     Rake::Task['coveralls:push'].invoke
52   else
53     puts 'Skipping reporting to coveralls.  Module has no lib dir'
54   end
55 end
56
57 desc "Print supported beaker sets"
58 task 'beaker_sets', [:directory] do |t, args|
59   directory = args[:directory]
60
61   metadata = JSON.load(File.read('metadata.json'))
62
63   (metadata['operatingsystem_support'] || []).each do |os|
64     (os['operatingsystemrelease'] || []).each do |release|
65       if directory
66         beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}"
67       else
68         beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64"
69       end
70
71       filename = "spec/acceptance/nodesets/#{beaker_set}.yml"
72
73       puts beaker_set if File.exists? filename
74     end
75   end
76 end
77
78 begin
79   require 'github_changelog_generator/task'
80   GitHubChangelogGenerator::RakeTask.new :changelog do |config|
81     version = (Blacksmith::Modulefile.new).version
82     config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/
83     config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module."
84     config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
85     config.user = 'voxpupuli'
86     metadata_json = File.join(File.dirname(__FILE__), 'metadata.json')
87     metadata = JSON.load(File.read(metadata_json))
88     config.project = metadata['name']
89   end
90 rescue LoadError
91 end
92 # vim: syntax=ruby