Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Use git describe for dashboard version #3228

Merged
merged 1 commit into from Feb 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/templates/version_checks.hbs
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions app/models/discourse_version_check.rb
@@ -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
9 changes: 8 additions & 1 deletion lib/discourse_updates.rb
Expand Up @@ -7,6 +7,7 @@ def check_version
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
Expand All @@ -15,11 +16,17 @@ def check_version
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}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know you can gsub! ;)

end

if SiteSetting.version_checks?

# Handle cases when version check data is old so we report something that makes sense
Expand Down Expand Up @@ -130,4 +137,4 @@ def missing_versions_key_prefix
'missing_version'
end
end
end
end