Parent

Class/Module Index [+]

Quicksearch

Cucumber::Cli::ProfileLoader

Public Class Methods

new() click to toggle source
# File lib/cucumber/cli/profile_loader.rb, line 6
def initialize
  @cucumber_yml = nil
end

Public Instance Methods

args_from(profile) click to toggle source
# File lib/cucumber/cli/profile_loader.rb, line 10
def args_from(profile)
  unless cucumber_yml.has_key?(profile)
    raise(ProfileNotFound, Could not find profile: '#{profile}'Defined profiles in cucumber.yml:  * #{cucumber_yml.keys.join("\n  * ")})
  end

  args_from_yml = cucumber_yml[profile] || ''

  case(args_from_yml)
    when String
      raise YmlLoadError, "The '#{profile}' profile in cucumber.yml was blank.  Please define the command line arguments for the '#{profile}' profile in cucumber.yml.\n" if args_from_yml =~ /^\s*$/
      if(Cucumber::WINDOWS)
        #Shellwords treats backslash as an escape character so here's a rudimentary approximation of the same code
        args_from_yml = args_from_yml.split
        args_from_yml = args_from_yml.collect {|x| x.gsub(/^\"(.*)\"/,'\1') }
      else
        require 'shellwords'
        args_from_yml = Shellwords.shellwords(args_from_yml)
      end
    when Array
      raise YmlLoadError, "The '#{profile}' profile in cucumber.yml was empty.  Please define the command line arguments for the '#{profile}' profile in cucumber.yml.\n" if args_from_yml.empty?
    else
      raise YmlLoadError, "The '#{profile}' profile in cucumber.yml was a #{args_from_yml.class}. It must be a String or Array"
  end
  args_from_yml
end
cucumber_yml_defined?() click to toggle source
# File lib/cucumber/cli/profile_loader.rb, line 45
def cucumber_yml_defined?
  cucumber_file && File.exist?(cucumber_file)
end
has_profile?(profile) click to toggle source
# File lib/cucumber/cli/profile_loader.rb, line 41
def has_profile?(profile)
  cucumber_yml.has_key?(profile)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.