2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-18 00:34:43 -06:00
|
|
|
desc "stamp the current build with the git hash placed in version.rb"
|
2013-02-25 10:42:20 -06:00
|
|
|
task "build:stamp" => :environment do
|
2017-08-28 11:24:56 -05:00
|
|
|
git_version = `git rev-parse HEAD`.strip
|
|
|
|
git_branch = `git rev-parse --abbrev-ref HEAD`
|
|
|
|
full_version = `git describe --dirty --match "v[0-9]*"`
|
|
|
|
|
2013-02-18 00:34:43 -06:00
|
|
|
File.open(Rails.root.to_s + '/config/version.rb', 'w') do |f|
|
2017-08-28 11:24:56 -05:00
|
|
|
f.write("$git_version = #{git_version.inspect}\n")
|
|
|
|
f.write("$git_branch = #{git_branch.inspect}\n")
|
|
|
|
f.write("$full_version = #{full_version.inspect}\n")
|
2013-02-18 00:34:43 -06:00
|
|
|
end
|
2017-08-28 11:24:56 -05:00
|
|
|
puts "Stamped current build with #{git_version} #{git_branch} #{full_version}"
|
2013-02-18 00:34:43 -06:00
|
|
|
end
|