mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 06:06:29 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
16 lines
616 B
Ruby
16 lines
616 B
Ruby
# frozen_string_literal: true
|
|
|
|
desc "stamp the current build with the git hash placed in version.rb"
|
|
task "build:stamp" => :environment do
|
|
git_version = `git rev-parse HEAD`.strip
|
|
git_branch = `git rev-parse --abbrev-ref HEAD`
|
|
full_version = `git describe --dirty --match "v[0-9]*"`
|
|
|
|
File.open(Rails.root.to_s + '/config/version.rb', 'w') do |f|
|
|
f.write("$git_version = #{git_version.inspect}\n")
|
|
f.write("$git_branch = #{git_branch.inspect}\n")
|
|
f.write("$full_version = #{full_version.inspect}\n")
|
|
end
|
|
puts "Stamped current build with #{git_version} #{git_branch} #{full_version}"
|
|
end
|