root / Rakefile @ 14156fb6
Historique | Voir | Annoter | Télécharger (2,18 ko)
1 |
# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper),
|
---|---|
2 |
# otherwise attempt to load it directly.
|
3 |
begin
|
4 |
require 'voxpupuli/test/rake'
|
5 |
rescue LoadError |
6 |
require 'puppetlabs_spec_helper/rake_tasks'
|
7 |
end
|
8 |
|
9 |
# load optional tasks for releases
|
10 |
# only available if gem group releases is installed
|
11 |
begin
|
12 |
require 'voxpupuli/release/rake_tasks'
|
13 |
rescue LoadError |
14 |
end
|
15 |
|
16 |
desc "Run main 'test' task and report merged results to coveralls"
|
17 |
task test_with_coveralls: [:test] do |
18 |
if Dir.exist?(File.expand_path('../lib', __FILE__)) |
19 |
require 'coveralls/rake/task'
|
20 |
Coveralls::RakeTask.new |
21 |
Rake::Task['coveralls:push'].invoke |
22 |
else
|
23 |
puts 'Skipping reporting to coveralls. Module has no lib dir'
|
24 |
end
|
25 |
end
|
26 |
|
27 |
desc 'Generate REFERENCE.md'
|
28 |
task :reference, [:debug, :backtrace] do |t, args| |
29 |
patterns = ''
|
30 |
Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) |
31 |
end
|
32 |
|
33 |
begin
|
34 |
require 'github_changelog_generator/task'
|
35 |
require 'puppet_blacksmith'
|
36 |
GitHubChangelogGenerator::RakeTask.new :changelog do |config| |
37 |
version = (Blacksmith::Modulefile.new).version |
38 |
config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ |
39 |
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."
|
40 |
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
|
41 |
config.user = 'voxpupuli'
|
42 |
metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') |
43 |
metadata = JSON.load(File.read(metadata_json)) |
44 |
config.project = metadata['name']
|
45 |
end
|
46 |
|
47 |
# Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715
|
48 |
require 'rbconfig'
|
49 |
if RbConfig::CONFIG['host_os'] =~ /linux/ |
50 |
task :changelog do |
51 |
puts 'Fixing line endings...'
|
52 |
changelog_file = File.join(__dir__, 'CHANGELOG.md') |
53 |
changelog_txt = File.read(changelog_file)
|
54 |
new_contents = changelog_txt.gsub(%r{\r\n}, "\n") |
55 |
File.open(changelog_file, "w") {|file| file.puts new_contents } |
56 |
end
|
57 |
end
|
58 |
|
59 |
rescue LoadError |
60 |
end
|
61 |
# vim: syntax=ruby
|