Class: Sprockets::Bower::Manifest
- Inherits:
-
Object
- Object
- Sprockets::Bower::Manifest
- Defined in:
- lib/sprockets/bower.rb
Constant Summary collapse
- DEFAULT_ASSETS_PATH =
Default location where bower stashes its assets.
'./components'
- DEFAULT_BOWERRC_PATH =
Default path for the .bowerrc file
'.bowerrc'
Class Method Summary collapse
-
.load(bowerrc_path = DEFAULT_BOWERRC_PATH) ⇒ Object
Load a bower Manifest and don’t throw an error if the .bowerrc file is not fond.
-
.load!(bowerrc_path) ⇒ Object
Create a new Manifest and configure it with the bowerrc file.
Instance Method Summary collapse
-
#configure(sprockets) ⇒ Object
Configure the sprockets environment.
-
#initialize(path = DEFAULT_ASSETS_PATH) ⇒ Manifest
constructor
Create a new instance of a bower manifest that we’ll pass into sprockets.
Constructor Details
#initialize(path = DEFAULT_ASSETS_PATH) ⇒ Manifest
Create a new instance of a bower manifest that we’ll pass into sprockets.
15 16 17 |
# File 'lib/sprockets/bower.rb', line 15 def initialize(path = DEFAULT_ASSETS_PATH) @path = path end |
Class Method Details
.load(bowerrc_path = DEFAULT_BOWERRC_PATH) ⇒ Object
Load a bower Manifest and don’t throw an error if the .bowerrc file is not fond.
26 27 28 |
# File 'lib/sprockets/bower.rb', line 26 def self.load(bowerrc_path = DEFAULT_BOWERRC_PATH) File.exists?(bowerrc_path) ? load!(bowerrc_path) : new end |
.load!(bowerrc_path) ⇒ Object
Create a new Manifest and configure it with the bowerrc file.
31 32 33 34 |
# File 'lib/sprockets/bower.rb', line 31 def self.load!(bowerrc_path) json = JSON.parse File.read bowerrc_path new File. json['directory'], File.dirname(bowerrc_path) end |
Instance Method Details
#configure(sprockets) ⇒ Object
Configure the sprockets environment.
20 21 22 |
# File 'lib/sprockets/bower.rb', line 20 def configure(sprockets) sprockets.append_path @path end |