mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 07:43:43 +08:00
FEATURE: Use git describe
for dashboard version
This commit is contained in:
parent
34dc1f9e10
commit
f1b606bf08
|
@ -14,7 +14,7 @@
|
||||||
{{#unless loading}}
|
{{#unless loading}}
|
||||||
<tbody>
|
<tbody>
|
||||||
<td class="title">{{i18n 'admin.dashboard.version'}}</td>
|
<td class="title">{{i18n 'admin.dashboard.version'}}</td>
|
||||||
<td class="version-number"><a {{bind-attr href="versionCheck.gitLink"}} target="_blank">{{ versionCheck.installed_version }}</a></td>
|
<td class="version-number"><a {{bind-attr href="versionCheck.gitLink"}} target="_blank">{{ versionCheck.installed_describe }}</a></td>
|
||||||
|
|
||||||
{{#if versionCheck.noCheckPerformed}}
|
{{#if versionCheck.noCheckPerformed}}
|
||||||
<td class="version-number"> </td>
|
<td class="version-number"> </td>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DiscourseVersionCheck
|
class DiscourseVersionCheck
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :missing_versions_count, :updated_at, :version_check_pending
|
attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :installed_describe, :missing_versions_count, :updated_at, :version_check_pending
|
||||||
end
|
end
|
|
@ -7,6 +7,7 @@ module DiscourseUpdates
|
||||||
DiscourseVersionCheck.new(
|
DiscourseVersionCheck.new(
|
||||||
installed_version: Discourse::VERSION::STRING,
|
installed_version: Discourse::VERSION::STRING,
|
||||||
installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version),
|
installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version),
|
||||||
|
installed_describe: `git describe --dirty`,
|
||||||
updated_at: nil
|
updated_at: nil
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
@ -15,11 +16,17 @@ module DiscourseUpdates
|
||||||
critical_updates: critical_updates_available?,
|
critical_updates: critical_updates_available?,
|
||||||
installed_version: Discourse::VERSION::STRING,
|
installed_version: Discourse::VERSION::STRING,
|
||||||
installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version),
|
installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version),
|
||||||
|
installed_describe: `git describe --dirty`,
|
||||||
missing_versions_count: missing_versions_count,
|
missing_versions_count: missing_versions_count,
|
||||||
updated_at: updated_at
|
updated_at: updated_at
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# replace -commit_count with +commit_count
|
||||||
|
if version_info.installed_describe =~ /-(\d+)-/
|
||||||
|
version_info.installed_describe = version_info.installed_describe.gsub(/-(\d+)-.*/, " +#{$1}")
|
||||||
|
end
|
||||||
|
|
||||||
if SiteSetting.version_checks?
|
if SiteSetting.version_checks?
|
||||||
|
|
||||||
# Handle cases when version check data is old so we report something that makes sense
|
# Handle cases when version check data is old so we report something that makes sense
|
||||||
|
|
Loading…
Reference in New Issue
Block a user