Class: Jasmine::YamlConfigParser

Inherits:
Object
  • Object
show all
Defined in:
lib/jasmine/yaml_config_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, pwd, path_expander = lambda {}, yaml_loader = lambda {}) ⇒ YamlConfigParser

Returns a new instance of YamlConfigParser.



3
4
5
6
7
8
# 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

Instance Method Details

#boot_dirObject



25
26
27
28
# 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_filesObject



38
39
40
# File 'lib/jasmine/yaml_config_parser.rb', line 38

def boot_files
  @path_expander.call(boot_dir, loaded_yaml['boot_files'] || [])
end

#css_filesObject



54
55
56
# File 'lib/jasmine/yaml_config_parser.rb', line 54

def css_files
  @path_expander.call(src_dir, loaded_yaml['stylesheets'] || [])
end

#helpersObject



50
51
52
# File 'lib/jasmine/yaml_config_parser.rb', line 50

def helpers
  @path_expander.call(spec_dir, loaded_yaml['helpers'] || [])
end

#jasmine_css_filesObject



42
43
44
# 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_dirObject



20
21
22
23
# 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_filesObject



34
35
36
# File 'lib/jasmine/yaml_config_parser.rb', line 34

def jasmine_files
  @path_expander.call(jasmine_dir, loaded_yaml['jasmine_files'] || [])
end

#phantom_cli_optionsObject



87
88
89
# File 'lib/jasmine/yaml_config_parser.rb', line 87

def phantom_cli_options
  loaded_yaml['phantom_cli_options'] || {}
end

#phantom_config_scriptObject



82
83
84
85
# 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_optionsObject



91
92
93
94
95
96
# 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

#randomObject



74
75
76
77
78
79
80
# 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_logObject



62
63
64
# File 'lib/jasmine/yaml_config_parser.rb', line 62

def show_console_log
  loaded_yaml['show_console_log'] || false
end

#spec_dirObject



15
16
17
18
# 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_filesObject



46
47
48
# File 'lib/jasmine/yaml_config_parser.rb', line 46

def spec_files
  @path_expander.call(spec_dir, loaded_yaml['spec_files'] || [])
end

#spec_helperObject



58
59
60
# 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_dirObject



10
11
12
13
# 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_filesObject



30
31
32
# 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_failureObject



70
71
72
# 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_failureObject



66
67
68
# File 'lib/jasmine/yaml_config_parser.rb', line 66

def stop_spec_on_expectation_failure
  loaded_yaml['stop_spec_on_expectation_failure'] || false
end