Class: Teaspoon::Configuration::Suite

Inherits:
Object
  • Object
show all
Defined in:
lib/teaspoon/deprecated.rb,
lib/teaspoon/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ Suite

Returns a new instance of Suite.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/teaspoon/configuration.rb', line 68

def initialize(name = nil)
  @matcher       = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee,es6,js.es6}"
  @helper        = "spec_helper"
  @javascripts   = []
  @stylesheets   = ["teaspoon"]

  @boot_partial  = "boot"
  @body_partial  = "body"

  @hooks         = Hash.new { |h, k| h[k] = [] }
  @expand_assets = true
  @js_extensions = [/(\.js)?\.coffee/, /(\.js)?\.es6/, ".es6.js"]

  default = Teaspoon.configuration.suite_configs["default"]
  instance_eval(&default[:block]) if default
  if block_given?
    yield self
    raise Teaspoon::UnspecifiedFramework.new(name: name) if @javascripts.length == 0
  end
end

Instance Attribute Details

#body_partialObject

Returns the value of attribute body_partial.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def body_partial
  @body_partial
end

#boot_partialObject

Returns the value of attribute boot_partial.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def boot_partial
  @boot_partial
end

#expand_assetsObject

Returns the value of attribute expand_assets.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def expand_assets
  @expand_assets
end

#helperObject

Returns the value of attribute helper.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def helper
  @helper
end

#hooksObject

Returns the value of attribute hooks.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def hooks
  @hooks
end

#javascriptsObject

Returns the value of attribute javascripts.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def javascripts
  @javascripts
end

#js_extensionsObject

Returns the value of attribute js_extensions.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def js_extensions
  @js_extensions
end

#matcherObject

Returns the value of attribute matcher.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def matcher
  @matcher
end

#stylesheetsObject

Returns the value of attribute stylesheets.



64
65
66
# File 'lib/teaspoon/configuration.rb', line 64

def stylesheets
  @stylesheets
end

Instance Method Details

#hook(group = :default, &block) ⇒ Object



99
100
101
# File 'lib/teaspoon/configuration.rb', line 99

def hook(group = :default, &block)
  @hooks[group.to_s] << block
end

#js_config=(*_args) ⇒ Object



67
68
69
70
71
72
# File 'lib/teaspoon/deprecated.rb', line 67

def js_config=(*_args)
  Teaspoon.dep(
    "the teaspoon suite js_config directive is no longer used, use the install generator to install the boot " +
    "partial and customize it instead.", :js_config
  )
end

#no_coverageObject Also known as: no_coverage=



81
82
83
84
# File 'lib/teaspoon/deprecated.rb', line 81

def no_coverage(*)
  Teaspoon.dep("suite.no_coverage has been removed in Teaspoon 1.0. Please use coverage.ignore instead. https://github.com/jejacks0n/teaspoon/blob/master/CHANGELOG.md")
  []
end

#normalize_asset_path=(*_args) ⇒ Object



74
75
76
77
78
79
# File 'lib/teaspoon/deprecated.rb', line 74

def normalize_asset_path=(*_args)
  Teaspoon.dep(
    "the teaspoon suite normalize_asset_path directive is no longer used, reopen Teaspoon::Suite and define a " +
    "normalize_js_extension method instead.", :normalize_asset_path
  )
end

#use_framework(name, version = nil) ⇒ Object



89
90
91
92
93
94
95
96
97
# File 'lib/teaspoon/configuration.rb', line 89

def use_framework(name, version = nil)
  framework = Teaspoon::Framework.fetch(name)
  framework.modify_config(self)

  @javascripts = framework.javascripts_for(version)
  return if @javascripts

  raise Teaspoon::UnknownFrameworkVersion.new(name: name, version: version)
end

#use_framework=(name, _version = nil) ⇒ Object



87
88
89
90
# File 'lib/teaspoon/deprecated.rb', line 87

def use_framework=(name, _version = nil)
  Teaspoon.dep("suite.use_framework= is deprecated, use suite.use_framework instead.")
  use_framework(*name)
end