Module: Mack::RakeHelpers

Defined in:
lib/mack/tasks/rake_helpers.rb

Instance Method Summary collapse

Instance Method Details

#alias_task(name, *args) ⇒ Object

Allows the aliasing and chaining of Rake tasks.

Examples:

alias_task :server, "log:clear", "script:server"
alias_task "server:start", "log:clear", "script:server"


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mack/tasks/rake_helpers.rb', line 9

def alias_task(name, *args)
  ts = [args].flatten
  ts = ts.collect {|x| "'#{x}'"}.join(", ")
  ts = "[#{ts}]"
  n_task = %{
    desc "Alias: #{name} => #{ts}"
    task "#{name}" => #{ts} do |t|
    end
  }
  eval(n_task)
end