Sha256: c96cd55c0debb6d0207db510837dee949dc294f9bf07d59e00d3b532266ca4a8

Contents?: true

Size: 859 Bytes

Versions: 11

Compression:

Stored size: 859 Bytes

Contents

module Capistrano
  class Configuration
    module AliasTask
      # Attempts to find the task at the given fully-qualified path, and
      # alias it. If arguments don't have correct task names, an ArgumentError
      # wil be raised. If no such task exists, a Capistrano::NoSuchTaskError
      # will be raised.
      #
      # Usage:
      #
      #   alias_task :original_deploy, :deploy
      #
      def alias_task(new_name, old_name)
        if !new_name.respond_to?(:to_sym) or !old_name.respond_to?(:to_sym)
          raise ArgumentError, "expected a valid task name"
        end

        original_task = find_task(old_name) or raise NoSuchTaskError, "the task `#{old_name}' does not exist"
        task = original_task.dup # Dup. task to avoid modify original task
        task.name = new_name

        define_task(task)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
capistrano-2.15.5 lib/capistrano/configuration/alias_task.rb
minmb-capistrano-2.15.4 lib/capistrano/configuration/alias_task.rb
capistrano-2.15.4 lib/capistrano/configuration/alias_task.rb
capistrano-2.15.3 lib/capistrano/configuration/alias_task.rb
capistrano-2.15.2 lib/capistrano/configuration/alias_task.rb
capistrano-2.15.0 lib/capistrano/configuration/alias_task.rb
capistrano-2.15.1 lib/capistrano/configuration/alias_task.rb
capistrano-2.14.2 lib/capistrano/configuration/alias_task.rb
capistrano-2.14.1 lib/capistrano/configuration/alias_task.rb
capistrano-2.13.5 lib/capistrano/configuration/alias_task.rb
capistrano-2.12.0 lib/capistrano/configuration/alias_task.rb