| 1 |
# frozen_string_literal: true |
| 2 |
|
| 3 |
require 'cucumber/rake/task' |
| 4 |
require 'rspec/core/rake_task' |
| 5 |
require 'bundler/gem_tasks' |
| 6 |
require 'rake/testtask' |
| 7 |
require 'rake/clean' |
| 8 |
|
| 9 |
CLEAN.include('pkg/', 'tmp/') |
| 10 |
CLOBBER.include('Gemfile.lock') |
| 11 |
|
| 12 |
RSpec::Core::RakeTask.new |
| 13 |
Cucumber::Rake::Task.new(:features) |
| 14 |
|
| 15 |
Rake::TestTask.new do |test| |
| 16 |
test.pattern = 'test/**/*_test.rb' |
| 17 |
test.verbose = true |
| 18 |
end |
| 19 |
|
| 20 |
task default: %i[test spec features] |
| 21 |
|
| 22 |
desc 'Bump version to the next minor' |
| 23 |
task :bump do |
| 24 |
path = 'lib/librarian/puppet/version.rb' |
| 25 |
version_file = File.read(path) |
| 26 |
version = version_file.match(/VERSION = "(.*)"/)[1] |
| 27 |
v = Gem::Version.new("#{version}.0") |
| 28 |
new_version = v.bump.to_s |
| 29 |
version_file = version_file.gsub(/VERSION = ".*"/, "VERSION = \"#{new_version}\"") |
| 30 |
File.write(version_file) |
| 31 |
sh "git add #{path}" |
| 32 |
sh "git commit -m \"Bump version to #{new_version}\"" |
| 33 |
end |
| 34 |
|
| 35 |
begin |
| 36 |
require 'rubygems' |
| 37 |
require 'github_changelog_generator/task' |
| 38 |
rescue LoadError |
| 39 |
# Part of an optional group |
| 40 |
else |
| 41 |
GitHubChangelogGenerator::RakeTask.new :changelog do |config| |
| 42 |
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog github_actions] |
| 43 |
config.user = 'voxpupuli' |
| 44 |
config.project = 'librarian-puppet' |
| 45 |
config.since_tag = 'v3.0.1' |
| 46 |
gem_version = Gem::Specification.load("#{config.project}.gemspec").version |
| 47 |
config.future_release = "v#{gem_version}" |
| 48 |
end |
| 49 |
end |
| 50 |
|
| 51 |
begin |
| 52 |
require 'voxpupuli/rubocop/rake' |
| 53 |
rescue LoadError |
| 54 |
# the voxpupuli-rubocop gem is optional |
| 55 |
end |