Skip to content

Commit 24514f5

Browse files
committed
Canvas.revision
and display the revision on /plugins test plan: without a VERSION file, visit /plugins and see the "Unknown" displayed. With a VERSION file, visit /plugins and see the first line of that file displayed. Change-Id: I0bcb3c855c70ba444158e17302eadab317dffb02 Reviewed-on: https://gerrit.instructure.com/9197 Reviewed-by: Brian Palmer <brianp@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Hudson <hudson@instructure.com>
1 parent af95878 commit 24514f5

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

app/views/plugins/index.html.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
jammit_css 'plugins'
66
%>
77

8+
<h2><%= t :instructure_canvas, "Instructure Canvas" %></h2>
9+
10+
<p>
11+
Revision: <%= Canvas.revision || t(:canvas_revision_unknown, "Unknown") %>
12+
</p>
13+
814
<h2><%= t :page_title, "Canvas Plugins" %></h2>
915

1016
<% if @plugins.any? %>

lib/canvas.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,12 @@ def self.reloadable_plugin(dirname)
126126
p[0, base_path.length] == base_path
127127
}
128128
end
129+
130+
def self.revision
131+
return @revision unless @revision.nil?
132+
if File.file?(Rails.root+"VERSION")
133+
@revision = File.readlines(Rails.root+"VERSION").first.try(:strip)
134+
end
135+
@revision ||= false
136+
end
129137
end

0 commit comments

Comments
 (0)