list all possible environments
This commit is contained in:
parent
a198b96a3f
commit
eb64759ac8
1
Rakefile
1
Rakefile
@ -1,6 +1,7 @@
|
|||||||
$LOAD_PATH << 'lib'
|
$LOAD_PATH << 'lib'
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
require 'apache'
|
require 'apache'
|
||||||
require 'spec/rake/spectask'
|
require 'spec/rake/spectask'
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
require 'yaml'
|
||||||
require 'apache/config'
|
require 'apache/config'
|
||||||
require 'apache/rake/create'
|
require 'apache/rake/create'
|
||||||
require 'yaml'
|
|
||||||
require 'rainbow'
|
require 'rainbow'
|
||||||
|
|
||||||
|
CONFIG = Hash[YAML.load_file('config.yml').collect { |k,v| [ k.to_sym, v ] }]
|
||||||
|
|
||||||
namespace :apache do
|
namespace :apache do
|
||||||
desc "Create all defined configs for the specified environment"
|
desc "Create all defined configs for the specified environment"
|
||||||
task :create, :environment do |t, args|
|
task :create, :environment do |t, args|
|
||||||
APACHE_ENV = (args[:environment] || 'production').to_sym
|
APACHE_ENV = (args[:environment] || 'production').to_sym
|
||||||
|
|
||||||
CONFIG = Hash[YAML.load_file('config.yml').collect { |k,v| [ k.to_sym, v ] }]
|
|
||||||
|
|
||||||
CONFIG[:source_path] = File.expand_path(CONFIG[:source])
|
CONFIG[:source_path] = File.expand_path(CONFIG[:source])
|
||||||
CONFIG[:dest_path] = File.expand_path(CONFIG[:destination])
|
CONFIG[:dest_path] = File.expand_path(CONFIG[:destination])
|
||||||
|
|
||||||
@ -24,4 +24,13 @@ namespace :apache do
|
|||||||
require file
|
require file
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "List all possible environments"
|
||||||
|
task :environments do
|
||||||
|
CONFIG[:source_path] = File.expand_path(CONFIG[:source])
|
||||||
|
|
||||||
|
puts Dir[File.join(CONFIG[:source_path], '**', '*.rb')].collect { |file|
|
||||||
|
File.readlines(file).find_all { |line| line[%r{(if_environment|build_if)}] }.collect { |line| line.scan(%r{:[a-z_]+}) }
|
||||||
|
}.flatten.uniq.sort.collect { |name| name[1..-1] } * "\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user