fix erb for pass argument and paths

This commit is contained in:
Matt K. Fu 2013-06-26 12:58:50 +08:00
parent 079b9145c3
commit 72d1427854
4 changed files with 15 additions and 15 deletions

View File

@ -20,28 +20,28 @@ namespace :site 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?
@resque_namespace = STDIN.gets.gsub("\n",'')
@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'
site_is_primary = false
site_is_primary = STDIN.gets.gsub("\n",'')
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_setting = ERB.new(File.new("lib/template/setting/resque.god.erb").read)
File.open("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) }
resque_schedule_setting = ERB.new(File.new("lib/template/setting/resque_schedule.god.erb").read)
File.open("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) }
solr_setting = ERB.new(File.new("lib/template/setting/solr.god.erb").read)
File.open("config/solr.god", 'w') { |file| file.write(solr_setting.result) }
end
site = Site.first
site.title = 'RulingOrbit Demo Site'
site.resque_namespace = resque_namespace
site.resque_namespace = @resque_namespace
site.save
# home_trans = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')

View File

@ -10,7 +10,7 @@ num_workers.times do |num|
God.watch do |w|
w.dir = rails_root
w.name = "<%= namespace.nil? ? "" : "#{namespace}-" %>resque-worker-#{num}"
w.name = "<%= @resque_namespace.nil? ? "" : "#{@resque_namespace}-" %>resque-worker-#{num}"
w.group = 'rulingcom'
w.interval = 30.seconds

View File

@ -6,7 +6,7 @@ development_gid = ''
God.watch do |w|
w.dir = rails_root
w.name = "<%= namespace.nil? ? "" : "#{namespace}-" %>resque-scheduler"
w.name = "<%= @resque_namespace.nil? ? "" : "#{@resque_namespace}-" %>resque-scheduler"
w.group = 'rulingcom'
w.interval = 30.seconds
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}

View File

@ -6,7 +6,7 @@ development_gid = ''
God.watch do |w|
w.dir = rails_root
w.name = "<%= namespace.nil? ? "" : "#{namespace}-" %>sunspot-solr"
w.name = "<%= @resque_namespace.nil? ? "" : "#{@resque_namespace}-" %>sunspot-solr"
w.group = 'rulingcom'
w.interval = 30.seconds
w.env = {"RAILS_ENV"=>rails_env}