FEATURE: Use git describe for dashboard version

This commit is contained in:
riking 2015-02-23 15:57:54 -08:00
parent 34dc1f9e10
commit f1b606bf08
3 changed files with 11 additions and 4 deletions

View File

@ -14,7 +14,7 @@
{{#unless loading}}
<tbody>
<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}}
<td class="version-number">&nbsp;</td>

View File

@ -1,5 +1,5 @@
class DiscourseVersionCheck
include ActiveModel::Model
attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :missing_versions_count, :updated_at, :version_check_pending
end
attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :installed_describe, :missing_versions_count, :updated_at, :version_check_pending
end

View File

@ -7,6 +7,7 @@ module DiscourseUpdates
DiscourseVersionCheck.new(
installed_version: Discourse::VERSION::STRING,
installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version),
installed_describe: `git describe --dirty`,
updated_at: nil
)
else
@ -15,11 +16,17 @@ module DiscourseUpdates
critical_updates: critical_updates_available?,
installed_version: Discourse::VERSION::STRING,
installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version),
installed_describe: `git describe --dirty`,
missing_versions_count: missing_versions_count,
updated_at: updated_at
)
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?
# Handle cases when version check data is old so we report something that makes sense
@ -130,4 +137,4 @@ module DiscourseUpdates
'missing_version'
end
end
end
end