Update source: pull from git

This commit is contained in:
chris2tof committed 2011-08-23 15:01:22 +08:00
1 parent 4f38074932
commit 2842001a3b
7 files changed
+35 -7

No files matched your search

+2
View File
@@ -13,6 +13,8 @@ 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
@@ -0,0 +1,7 @@
<% if @site && @site.registered? %>
<%= t('admin.registered') %>
<% else %>
<%= link_to 'register', "http://#{APP_CONFIG['store_ip']}/user/sites/register?" +
{:site => {:school => @site.school, :department => @site.department}}.to_query,
:target => '_blank' %>
<% end %>
+5
View File
@@ -0,0 +1,5 @@
<% if @site.up_to_date %>
<%= t('admin.up_to_date') %>
<% else %>
<%= link_to t(:update), site_update_path %>
<% end %>
+3 -7
View File
@@ -1,7 +1,3 @@
<% if @site && @site.registered? %>
registered
<% else %>
<%= link_to 'register', "http://#{APP_CONFIG['store_ip']}/user/sites/register?" +
{:site => {:school => @site.school, :department => @site.department}}.to_query,
:target => '_blank' %>
<% end %>
<%= render 'registration' %>
<%= render 'update' %>
+4
View File
@@ -40,6 +40,7 @@ en:
data: Data
delete_language: Delete language
description: Description
design: Design
disable_language: Disable language
editing_home: Editing homepage
editing_layout: Editing layout
@@ -85,11 +86,14 @@ en:
orig_upload_file: Original filename
position: Position
published?: Published?
purchase: Purchase
info: Information
registered: Registered
role: Role
title: Title
translation: Translation
type: Type
up_to_date: Up-do-date
update_error_link: Error when updating link.
update_error_page: Error when updating page.
update_success_content: Content was successfully updated.
+1
View File
@@ -5,6 +5,7 @@ PrototypeR4::Application.routes.draw do
# routes for sinatra app
match '/site/set_registered', :to => CentralServerExchangeApp
match '/site/public_key', :to => CentralServerExchangeApp
match '/site/update', :to => GithubApp
match '/purchase/design', :to => CentralServerExchangeApp
# routes for admin
+13
View File
@@ -0,0 +1,13 @@
class GithubApp < Sinatra::Base
before do
@site = Site.first
end
get '/site/update' do
updated = system('git pull')
@site.update_attribute(:up_to_date, true) if updated
redirect "admin/sites?updated=#{updated}"
end
end