make rake task more easier for service team
This commit is contained in:
parent
a88ad35641
commit
030d994180
|
@ -23,6 +23,30 @@ namespace :site do
|
||||||
end
|
end
|
||||||
|
|
||||||
task :necessary_data => :environment do
|
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]:......"
|
puts "Enter your resque namespace[Orbit]:......"
|
||||||
@resque_namespace = STDIN.gets.gsub("\n",'')
|
@resque_namespace = STDIN.gets.gsub("\n",'')
|
||||||
@resque_namespace = APP_CONFIG['orbit'] if @resque_namespace.empty?
|
@resque_namespace = APP_CONFIG['orbit'] if @resque_namespace.empty?
|
||||||
|
@ -50,42 +74,25 @@ namespace :site do
|
||||||
File.open("config/solr.god", 'w') { |file| file.write(solr_setting.result) }
|
File.open("config/solr.god", 'w') { |file| file.write(solr_setting.result) }
|
||||||
create_rulingcom_logrotate
|
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
|
|
||||||
@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",'')
|
|
||||||
@project_folder = user_enter_project_folder unless user_enter_project_folder.empty?
|
|
||||||
|
|
||||||
@user_home_folder = ENV["HOME"]
|
|
||||||
puts "Is your Home folder: #{@user_home_folder} (If YES => Press enter,or enter your path)"
|
|
||||||
user_enter_home_folder = STDIN.gets.gsub("\n",'')
|
|
||||||
@user_home_folder = user_enter_home_folder unless user_enter_home_folder.empty?
|
|
||||||
|
|
||||||
logrotate_setting = ERB.new(File.new("lib/template/setting/rulingcom_log.erb").read)
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
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",'')
|
||||||
|
@project_folder = user_enter_project_folder unless user_enter_project_folder.empty?
|
||||||
|
|
||||||
|
@user_home_folder = ENV["HOME"]
|
||||||
|
puts "Is your Home folder: #{@user_home_folder} (If YES => Press enter,or enter your path)"
|
||||||
|
user_enter_home_folder = STDIN.gets.gsub("\n",'')
|
||||||
|
@user_home_folder = user_enter_home_folder unless user_enter_home_folder.empty?
|
||||||
|
|
||||||
|
logrotate_setting = ERB.new(File.new("lib/template/setting/rulingcom_log.erb").read)
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue