apache-config-generator/lib/apache/rake/create.rb

27 lines
752 B
Ruby
Raw Normal View History

2010-05-05 14:44:20 +00:00
require 'fileutils'
require 'apache/config'
require 'apache/rake/create'
require 'yaml'
namespace :apache do
desc "Create all defined configs for the specified environment"
task :create, :environment do |t, args|
APACHE_ENV = (args[:environment] || 'production').to_sym
2010-05-06 14:40:45 +00:00
CONFIG = Hash[YAML.load_file('config.yml').collect { |k,v| [ k.to_sym, v ] }]
2010-05-05 14:44:20 +00:00
2010-05-06 14:40:45 +00:00
CONFIG[:source_path] = File.expand_path(CONFIG[:source])
CONFIG[:dest_path] = File.expand_path(CONFIG[:destination])
2010-05-05 14:44:20 +00:00
2010-05-06 14:40:45 +00:00
Apache::Config.rotate_logs_path = CONFIG[:rotate_logs_path]
2010-05-05 16:25:07 +00:00
2010-05-06 14:40:45 +00:00
FileUtils.mkdir_p CONFIG[:dest_path]
Dir.chdir CONFIG[:dest_path]
2010-05-05 14:44:20 +00:00
2010-05-06 14:40:45 +00:00
Dir[File.join(CONFIG[:source_path], '**', '*.rb')].each do |file|
2010-05-05 14:44:20 +00:00
puts file
require file
end
end
end