move all *.god to *.erb so the God init won't go wrong
This commit is contained in:
parent
3102a46219
commit
079b9145c3
|
@ -1,4 +1,5 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
require 'erb'
|
||||||
|
|
||||||
namespace :site do
|
namespace :site do
|
||||||
|
|
||||||
|
@ -9,16 +10,38 @@ namespace :site do
|
||||||
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
Site.create( :school => 'RulingDigital University', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
||||||
User.create!(:email=>'chris@rulingcom.com',:admin=>true,:user_id=>'chris',:password=>'password')
|
User.create!(:email=>'chris@rulingcom.com',:admin=>true,:user_id=>'chris',:password=>'password')
|
||||||
`mongo #{Mongoid.config.database.name} --eval "db.fs.chunks.ensureIndex({files_id: 1, n: 1})"`
|
`mongo #{Mongoid.config.database.name} --eval "db.fs.chunks.ensureIndex({files_id: 1, n: 1})"`
|
||||||
|
|
||||||
puts "Congres you can now login within url"
|
puts "Congres you can now login within url"
|
||||||
puts 'Please upload design package (/admin/designs/upload_package ) and run rake site:necessary_data'
|
puts 'Please upload design package (/admin/designs/upload_package ) and run rake site:necessary_data'
|
||||||
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
|
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
|
||||||
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
|
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
|
||||||
Info.create!(key: "profile", built_in: true, disabled: false, title: {"zh_tw"=>"基本欄位", "en"=>"Basic Info"}, to_search: false)
|
Info.create!(key: "profile", built_in: true, disabled: false, title: {"zh_tw"=>"基本欄位", "en"=>"Basic Info"}, to_search: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
task :necessary_data => :environment do
|
task :necessary_data => :environment do
|
||||||
|
puts "Enter your resque namespace[Orbit]:......"
|
||||||
|
resque_namespace = gets.chomp
|
||||||
|
resque_namespace = APP_CONFIG['orbit'] if resque_namespace.empty?
|
||||||
|
|
||||||
|
puts "Is this a primary site?[Default No]:......"
|
||||||
|
site_is_primary = False
|
||||||
|
site_is_primary = gets.chomp
|
||||||
|
site_is_primary = True if site_is_primary.downcase == 'yes'
|
||||||
|
|
||||||
|
resque_setting = ERB.new(File.new("#{$script_root}/lib/template/setting/resque.god.erb").read)
|
||||||
|
File.open("#{nginx_root}/config/resque.god", 'w') { |file| file.write(resque_setting.result) }
|
||||||
|
|
||||||
|
resque_schedule_setting = ERB.new(File.new("#{$script_root}/lib/template/setting/resque_schedule.god.erb").read)
|
||||||
|
File.open("#{nginx_root}/config/resque_schedule.god", 'w') { |file| file.write(resque_schedule_setting.result) }
|
||||||
|
|
||||||
|
if site_is_primary
|
||||||
|
solr_setting = ERB.new(File.new("#{$script_root}/lib/template/setting/solr.god.erb").read)
|
||||||
|
File.open("#{nginx_root}/config/solr.god", 'w') { |file| file.write(solr_setting.result) }
|
||||||
|
end
|
||||||
|
|
||||||
site = Site.first
|
site = Site.first
|
||||||
site.title = 'RulingOrbit Demo Site'
|
site.title = 'RulingOrbit Demo Site'
|
||||||
|
site.resque_namespace = resque_namespace
|
||||||
site.save
|
site.save
|
||||||
|
|
||||||
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
||||||
|
@ -31,6 +54,8 @@ namespace :site do
|
||||||
|
|
||||||
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
||||||
home.save
|
home.save
|
||||||
|
|
||||||
|
puts "Rember to restart server after you setup all sites for starting God"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ num_workers.times do |num|
|
||||||
God.watch do |w|
|
God.watch do |w|
|
||||||
|
|
||||||
w.dir = rails_root
|
w.dir = rails_root
|
||||||
w.name = "resque-worker-#{num}"
|
w.name = "<%= namespace.nil? ? "" : "#{namespace}-" %>resque-worker-#{num}"
|
||||||
w.group = 'rulingcom'
|
w.group = 'rulingcom'
|
||||||
|
|
||||||
w.interval = 30.seconds
|
w.interval = 30.seconds
|
|
@ -6,7 +6,7 @@ development_gid = ''
|
||||||
|
|
||||||
God.watch do |w|
|
God.watch do |w|
|
||||||
w.dir = rails_root
|
w.dir = rails_root
|
||||||
w.name = "resque-scheduler"
|
w.name = "<%= namespace.nil? ? "" : "#{namespace}-" %>resque-scheduler"
|
||||||
w.group = 'rulingcom'
|
w.group = 'rulingcom'
|
||||||
w.interval = 30.seconds
|
w.interval = 30.seconds
|
||||||
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
|
|
@ -6,7 +6,7 @@ development_gid = ''
|
||||||
|
|
||||||
God.watch do |w|
|
God.watch do |w|
|
||||||
w.dir = rails_root
|
w.dir = rails_root
|
||||||
w.name = "sunspot-solr"
|
w.name = "<%= namespace.nil? ? "" : "#{namespace}-" %>sunspot-solr"
|
||||||
w.group = 'rulingcom'
|
w.group = 'rulingcom'
|
||||||
w.interval = 30.seconds
|
w.interval = 30.seconds
|
||||||
w.env = {"RAILS_ENV"=>rails_env}
|
w.env = {"RAILS_ENV"=>rails_env}
|
Loading…
Reference in New Issue