Class: Embork::Environment
Defined Under Namespace
Classes: ErblessCache
Instance Attribute Summary collapse
Instance Method Summary
collapse
#load_bootstrap_framework, #load_compass_framework
Constructor Details
#initialize(borkfile, options = {}) ⇒ Environment
Returns a new instance of Environment.
Instance Attribute Details
#bundle_version ⇒ Object
Returns the value of attribute bundle_version.
9
10
11
|
# File 'lib/embork/environment.rb', line 9
def bundle_version
@bundle_version
end
|
#sprockets_environment ⇒ Object
Returns the value of attribute sprockets_environment.
8
9
10
|
# File 'lib/embork/environment.rb', line 8
def sprockets_environment
@sprockets_environment
end
|
#use_bundled_assets ⇒ Object
Returns the value of attribute use_bundled_assets.
10
11
12
|
# File 'lib/embork/environment.rb', line 10
def use_bundled_assets
@use_bundled_assets
end
|
Instance Method Details
#setup_compressor ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/embork/environment.rb', line 99
def setup_compressor
if @borkfile.compressor == :closure_compiler
@sprockets_environment.register_bundle_processor 'application/javascript',
Embork::Sprockets::ClosureCompiler
elsif @borkfile.compressor == :uglify
@sprockets_environment.js_compressor = :uglify
elsif @borkfile.compressor
@sprockets_environment.register_bundle_processor 'application/javascript',
@borkfile.compressor
end
end
|
#setup_engines ⇒ Object
86
87
88
89
90
|
# File 'lib/embork/environment.rb', line 86
def setup_engines
@borkfile.sprockets_engines.each do |engine|
@sprockets_environment.register_engine engine[:extension], engine[:klass]
end
end
|
#setup_frameworks ⇒ Object
92
93
94
95
96
97
|
# File 'lib/embork/environment.rb', line 92
def setup_frameworks
@borkfile.frameworks.each do |framework|
method = ('load_%s_framework' % framework).to_sym
self.send method, @sprockets_environment
end
end
|
#setup_paths ⇒ Object
61
62
63
64
65
|
# File 'lib/embork/environment.rb', line 61
def setup_paths
@borkfile.asset_paths.each do |path|
@sprockets_environment.append_path path
end
end
|
#setup_processors ⇒ Object
77
78
79
80
81
82
83
84
|
# File 'lib/embork/environment.rb', line 77
def setup_processors
@borkfile.sprockets_postprocessors.each do |processor|
@sprockets_environment.register_postprocessor processor[:mime_type], processor[:klass]
end
@borkfile.sprockets_preprocessors.each do |processor|
@sprockets_environment.register_preprocessor processor[:mime_type], processor[:klass]
end
end
|
#setup_sprockets ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/embork/environment.rb', line 34
def setup_sprockets
@sprockets_environment = Sprockets::Environment.new @borkfile.project_root
cache_path = File.join @borkfile.project_root, '.cache'
@sprockets_environment.cache = ErblessCache.new(cache_path)
setup_sprockets_defaults
setup_paths
setup_helpers
setup_processors
setup_engines
setup_frameworks
setup_transforms
setup_compressor if @borkfile.compressor
end
|
#setup_sprockets_defaults ⇒ Object