Class: Teaspoon::Framework::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/teaspoon/framework/base.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

._asset_pathsObject

Returns the value of attribute _asset_paths.



6
7
8
# File 'lib/teaspoon/framework/base.rb', line 6

def _asset_paths
  @_asset_paths
end

._install_pathObject

Returns the value of attribute _install_path.



8
9
10
# File 'lib/teaspoon/framework/base.rb', line 8

def _install_path
  @_install_path
end

._install_procObject

Returns the value of attribute _install_proc.



9
10
11
# File 'lib/teaspoon/framework/base.rb', line 9

def _install_proc
  @_install_proc
end

._template_pathsObject

Returns the value of attribute _template_paths.



7
8
9
# File 'lib/teaspoon/framework/base.rb', line 7

def _template_paths
  @_template_paths
end

._versionsObject

Returns the value of attribute _versions.



5
6
7
# File 'lib/teaspoon/framework/base.rb', line 5

def _versions
  @_versions
end

Class Method Details

.add_asset_path(path) ⇒ Object



40
41
42
# File 'lib/teaspoon/framework/base.rb', line 40

def add_asset_path(path)
  @_asset_paths << path
end

.add_template_path(path) ⇒ Object



44
45
46
# File 'lib/teaspoon/framework/base.rb', line 44

def add_template_path(path)
  @_template_paths << path
end

.asset_pathsObject



57
58
59
# File 'lib/teaspoon/framework/base.rb', line 57

def asset_paths
  @_asset_paths
end

.descriptionObject



53
54
55
# File 'lib/teaspoon/framework/base.rb', line 53

def description
  "#{@_framework_name}[#{@_versions.keys.join(', ')}]"
end

.framework_name(name = nil) ⇒ Object



19
20
21
# File 'lib/teaspoon/framework/base.rb', line 19

def framework_name(name = nil)
  name.present? ? @_framework_name ||= name.to_sym : @_framework_name
end

.inherited(base) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/teaspoon/framework/base.rb', line 11

def inherited(base)
  base._versions = {}
  base._asset_paths = []
  base._template_paths = []
  base._install_path = "spec"
  base._install_proc = proc { }
end

.install_callbackObject



81
82
83
# File 'lib/teaspoon/framework/base.rb', line 81

def install_callback
  _install_proc
end

.install_pathObject



77
78
79
# File 'lib/teaspoon/framework/base.rb', line 77

def install_path
  _install_path
end

.install_to(path, &block) ⇒ Object



48
49
50
51
# File 'lib/teaspoon/framework/base.rb', line 48

def install_to(path, &block)
  @_install_path = path
  @_install_proc = block if block_given?
end

.javascripts_for(version = nil) ⇒ Object



69
70
71
# File 'lib/teaspoon/framework/base.rb', line 69

def javascripts_for(version = nil)
  _versions[version || versions.last]
end

.modify_config(_config) ⇒ Object



85
86
87
# File 'lib/teaspoon/framework/base.rb', line 85

def modify_config(_config)
  # noop - Implement this in subclass to modify suite configuration
end

.nameObject



65
66
67
# File 'lib/teaspoon/framework/base.rb', line 65

def name
  framework_name
end

.register_version(version, js_runner, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/teaspoon/framework/base.rb', line 23

def register_version(version, js_runner, options = {})
  dependencies = options[:dependencies] || []
  dev_deps = options[:dev_deps] || []

  if ENV["TEASPOON_DEVELOPMENT"] && dev_deps.any?
    dependencies = dev_deps
  end

  if dependencies.empty?
    raise Teaspoon::UnspecifiedDependencies.new(framework: @_framework_name, version: version)
  end

  dependencies.unshift(js_runner)
  @_versions[version] = dependencies
  Teaspoon.configuration.asset_manifest += dependencies
end

.template_pathsObject



73
74
75
# File 'lib/teaspoon/framework/base.rb', line 73

def template_paths
  _template_paths
end

.versionsObject



61
62
63
# File 'lib/teaspoon/framework/base.rb', line 61

def versions
  _versions.keys
end