Update source: pull from git
This commit is contained in:
parent
4f38074932
commit
2842001a3b
|
@ -13,6 +13,8 @@ class Site
|
||||||
field :school
|
field :school
|
||||||
field :department
|
field :department
|
||||||
|
|
||||||
|
field :up_to_date, :type => Boolean
|
||||||
|
|
||||||
def generate_keys
|
def generate_keys
|
||||||
private_key = OpenSSL::PKey::RSA.generate(2048)
|
private_key = OpenSSL::PKey::RSA.generate(2048)
|
||||||
self.public_key = private_key.public_key.to_s
|
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 %>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<% if @site.up_to_date %>
|
||||||
|
<%= t('admin.up_to_date') %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to t(:update), site_update_path %>
|
||||||
|
<% end %>
|
|
@ -1,7 +1,3 @@
|
||||||
<% if @site && @site.registered? %>
|
<%= render 'registration' %>
|
||||||
registered
|
|
||||||
<% else %>
|
<%= render 'update' %>
|
||||||
<%= link_to 'register', "http://#{APP_CONFIG['store_ip']}/user/sites/register?" +
|
|
||||||
{:site => {:school => @site.school, :department => @site.department}}.to_query,
|
|
||||||
:target => '_blank' %>
|
|
||||||
<% end %>
|
|
|
@ -40,6 +40,7 @@ en:
|
||||||
data: Data
|
data: Data
|
||||||
delete_language: Delete language
|
delete_language: Delete language
|
||||||
description: Description
|
description: Description
|
||||||
|
design: Design
|
||||||
disable_language: Disable language
|
disable_language: Disable language
|
||||||
editing_home: Editing homepage
|
editing_home: Editing homepage
|
||||||
editing_layout: Editing layout
|
editing_layout: Editing layout
|
||||||
|
@ -85,11 +86,14 @@ en:
|
||||||
orig_upload_file: Original filename
|
orig_upload_file: Original filename
|
||||||
position: Position
|
position: Position
|
||||||
published?: Published?
|
published?: Published?
|
||||||
|
purchase: Purchase
|
||||||
info: Information
|
info: Information
|
||||||
|
registered: Registered
|
||||||
role: Role
|
role: Role
|
||||||
title: Title
|
title: Title
|
||||||
translation: Translation
|
translation: Translation
|
||||||
type: Type
|
type: Type
|
||||||
|
up_to_date: Up-do-date
|
||||||
update_error_link: Error when updating link.
|
update_error_link: Error when updating link.
|
||||||
update_error_page: Error when updating page.
|
update_error_page: Error when updating page.
|
||||||
update_success_content: Content was successfully updated.
|
update_success_content: Content was successfully updated.
|
||||||
|
|
|
@ -5,6 +5,7 @@ PrototypeR4::Application.routes.draw do
|
||||||
# routes for sinatra app
|
# routes for sinatra app
|
||||||
match '/site/set_registered', :to => CentralServerExchangeApp
|
match '/site/set_registered', :to => CentralServerExchangeApp
|
||||||
match '/site/public_key', :to => CentralServerExchangeApp
|
match '/site/public_key', :to => CentralServerExchangeApp
|
||||||
|
match '/site/update', :to => GithubApp
|
||||||
match '/purchase/design', :to => CentralServerExchangeApp
|
match '/purchase/design', :to => CentralServerExchangeApp
|
||||||
|
|
||||||
# routes for admin
|
# routes for admin
|
||||||
|
|
|
@ -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
|
Reference in New Issue