Class: Guard::Cogs
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Cogs
- Defined in:
- lib/guard/cogs.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Cogs
constructor
A new instance of Cogs.
- #run_all ⇒ Object
- #run_on_modifications(paths) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Cogs
Returns a new instance of Cogs.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/guard/cogs.rb', line 8 def initialize( = {}) super @compile = [:compile] @dest = [:dest] || '.' if [:sprockets].nil? @sprockets = ::Sprockets::Environment.new @sprockets.cache = {} if [:minify] == true begin require 'uglifier' @sprockets.js_compressor = ::Uglifier.new rescue LoadError throw 'Uglifier cannot be loaded. Please include "uglifier" in your Gemfile.' end begin require 'yui/compressor' @sprockets.css_compressor = ::YUI::CssCompressor.new rescue LoadError throw 'YUI Compressor cannot be loaded. Please include "yui/compressor" in your Gemfile.' end end else @sprockets = [:sprockets] end asset_paths = [:asset_paths] ? Array([:asset_paths]) : ['.'] asset_paths.each {|p| @sprockets.append_path(p)} end |
Instance Method Details
#run_all ⇒ Object
44 45 46 |
# File 'lib/guard/cogs.rb', line 44 def run_all run_sprockets end |
#run_on_modifications(paths) ⇒ Object
48 49 50 |
# File 'lib/guard/cogs.rb', line 48 def run_on_modifications(paths) run_sprockets(paths) end |
#start ⇒ Object
39 40 41 42 |
# File 'lib/guard/cogs.rb', line 39 def start UI.info 'Starting guard-cogs' run_sprockets end |