Skip to content

Instantly share code, notes, and snippets.

Avatar

luiszacheu

  • Santander Tecnologia
  • São Paulo, Brazil
View GitHub Profile
@luiszacheu
luiszacheu / version.rake
Created Jun 22, 2017 — forked from vcavallo/version.rake
Manage your rails app version with this rake task
View version.rake
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