lib/trinidad/command_line_parser.rb in trinidad-1.3.4 vs lib/trinidad/command_line_parser.rb in trinidad-1.3.5
- old
+ new
@@ -6,10 +6,14 @@
def self.parse(argv)
CommandLineParser.new.parse!(argv)
end
+ def self.load(options = {})
+ CommandLineParser.new.load!(options)
+ end
+
def initialize
@default_options = {}
end
def parse!(argv)
@@ -18,14 +22,14 @@
rescue OptionParser::InvalidOption => e
p e, options_parser
exit(1)
end
- load_configuration(default_options)
+ load!(default_options)
end
- def load_configuration(options)
+ def load!(options)
base_dir = options[:web_app_dir] || Dir.pwd
config = options.delete(:config) || Dir.glob(File.join(base_dir, 'config', 'trinidad.{yml,rb}')).first
if config and config = File.expand_path(config, base_dir)
if yaml_configuration?(config)
require 'yaml'
@@ -40,9 +44,10 @@
load config
end
options
end
+ alias_method :load_configuration, :load!
def yaml_configuration?(config)
config && File.exist?(config) && config =~ /\.yml$/
end