Skip to content

Commit

Permalink
Add task for incrementing version to arbitrary values.
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-stewart committed Jan 17, 2017
1 parent 625cc8a commit 1ff22e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.1.0
13 changes: 13 additions & 0 deletions lib/rake/version_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ def define
version = (ENV['VERSION'] || '0.0.0').to_version
puts write(version)
end

desc 'Sets the given components of the version, only if they are greater than the current version'
task(:set, [:version] => filename) do |t, args|
version = read
new = args[:version].to_version

abort if (version <=> new) > 0

new.to_a.each_with_index do |component, index|
version[index] = component
end
puts write(version)
end

desc "Bump to #{read.bump!}"
task(:bump => filename) { puts write(read.bump!) }
Expand Down

0 comments on commit 1ff22e7

Please sign in to comment.