class Rspec::Core::ConfigurationOptions
def apply_to(config)
def apply_to(config) merged_options.each do |key, value| config.send("#{key}=", value) end end
def args_from_options_file(path)
def args_from_options_file(path) return [] unless File.exist?(path) File.readlines(path).map {|l| l.split}.flatten end
def command_line_options
def command_line_options parse_command_line_options end
def global_options
def global_options parse_options_file(GLOBAL_OPTIONS_FILE) end
def initialize(args)
def initialize(args) @args = args @options = {} end
def local_options
def local_options parse_options_file(local_options_file) end
def local_options_file
def local_options_file return @options.delete(:options_file) if @options[:options_file] return LOCAL_OPTIONS_FILE if File.exist?(LOCAL_OPTIONS_FILE) Rspec.deprecate("spec/spec.opts", ".rspec or ~/.rspec", "2.0.0") if File.exist?("spec/spec.opts") "spec/spec.opts" end
def merged_options
def merged_options [global_options, local_options, command_line_options].inject do |merged, options| merged.merge(options) end end
def parse_command_line_options
def parse_command_line_options @options = Parser.parse!(@args) @options[:files_or_directories_to_run] = @args @options end
def parse_options_file(path)
def parse_options_file(path) Parser.parse(args_from_options_file(path)) end