DEV: Remove build:stamp task and related code (#15069)
I don't think we use `build:stamp` task anymore, nor we rely on config/version.rb
This commit is contained in:
parent
3dc0b9e077
commit
c9e0ad5ec4
|
@ -657,16 +657,7 @@ module Discourse
|
|||
end
|
||||
end
|
||||
|
||||
def self.ensure_version_file_loaded
|
||||
unless @version_file_loaded
|
||||
version_file = "#{Rails.root}/config/version.rb"
|
||||
require version_file if File.exists?(version_file)
|
||||
@version_file_loaded = true
|
||||
end
|
||||
end
|
||||
|
||||
def self.git_version
|
||||
ensure_version_file_loaded
|
||||
$git_version ||=
|
||||
begin
|
||||
git_cmd = 'git rev-parse HEAD'
|
||||
|
@ -675,7 +666,6 @@ module Discourse
|
|||
end
|
||||
|
||||
def self.git_branch
|
||||
ensure_version_file_loaded
|
||||
$git_branch ||=
|
||||
begin
|
||||
git_cmd = 'git rev-parse --abbrev-ref HEAD'
|
||||
|
@ -684,7 +674,6 @@ module Discourse
|
|||
end
|
||||
|
||||
def self.full_version
|
||||
ensure_version_file_loaded
|
||||
$full_version ||=
|
||||
begin
|
||||
git_cmd = 'git describe --dirty --match "v[0-9]*"'
|
||||
|
@ -693,7 +682,6 @@ module Discourse
|
|||
end
|
||||
|
||||
def self.last_commit_date
|
||||
ensure_version_file_loaded
|
||||
$last_commit_date ||=
|
||||
begin
|
||||
git_cmd = 'git log -1 --format="%ct"'
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
# 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
|
Loading…
Reference in New Issue