Sha256: fb4330b5313e6d60634f5ba1498787f92d0e8f386cecf90448bf5b7b236e4bad
Contents?: true
Size: 801 Bytes
Versions: 2
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.exists?(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.exists?(directory) Dir.chdir(directory) do `#{cmd}` if File.exists?(json) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bower-0.0.4 | lib/bower/environment.rb |
bower-0.0.3 | lib/bower/environment.rb |