fix erb for pass argument and paths
This commit is contained in:
		
							parent
							
								
									079b9145c3
								
							
						
					
					
						commit
						72d1427854
					
				|  | @ -20,28 +20,28 @@ namespace :site do | ||||||
|    |    | ||||||
|   task :necessary_data => :environment do |   task :necessary_data => :environment do | ||||||
|     puts "Enter your resque namespace[Orbit]:......" |     puts "Enter your resque namespace[Orbit]:......" | ||||||
|     resque_namespace = gets.chomp |     @resque_namespace = STDIN.gets.gsub("\n",'') | ||||||
|     resque_namespace = APP_CONFIG['orbit'] if resque_namespace.empty? |     @resque_namespace = APP_CONFIG['orbit'] if @resque_namespace.empty? | ||||||
| 
 | 
 | ||||||
|     puts "Is this a primary site?[Default No]:......" |     puts "Is this a primary site?[Default No]:......" | ||||||
|     site_is_primary = False |     site_is_primary = false | ||||||
|     site_is_primary = gets.chomp |     site_is_primary = STDIN.gets.gsub("\n",'') | ||||||
|     site_is_primary = True if site_is_primary.downcase == 'yes' |     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) |     resque_setting = ERB.new(File.new("lib/template/setting/resque.god.erb").read) | ||||||
|     File.open("#{nginx_root}/config/resque.god", 'w') { |file| file.write(resque_setting.result) } |     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) |     resque_schedule_setting = ERB.new(File.new("lib/template/setting/resque_schedule.god.erb").read) | ||||||
|     File.open("#{nginx_root}/config/resque_schedule.god", 'w') { |file| file.write(resque_schedule_setting.result) } |     File.open("config/resque_schedule.god", 'w') { |file| file.write(resque_schedule_setting.result) } | ||||||
| 
 | 
 | ||||||
|     if site_is_primary |     if site_is_primary | ||||||
|         solr_setting = ERB.new(File.new("#{$script_root}/lib/template/setting/solr.god.erb").read) |         solr_setting = ERB.new(File.new("lib/template/setting/solr.god.erb").read) | ||||||
|         File.open("#{nginx_root}/config/solr.god", 'w') { |file| file.write(solr_setting.result) }         |         File.open("config/solr.god", 'w') { |file| file.write(solr_setting.result) }         | ||||||
|     end   |     end   | ||||||
| 
 | 
 | ||||||
|     site = Site.first |     site = Site.first | ||||||
|     site.title = 'RulingOrbit Demo Site' |     site.title = 'RulingOrbit Demo Site' | ||||||
|     site.resque_namespace = resque_namespace  |     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 => '首頁') | ||||||
|  |  | ||||||
|  | @ -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    = "<%= namespace.nil? ? "" : "#{namespace}-" %>resque-worker-#{num}" |     w.name    = "<%= @resque_namespace.nil? ? "" : "#{@resque_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    = "<%= namespace.nil? ? "" : "#{namespace}-" %>resque-scheduler" |     w.name    = "<%= @resque_namespace.nil? ? "" : "#{@resque_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    = "<%= namespace.nil? ? "" : "#{namespace}-" %>sunspot-solr" |     w.name    = "<%= @resque_namespace.nil? ? "" : "#{@resque_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