Created
November 1, 2017 02:02
-
-
Save unRob/3a14b304e078f9443dfd351d49354428 to your computer and use it in GitHub Desktop.
♥ << ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# git tag -l => 0.0.0 | |
# version.rb patch => 0.0.1 | |
# version.rb minor => 0.1.0 | |
# version.rb major => 1.0.0 | |
increments = [:major, :minor, :patch] | |
increment = ARGV[0].to_sym | |
raise ArgumentError.new(increments.join(' ')) unless increments.include? increment | |
components = %x{git describe --abbrev=0}.split(".").map(&:to_i) | |
components[ increments.index increment ] += 1 | |
puts components.join('.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment