Module: Lotus::Assets
- Includes:
- Utils::ClassAttribute
- Defined in:
- lib/lotus/assets.rb,
lib/lotus/assets/cache.rb,
lib/lotus/assets/bundler.rb,
lib/lotus/assets/helpers.rb,
lib/lotus/assets/version.rb,
lib/lotus/assets/compiler.rb,
lib/lotus/assets/precompiler.rb,
lib/lotus/assets/configuration.rb,
lib/lotus/assets/config/sources.rb,
lib/lotus/assets/config/manifest.rb,
lib/lotus/assets/compressors/abstract.rb,
lib/lotus/assets/config/global_sources.rb,
lib/lotus/assets/compressors/javascript.rb,
lib/lotus/assets/compressors/stylesheet.rb,
lib/lotus/assets/compressors/yui_javascript.rb,
lib/lotus/assets/compressors/yui_stylesheet.rb,
lib/lotus/assets/compressors/null_compressor.rb,
lib/lotus/assets/compressors/sass_stylesheet.rb,
lib/lotus/assets/compressors/builtin_javascript.rb,
lib/lotus/assets/compressors/builtin_stylesheet.rb,
lib/lotus/assets/compressors/closure_javascript.rb,
lib/lotus/assets/compressors/uglifier_javascript.rb
Overview
Assets management for Ruby web applications
Defined Under Namespace
Modules: Compressors, Config, Helpers Classes: Bundler, Cache, Compiler, Configuration, Error, MissingAsset, MissingDigestAssetError, MissingDigestManifestError, Precompiler, UnknownAssetEngine
Constant Summary collapse
- VERSION =
Defines the version
'0.1.0'.freeze
Class Method Summary collapse
-
.configure(&blk) ⇒ Object
Configure framework.
-
.deploy ⇒ Object
Prepare assets for deploys.
-
.dupe ⇒ Module
private
Duplicate Lotus::Assets in order to create a new separated instance of the framework.
-
.duplicate(mod, &blk) ⇒ Module
Duplicate the framework and generate modules for the target application.
-
.duplicates ⇒ Array
private
Keep track of duplicated frameworks.
-
.load! ⇒ Object
Preload the framework.
-
.sources ⇒ Lotus::Assets::Config::GlobalSources
Global assets sources.
Class Method Details
.configure(&blk) ⇒ Object
Configure framework
40 41 42 43 |
# File 'lib/lotus/assets.rb', line 40 def self.configure(&blk) configuration.instance_eval(&blk) self end |
.deploy ⇒ Object
Prepare assets for deploys
48 49 50 51 52 53 54 |
# File 'lib/lotus/assets.rb', line 48 def self.deploy require 'lotus/assets/precompiler' require 'lotus/assets/bundler' Precompiler.new(configuration, duplicates).run Bundler.new(configuration, duplicates).run end |
.dupe ⇒ Module
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Duplicate Lotus::Assets in order to create a new separated instance of the framework.
The new instance of the framework will be completely decoupled from the original. It will inherit the configuration, but all the changes that happen after the duplication, won’t be reflected on the other copies.
129 130 131 132 133 |
# File 'lib/lotus/assets.rb', line 129 def self.dupe dup.tap do |duplicated| duplicated.configuration = configuration.duplicate end end |
.duplicate(mod, &blk) ⇒ Module
Duplicate the framework and generate modules for the target application
@since 0.1.0
111 112 113 114 115 116 |
# File 'lib/lotus/assets.rb', line 111 def self.duplicate(mod, &blk) dupe.tap do |duplicated| duplicated.configure(&blk) if block_given? duplicates << duplicated end end |
.duplicates ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Keep track of duplicated frameworks
144 145 146 147 148 |
# File 'lib/lotus/assets.rb', line 144 def self.duplicates synchronize do @@duplicates ||= Array.new end end |
.load! ⇒ Object
Preload the framework
This MUST be used in production mode
73 74 75 |
# File 'lib/lotus/assets.rb', line 73 def self.load! configuration.load! end |
.sources ⇒ Lotus::Assets::Config::GlobalSources
Global assets sources
This is designed for third party integration gems with frontend frameworks like Bootstrap, Ember.js or React.
Developers can maintain gems that ship static assets for these frameworks and make them available to Lotus::Assets.
94 95 96 97 98 |
# File 'lib/lotus/assets.rb', line 94 def self.sources synchronize do @@sources ||= Config::GlobalSources.new end end |