Sha256: 75b5288d7fee9dc6d904da5a53f20e4d5f63b8277c2acb4b7b5280ce87d5ce69
Contents?: true
Size: 801 Bytes
Versions: 1
Compression:
Stored size: 801 Bytes
Contents
require 'multi_json' module Bower class Environment attr_accessor :directory attr_reader :json DEFAULT_DIRECTORY = 'bower_components' DEFAULT_JSON = 'bower.json' def self.setup(bowerrc = nil) if bowerrc && File.exist?(bowerrc) conf = MultiJson.load(File.open(bowerrc)) Environment.new(conf) else Environment.new end end def initialize(config = {}) @directory = config['directory'] || DEFAULT_DIRECTORY @json = DEFAULT_JSON end def install run('bower install') end def update run('bower update') end private def run(cmd) return unless Dir.exist?(directory) Dir.chdir(directory) do `#{cmd}` if File.exist?(json) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bower-0.0.5 | lib/bower/environment.rb |