Skip to content

Instantly share code, notes, and snippets.

View luiszacheu's full-sized avatar

Luís Gustavo Verri Zacheu luiszacheu

View GitHub Profile
@luiszacheu
luiszacheu / version.rake
Created June 22, 2017 13:21 — forked from vcavallo/version.rake
Manage your rails app version with this rake task
def valid? version
pattern = /^\d+\.\d+\.*\d*(\-(dev|beta|rc\d+))?$/
raise "Tried to set invalid version: #{version}".red unless version =~ pattern
end
def correct_version version
ver, flag = version.split '-'
v = ver.split '.'
(0..2).each do |n|
v[n] = v[n].to_i