mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:43:54 -06:00
Merge pull request #3228 from riking/describe
FEATURE: Use `git describe` for dashboard version
This commit is contained in:
commit
34af7f20af
@ -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
|
||||||
@ -130,4 +137,4 @@ module DiscourseUpdates
|
|||||||
'missing_version'
|
'missing_version'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user