Module: Capistrano::Interactive::BackendHook

Defined in:
lib/capistrano/interactive/backend_hook.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/capistrano/interactive/backend_hook.rb', line 4

def self.included(base)
  base.class_eval do
    alias_method :non_interactive_execute, :execute
    def execute(*args)
      if BackendHook.intercept_command?
        BackendHook.last_command = command(*args)
      else
        non_interactive_execute(*args)
      end
    end
  end
end

.intercept_command!Object



17
18
19
# File 'lib/capistrano/interactive/backend_hook.rb', line 17

def self.intercept_command!
  @intercept_command = true
end

.intercept_command?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/capistrano/interactive/backend_hook.rb', line 21

def self.intercept_command?
  !!@intercept_command
end

.last_commandObject



25
26
27
# File 'lib/capistrano/interactive/backend_hook.rb', line 25

def self.last_command
  @last_command
end