Module: Jasmine::Blanket

Defined in:
lib/jasmine-blanket.rb,
lib/jasmine-blanket/engine.rb,
lib/jasmine-blanket/version.rb,
lib/jasmine-blanket/configuration.rb

Defined Under Namespace

Classes: Configuration, Engine

Constant Summary collapse

VERSION =
"2.0.2.5"

Class Method Summary collapse

Class Method Details

.configObject



19
20
21
22
# File 'lib/jasmine-blanket.rb', line 19

def self.config
  initialize_config
  @config
end

.configure(&block) ⇒ Object



11
12
13
# File 'lib/jasmine-blanket.rb', line 11

def self.configure(&block)
  block.call(self.config)
end

.coverage_thresholdObject



48
49
50
# File 'lib/jasmine-blanket.rb', line 48

def self.coverage_threshold
  @config.coverage_threshold
end

.excluded_foldersObject



44
45
46
# File 'lib/jasmine-blanket.rb', line 44

def self.excluded_folders
  @config.excluded_folders
end

.included_foldersObject

Temporary hacks



40
41
42
# File 'lib/jasmine-blanket.rb', line 40

def self.included_folders
  @config.included_folders
end

.initialize_configObject



15
16
17
# File 'lib/jasmine-blanket.rb', line 15

def self.initialize_config
  @config = Jasmine::Blanket::Configuration.new
end

.load_configuration_from_yaml(path = nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jasmine-blanket.rb', line 24

def self.load_configuration_from_yaml(path = nil)
  path ||= File.join(Dir.pwd, 'spec', 'javascripts', 'support', 'jasmine.yml')
  if File.exist?(path)
    yaml_config = YAML::load(File.read(path))

    Jasmine::Blanket.configure do |config|
      config.included_folders = yaml_config["included_blanket_folders"] if yaml_config["included_blanket_folders"].any?
      config.excluded_folders = yaml_config["excluded_blanket_folders"] if yaml_config["excluded_blanket_folders"].any?
      config.coverage_threshold = yaml_config["coverage_threshold"] if yaml_config["coverage_threshold"]
    end
  else
   raise ConfigNotFound, "Unable to load jasmine config from #{path}"
  end
end