-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
52 lines (41 loc) · 1.29 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task default: :spec
desc "bump version and generate CHANGELOG with the version"
task :bump, :type do |_, args|
require "bump"
label = args[:type]
unless %w[major minor patch pre no].include?(label)
raise "Usage: rake bump[LABEL] (LABEL: ['major', 'minor', 'patch', 'pre', 'no'])"
end
next_version = if label == "no"
Bump::Bump.current
else
Bump::Bump.next_version(label)
end
require "github_changelog_generator/task"
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
gemspec_path = Dir.glob(File.join(File.dirname(File.expand_path(__FILE__)), "*.gemspec")).first
gemspec = Gem::Specification.load(gemspec_path)
config.user = gemspec.authors.first
config.project = gemspec.name
config.future_release = "v#{next_version}"
end
Rake::Task[:changelog].execute
puts "update CHANGELOG"
`git add CHANGELOG.md`
if label == "no"
puts "No bump version"
`git commit -m "update CHANGELOG"`
else
puts "Bump version to #{label}"
Bump::Bump.run(label)
end
puts 'Next step: "bundle exec rake release_tag"'
end
desc "Create and Push tag"
task :release_tag do
require "bundler/gem_tasks"
Rake::Task["release:source_control_push"].invoke
end