Check if site is up-to-date

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

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

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 %>