Sha256: 4c19fef0fbe7e5ab351bd91af246db5ad9df48ee1dd21d0c0f36bb27b68a966e
Contents?: true
Size: 1.81 KB
Versions: 2
Compression:
Stored size: 1.81 KB
Contents
module Jasmine class YamlConfigParser def initialize(path, pwd, path_expander = lambda {}, yaml_loader = lambda {}) @path = path @path_expander = path_expander @pwd = pwd @yaml_loader = yaml_loader end def src_dir return @pwd unless loaded_yaml['src_dir'] File.join(@pwd, loaded_yaml['src_dir']) end def spec_dir return File.join(@pwd, 'spec', 'javascripts') unless loaded_yaml['spec_dir'] File.join(@pwd, loaded_yaml['spec_dir']) end def jasmine_dir return nil unless loaded_yaml['jasmine_dir'] File.join(@pwd, loaded_yaml['jasmine_dir']) end def boot_dir return nil unless loaded_yaml['boot_dir'] File.join(@pwd, loaded_yaml['boot_dir']) end def src_files @path_expander.call(src_dir, loaded_yaml['src_files'] || []) end def jasmine_files @path_expander.call(jasmine_dir, loaded_yaml['jasmine_files'] || []) end def boot_files @path_expander.call(boot_dir, loaded_yaml['boot_files'] || []) end def jasmine_css_files @path_expander.call(jasmine_dir, loaded_yaml['jasmine_css_files'] || []) end def spec_files @path_expander.call(spec_dir, loaded_yaml['spec_files'] || []) end def helpers @path_expander.call(spec_dir, loaded_yaml['helpers'] || []) end def css_files @path_expander.call(src_dir, loaded_yaml['stylesheets'] || []) end def spec_helper File.join(@pwd, loaded_yaml['spec_helper'] || File.join('spec', 'javascripts', 'support', 'jasmine_helper.rb')) end def rack_options loaded_yaml.fetch('rack_options', {}).inject({}) do |memo, (key, value)| memo[key.to_sym] = value memo end end private def loaded_yaml @yaml_loader.call(@path) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jasmine-2.0.2 | lib/jasmine/yaml_config_parser.rb |
jasmine-2.0.1 | lib/jasmine/yaml_config_parser.rb |