class Jasmine::YamlConfigParser

Public Class Methods

new(path, pwd, path_expander = lambda {}, yaml_loader = lambda {}) click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 3
def initialize(path, pwd, path_expander = lambda {}, yaml_loader = lambda {})
  @path = path
  @path_expander = path_expander
  @pwd = pwd
  @yaml_loader = yaml_loader
end

Public Instance Methods

boot_dir() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 25
def boot_dir
  return nil unless loaded_yaml['boot_dir']
  File.join(@pwd, loaded_yaml['boot_dir'])
end
boot_files() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 38
def boot_files
  @path_expander.call(boot_dir, loaded_yaml['boot_files'] || [])
end
css_files() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 54
def css_files
  @path_expander.call(src_dir, loaded_yaml['stylesheets'] || [])
end
helpers() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 50
def helpers
  @path_expander.call(spec_dir, loaded_yaml['helpers'] || [])
end
jasmine_css_files() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 42
def jasmine_css_files
  @path_expander.call(jasmine_dir, loaded_yaml['jasmine_css_files'] || [])
end
jasmine_dir() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 20
def jasmine_dir
  return nil unless loaded_yaml['jasmine_dir']
  File.join(@pwd, loaded_yaml['jasmine_dir'])
end
jasmine_files() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 34
def jasmine_files
  @path_expander.call(jasmine_dir, loaded_yaml['jasmine_files'] || [])
end
phantom_cli_options() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 87
def phantom_cli_options
  loaded_yaml['phantom_cli_options'] || {}
end
phantom_config_script() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 82
def phantom_config_script
  return nil unless loaded_yaml['phantom_config_script']
  File.join @pwd, loaded_yaml['phantom_config_script']
end
rack_options() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 91
def rack_options
  loaded_yaml.fetch('rack_options', {}).inject({}) do |memo, (key, value)|
    memo[key.to_sym] = value
    memo
  end
end
random() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 74
def random
  if loaded_yaml['random'].nil?
    true
  else
    loaded_yaml['random']
  end
end
show_console_log() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 62
def show_console_log
  loaded_yaml['show_console_log'] || false
end
spec_dir() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 15
def spec_dir
  return File.join(@pwd, 'spec', 'javascripts') unless loaded_yaml['spec_dir']
  File.join(@pwd, loaded_yaml['spec_dir'])
end
spec_files() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 46
def spec_files
  @path_expander.call(spec_dir, loaded_yaml['spec_files'] || [])
end
spec_helper() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 58
def spec_helper
  File.join(@pwd, loaded_yaml['spec_helper'] || File.join('spec', 'javascripts', 'support', 'jasmine_helper.rb'))
end
src_dir() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 10
def src_dir
  return @pwd unless loaded_yaml['src_dir']
  File.join(@pwd, loaded_yaml['src_dir'])
end
src_files() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 30
def src_files
  @path_expander.call(src_dir, loaded_yaml['src_files'] || [])
end
stop_on_spec_failure() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 70
def stop_on_spec_failure
  loaded_yaml['stop_on_spec_failure'] || false
end
stop_spec_on_expectation_failure() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 66
def stop_spec_on_expectation_failure
  loaded_yaml['stop_spec_on_expectation_failure'] || false
end

Private Instance Methods

loaded_yaml() click to toggle source
# File lib/jasmine/yaml_config_parser.rb, line 99
def loaded_yaml
  @yaml_loader.call(@path)
end