-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
28 lines (20 loc) · 845 Bytes
/
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
# frozen_string_literal: true
require "colorize"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "versionomy"
RSpec::Core::RakeTask.new(:spec)
task default: :spec
desc "Bump gem version number (tiny|minor|major)"
task :bump, :type do |_t, args|
args.with_defaults(type: :tiny)
version_file = File.join(__dir__, "lib", "pdfh", "version.rb")
content = File.read(version_file)
version_pattern = /(?<major>\d+)\.(?<minor>\d+)\.(?<tiny>\d+)/
current_version = content.match(version_pattern)
next_version = Versionomy.parse(current_version.to_s).bump(args.type).to_s
File.write(version_file, content.gsub(version_pattern, "\\1#{next_version}\\3"))
puts "Successfully bumped from #{current_version.to_s.red} to #{next_version.green}"
puts "\n> Building v#{next_version.green}..."
puts `rake build`
end