Class: Cucumber::Cli::ProfileLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/cli/profile_loader.rb

Instance Method Summary collapse

Instance Method Details

#args_from(profile) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cucumber/cli/profile_loader.rb', line 6

def args_from(profile)
  unless cucumber_yml.has_key?(profile)
    raise(ProfileNotFound, "Could not find profile: '\#{profile}'\n\nDefined profiles in cucumber.yml:\n  * \#{cucumber_yml.keys.join(\"\\n  * \")}\n  END_OF_ERROR\n  end\n\n  args_from_yml = cucumber_yml[profile] || ''\n\n  case(args_from_yml)\n    when String\n      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*$/\n      args_from_yml = args_from_yml.split(' ')\n    when Array\n      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?\n    else\n      raise YmlLoadError, \"The '\#{profile}' profile in cucumber.yml was a \#{args_from_yml.class}. It must be a String or Array\"\n  end\n  args_from_yml\nend\n")

#cucumber_yml_defined?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/cucumber/cli/profile_loader.rb', line 34

def cucumber_yml_defined?
  @defined ||= File.exist?('cucumber.yml')
end

#has_profile?(profile) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/cucumber/cli/profile_loader.rb', line 30

def has_profile?(profile)
  cucumber_yml.has_key?(profile)
end