class RapperLite::Tasks

Rake tasks for building / refreshing packages

Public Class Methods

new( namespace = :rapper ) { |config| ... } click to toggle source

Set up rapper asset packaging Rake tasks.

@param [Symbol] namespace The Rake namespace to put the generated tasks under.

@yield [config] Configuration hash. ‘:path` should be the path to the configuration YAML file. `:env` is the optional environment. Defaults to `:production`.

# File lib/tasks.rb, line 14
def initialize( namespace = :rapper, &block )
  @namespace = namespace
  @config = {
    :path => "rapper.yml"
  }
  yield @config
  @rapper = RapperLite::Engine.new( @config[:path] )
  self.define
end

Private Instance Methods

define() click to toggle source

Creates all rapper rake tasks: package all assets, package assets for each type.

# File lib/tasks.rb, line 28
def define
  namespace @namespace do
    desc "Package static assets that need re-packaging"
    task :package do
      @rapper.package
    end
    
    desc "Watch static assets and re-package when necessary"
    task :watch do
      begin
        RapperLite::Engine.method( :watch )
      rescue NameError
        raise "You need to `require 'rapper_lite/watch_support'`, first."
      end
      @rapper.watch
    end
  end
end