diff --git a/app/models/site.rb b/app/models/site.rb index 77571470..8cc32eee 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -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 diff --git a/app/views/admin/sites/_update.html.erb b/app/views/admin/sites/_update.html.erb index 09bb04f3..c96072ca 100644 --- a/app/views/admin/sites/_update.html.erb +++ b/app/views/admin/sites/_update.html.erb @@ -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 %>