Skip to content

Commit

Permalink
Merge pull request #29 from evanthegrayt/task-for-bumping-version
Browse files Browse the repository at this point in the history
Add rake tasks for bumping gem version
  • Loading branch information
evanthegrayt authored Jun 26, 2023
2 parents 163017d + c0c3544 commit 1838d9c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,48 @@ RDoc::Task.new do |rdoc|
end

task default: :test

namespace :version do
desc "Print the current version from the version.rb file"
task :current do
puts Attribool::VERSION
end

namespace :increment do
desc "Increment the version's PATCH level"
task :patch do
File.join(__dir__, "lib", "attribool", "version.rb").then do |version_file|
File.write(
version_file,
File.read(version_file).sub(/(PATCH\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
)
end
system("bundle lock")
end
desc "Increment the version's MINOR level"
task :minor do
File.join(__dir__, "lib", "attribool", "version.rb").then do |version_file|
File.write(
version_file,
File.read(version_file)
.sub(/(PATCH\s=\s)(\d+)/) { "#{$1}0" }
.sub(/(MINOR\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
)
end
system("bundle lock")
end
desc "Increment the version's MAJOR level"
task :major do
File.join(__dir__, "lib", "attribool", "version.rb").then do |version_file|
File.write(
version_file,
File.read(version_file)
.sub(/(PATCH\s=\s)(\d+)/) { "#{$1}0" }
.sub(/(MINOR\s=\s)(\d+)/) { "#{$1}0" }
.sub(/(MAJOR\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
)
end
system("bundle lock")
end
end
end

0 comments on commit 1838d9c

Please sign in to comment.