Class: Bower::Environment
- Inherits:
-
Object
- Object
- Bower::Environment
- Defined in:
- lib/bower/environment.rb
Constant Summary collapse
- DEFAULT_DIRECTORY =
'bower_components'
- DEFAULT_JSON =
'bower.json'
Instance Attribute Summary collapse
-
#directory ⇒ Object
Returns the value of attribute directory.
-
#json ⇒ Object
Returns the value of attribute json.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ Environment
constructor
A new instance of Environment.
- #install ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Environment
Returns a new instance of Environment.
19 20 21 22 |
# File 'lib/bower/environment.rb', line 19 def initialize(config={}) @directory = config['directory'] || DEFAULT_DIRECTORY @json = config['json'] || DEFAULT_JSON end |
Instance Attribute Details
#directory ⇒ Object
Returns the value of attribute directory.
5 6 7 |
# File 'lib/bower/environment.rb', line 5 def directory @directory end |
#json ⇒ Object
Returns the value of attribute json.
5 6 7 |
# File 'lib/bower/environment.rb', line 5 def json @json end |
Class Method Details
.setup(bowerrc = nil) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/bower/environment.rb', line 10 def self.setup(bowerrc=nil) if bowerrc && File.exists?(bowerrc) conf = MultiJson.load(File.open(bowerrc)) Environment.new(conf) else Environment.new end end |
Instance Method Details
#install ⇒ Object
24 25 26 |
# File 'lib/bower/environment.rb', line 24 def install run('bower install') end |
#update ⇒ Object
28 29 30 |
# File 'lib/bower/environment.rb', line 28 def update run('bower update') end |