Class: Rake::AssetTasks
- Inherits:
-
TaskLib
- Object
- TaskLib
- Rake::AssetTasks
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/rake/asset_tasks.rb,
lib/rake/asset_tasks/asset.rb
Overview
helps define asset tasks
Defined Under Namespace
Classes: Asset
Constant Summary collapse
- TASKS =
The tasks defined for pre-compilation of assets
proc do namespace :assets do desc 'precompile assets' task :precompile do with_logger do manifest.compile(assets) end end desc 'Remove all assets' task :clobber do with_logger do manifest.clobber end end desc 'Clean old assets' task :clean do with_logger do manifest.clean(keep) end end end end
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#keep ⇒ Object
readonly
Returns the value of attribute keep.
-
#logger ⇒ Object
Logger to use during rake tasks.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ AssetTasks
constructor
Initialize the rake task-builder.
-
#log_level ⇒ Object
Returns logger level Integer.
-
#log_level=(level) ⇒ Object
Set logger level with constant or symbol.
Constructor Details
#initialize {|_self| ... } ⇒ AssetTasks
Initialize the rake task-builder
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rake/asset_tasks.rb', line 42 def initialize @environment = Flatrack.assets @logger = Logger.new($stderr) @logger.level = Logger::INFO @output = './public/assets' yield self if block_given? @index = environment.index @manifest = Sprockets::Manifest.new(index, output) @keep = 2 define end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
14 15 16 |
# File 'lib/rake/asset_tasks.rb', line 14 def environment @environment end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
15 16 17 |
# File 'lib/rake/asset_tasks.rb', line 15 def index @index end |
#keep ⇒ Object (readonly)
Returns the value of attribute keep.
17 18 19 |
# File 'lib/rake/asset_tasks.rb', line 17 def keep @keep end |
#logger ⇒ Object
Logger to use during rake tasks. Defaults to using stderr.
24 25 26 |
# File 'lib/rake/asset_tasks.rb', line 24 def logger @logger end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
16 17 18 |
# File 'lib/rake/asset_tasks.rb', line 16 def manifest @manifest end |
#output ⇒ Object
Returns the value of attribute output.
13 14 15 |
# File 'lib/rake/asset_tasks.rb', line 13 def output @output end |
Instance Method Details
#log_level ⇒ Object
Returns logger level Integer.
27 28 29 |
# File 'lib/rake/asset_tasks.rb', line 27 def log_level @logger.level end |
#log_level=(level) ⇒ Object
Set logger level with constant or symbol.
33 34 35 36 37 38 39 |
# File 'lib/rake/asset_tasks.rb', line 33 def log_level=(level) if level.is_a?(Integer) @logger.level = level else @logger.level = Logger.const_get(level.to_s.upcase) end end |