Check if site is up-to-date

This commit is contained in:
chris2tof committed 2011-08-23 19:40:49 +08:00
1 parent 090b1fdd7f
commit 118455aa81
2 files changed
+7 -3

No files matched your search

+6 -2
View File
@@ -13,8 +13,6 @@ class Site
field :school
field :department
field :up_to_date, :type => Boolean
def generate_keys
private_key = OpenSSL::PKey::RSA.generate(2048)
self.public_key = private_key.public_key.to_s
@@ -25,4 +23,10 @@ class Site
!self.roaming_id.blank?
end
def up_to_date?
p res = %x(git remote show origin)
res = res.split('rails_3_1 (')[1].gsub!(')','').strip rescue nil
res.eql?('local out of date') ? false : true
end
end
+1 -1
View File
@@ -1,4 +1,4 @@
<% if @site.up_to_date %>
<% if @site.up_to_date? %>
<%= t('admin.up_to_date') %>
<% else %>
<%= link_to t(:update), site_update_path %>