class Tennpipes::Generators::Task

Responsible for generating new task file for Tennpipes application.

Public Class Methods

banner() click to toggle source
source_root() click to toggle source
# File lib/tennpipes-init/generators/task.rb, line 14
def source_root; File.expand_path(File.dirname(__FILE__)); end

Public Instance Methods

create_task() click to toggle source
# File lib/tennpipes-init/generators/task.rb, line 28
def create_task
  self.destination_root = options[:root]
  if in_app_root?
    app        = options[:app]
    @task_name = name.to_s.underscore
    @namespace = options[:namespace].underscore if options[:namespace]
    @desc      = options[:description]
    filename   = @task_name + ".rake"
    filename   = "#{@namespace}_#{filename}" if @namespace

    template 'templates/task.rb.tt', destination_root('tasks', filename)
  else
    say 'You are not at the root of a Tennpipes application! (config/boot.rb not found)'
  end
end