Sha256: 6c1b8c12f7efbe03b600392e2ff0de62ac55d70ee426ff39ecc617d0458e86b0

Contents?: true

Size: 899 Bytes

Versions: 1

Compression:

Stored size: 899 Bytes

Contents

require 'guard/sprockets2/version'
require 'guard'
require 'guard/guard'
require 'sprockets'

module Guard
  class Sprockets2 < Guard
    autoload :Compiler, 'guard/sprockets2/compiler'
    
    def initialize(watchers = [], options = {})
      super
      @compiler = Compiler.new(options)
    end
    
    def start
      compile_assets
    end
    
    def run_all
      compile_assets
    end
    
    def run_on_change(paths = [])
      compile_assets
    end
    
    protected
    
    def compile_assets
      @compiler.clean
      print "Compiling assets... " unless ENV["GUARD_ENV"] == "test"
      successful = true
      time_taken = time do
        successful = @compiler.compile
      end
      UI.info "completed in #{time_taken} seconds" if successful
    end
    
    def time(&block)
      start = Time.now
      yield
      finish = Time.now
      finish - start
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guard-sprockets2-0.0.5 lib/guard/sprockets2.rb