Sha256: 282bdb82202b5e42432677185c8d92109a43fad8800a0b6bc0e08c54c13c3cad

Contents?: true

Size: 927 Bytes

Versions: 6

Compression:

Stored size: 927 Bytes

Contents

module BowerVendor
  class Base
    def initialize
    end

    def vendors
      @vendors ||= YAML.load_file('vendor.yml')
      validate_vendors
      @vendors
    end

    def validate_vendors
      # validate resources
      @vendors.each do |vendor_key, vendor|
        raise "VERSION MISSING: #{vendor.inspect}" unless vendor['version']
        raise "ASSETS MISSING: #{vendor.inspect}" unless vendor['assets']
      end
    end

    def config
      @config ||= load_config('config/bower_vendor.yml')
      @config ||= load_config(File.join(BowerVendor.root_dir, 'config/bower_vendor.yml'))
    end

    def load_config(file)
      if File.exist?(file)
        YAML.load_file(file)
      else
        nil
      end
    end

    def base_src_dir
      @base_src_dir ||= 'bower_components'
    end

    def work_dir
      if defined?(Rails)
        "#{Rails.root}/tmp"
      else
        'tmp'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bower_vendor-0.0.12 lib/bower_vendor/base.rb
bower_vendor-0.0.11 lib/bower_vendor/base.rb
bower_vendor-0.0.10 lib/bower_vendor/base.rb
bower_vendor-0.0.9 lib/bower_vendor/base.rb
bower_vendor-0.0.8 lib/bower_vendor/base.rb
bower_vendor-0.0.7 lib/bower_vendor/base.rb