make rake task more easier for service team

This commit is contained in:
Matt K. Fu 2013-07-04 12:13:05 +08:00
parent a88ad35641
commit 030d994180
1 changed files with 43 additions and 36 deletions

View File

@ -23,6 +23,30 @@ namespace :site do
end
task :necessary_data => :environment do
auto_setting
site = Site.first
site.title = 'RulingOrbit Demo Site'
site.resque_namespace = @resque_namespace
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
design = Design.first
site = Site.first
site.design = design
site.save
theme = design.themes.first
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id )
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
home.save
puts "Rember to restart server after you setup all sites for starting God"
end
task :start_auto_setting => :environment do
auto_setting
end
def auto_setting
puts "Enter your resque namespace[Orbit]:......"
@resque_namespace = STDIN.gets.gsub("\n",'')
@resque_namespace = APP_CONFIG['orbit'] if @resque_namespace.empty?
@ -50,26 +74,11 @@ namespace :site do
File.open("config/solr.god", 'w') { |file| file.write(solr_setting.result) }
create_rulingcom_logrotate
end
end
site = Site.first
site.title = 'RulingOrbit Demo Site'
site.resque_namespace = @resque_namespace
site.save
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
design = Design.first
site = Site.first
site.design = design
site.save
theme = design.themes.first
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id )
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
home.save
puts "Rember to restart server after you setup all sites for starting God"
def create_rulingcom_logrotate
def create_rulingcom_logrotate
`sudo mkdir -p /var/log/rulingcom` unless File.directory? "/var/log/rulingcom"
@project_folder = ENV["PWD"]
puts "Is your Orbit folder: #{@project_folder} (If YES => Press enter,or enter your path)"
user_enter_project_folder = STDIN.gets.gsub("\n",'')
@ -84,8 +93,6 @@ namespace :site do
File.open("#{@project_loc}/tmp/logrotate_setting", 'w') { |file| file.write(logrotate_setting.result) }
`sudo cp #{@project_loc}/tmp/logrotate_setting /etc/logrotate.d/rulingcom`
end
end
end
end