Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / Rakefile @ 14156fb6

Historique | Voir | Annoter | Télécharger (2,18 ko)

1 78f22811 Steve Traylen
# 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 186a64ca tr
end
8
9 78f22811 Steve Traylen
# 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 ece9be27 tr
16 78f22811 Steve Traylen
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 ece9be27 tr
  end
25 186a64ca tr
end
26
27 78f22811 Steve Traylen
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 186a64ca tr
end
32
33 78f22811 Steve Traylen
begin
34
  require 'github_changelog_generator/task'
35
  require 'puppet_blacksmith'
36 186a64ca tr
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
37 78f22811 Steve Traylen
    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 186a64ca tr
  end
46 78f22811 Steve Traylen
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 186a64ca tr
  end
58 ece9be27 tr
59 78f22811 Steve Traylen
rescue LoadError
60
end
61
# vim: syntax=ruby