fixing setting template and site init scripts

This commit is contained in:
Matt K. Fu committed 2013-08-27 17:28:33 +08:00
1 parent aa8523c8cf
commit d8dd68b4df
4 files changed
+39 -20

No files matched your search

+20 -5
View File
@@ -51,18 +51,33 @@ namespace :site do
@resque_namespace = STDIN.gets.gsub("\n",'')
@resque_namespace = APP_CONFIG['orbit'] if @resque_namespace.empty?
puts "Is this the only site [ Entry site? ] on this mechine?[Default No]:......"
site_is_alone = false
site_is_alone = STDIN.gets.gsub("\n",'')
site_is_alone = true if site_is_alone.downcase == 'yes'
puts "Is this a primary site?[Default No]:......"
site_is_primary = false
site_is_primary = STDIN.gets.gsub("\n",'')
site_is_primary = true if site_is_primary.downcase == 'yes'
puts "Is this the only site on this mechine?[Default No]:......"
site_is_alone = false
site_is_alone = STDIN.gets.gsub("\n",'')
site_is_alone = true if site_is_alone.downcase == 'yes'
puts "Traffic heavy?[Default No]:......"
traffic_heavy = false
traffic_heavy = STDIN.gets.gsub("\n",'')
traffic_heavy = true if site_is_primary.downcase == 'yes'
@resque_workers = site_is_alone ? 5 : 2
@traffic_rate = traffic_heavy ? 2 : 1
if site_is_alone
@resque_workers = 5 * traffic_rate #Entry Site
else
if site_is_primary
@resque_workers = 2 * traffic_rate #Primary Site
else
@resque_workers = 1 * traffic_rate #Secondary Site
end
end
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) }