2013-02-05 14:16:51 -05:00
|
|
|
desc "generate multisite config file (if missing)"
|
|
|
|
task "multisite:generate:config" => :environment do
|
|
|
|
filename = RailsMultisite::ConnectionManagement.config_filename
|
|
|
|
|
|
|
|
if File.exists?(filename)
|
|
|
|
puts "Config is already generated at #{RailsMultisite::ConnectionManagement::CONFIG_FILE}"
|
2013-02-25 11:42:20 -05:00
|
|
|
else
|
2013-02-05 14:16:51 -05:00
|
|
|
puts "Generated config file at #{RailsMultisite::ConnectionManagement::CONFIG_FILE}"
|
2013-02-25 11:42:20 -05:00
|
|
|
File.open(filename, 'w') do |f|
|
2013-02-05 14:16:51 -05:00
|
|
|
f.write <<-CONFIG
|
2013-02-25 11:42:20 -05:00
|
|
|
# site_name:
|
2013-02-05 14:16:51 -05:00
|
|
|
# adapter: postgresql
|
|
|
|
# database: db_name
|
|
|
|
# host: localhost
|
|
|
|
# pool: 5
|
|
|
|
# timeout: 5000
|
2013-02-25 11:42:20 -05:00
|
|
|
# db_id: 1 # optionally include other settings you need
|
2013-02-05 14:16:51 -05:00
|
|
|
# host_names:
|
|
|
|
# - www.mysite.com
|
|
|
|
# - www.anothersite.com
|
|
|
|
CONFIG
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|