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:
Jarek Radosz 2021-11-29 19:09:05 +01:00 committed by GitHub
parent 3dc0b9e077
commit c9e0ad5ec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 27 deletions

View File

@ -657,16 +657,7 @@ module Discourse
end end
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 def self.git_version
ensure_version_file_loaded
$git_version ||= $git_version ||=
begin begin
git_cmd = 'git rev-parse HEAD' git_cmd = 'git rev-parse HEAD'
@ -675,7 +666,6 @@ module Discourse
end end
def self.git_branch def self.git_branch
ensure_version_file_loaded
$git_branch ||= $git_branch ||=
begin begin
git_cmd = 'git rev-parse --abbrev-ref HEAD' git_cmd = 'git rev-parse --abbrev-ref HEAD'
@ -684,7 +674,6 @@ module Discourse
end end
def self.full_version def self.full_version
ensure_version_file_loaded
$full_version ||= $full_version ||=
begin begin
git_cmd = 'git describe --dirty --match "v[0-9]*"' git_cmd = 'git describe --dirty --match "v[0-9]*"'
@ -693,7 +682,6 @@ module Discourse
end end
def self.last_commit_date def self.last_commit_date
ensure_version_file_loaded
$last_commit_date ||= $last_commit_date ||=
begin begin
git_cmd = 'git log -1 --format="%ct"' git_cmd = 'git log -1 --format="%ct"'

View File

@ -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