Sha256: da4168dfb03f5e25758944d6406d22987a2f17163c88506a004fe9764fdfcf7e

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module BowerRails
  require 'bower-rails/railtie' if defined?(Rails)
  require 'bower-rails/dsl'

  extend self

  class << self
    # An array of tasks to enhance `rake assets:precompile`
    attr_reader :tasks

    # If set to true then rake bower:install task is invoked before assets precompilation
    attr_accessor :install_before_precompile
    
    # If set to true then rake bower:install && rake bower:resolve tasks
    # are invoked before assets precompilation
    attr_accessor :resolve_before_precompile

    # If set to true then rake bower:install && rake bower:clean && rake bower:resolve tasks
    # are invoked before assets precompilation
    attr_accessor :clean_before_precompile

    def configure &block
      yield self if block_given?
      collect_tasks
    end

    private

      def collect_tasks
        @tasks << ['bower:install'] if @install_before_precompile
        @tasks << ['bower:install', 'bower:resolve'] if @resolve_before_precompile
        @tasks << ['bower:install', 'bower:clean']   if @clean_before_precompile
        @tasks.flatten!
        @tasks.uniq!
      end
  end

  # By default tasks are empty
  @tasks = []

  # Set default values for options
  @install_before_precompile = false
  @resolve_before_precompile = false
  @clean_before_precompile   = false
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bower-rails-0.7.3 lib/bower-rails.rb