Check if site is up-to-date
This commit is contained in:
		
							parent
							
								
									090b1fdd7f
								
							
						
					
					
						commit
						118455aa81
					
				| 
						 | 
				
			
			@ -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,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 %>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue