Class: Pushapp::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/pushapp/hook.rb

Constant Summary collapse

ANSI_COLORS =
{
  :reset          => 0,
  :black          => 30,
  :red            => 31,
  :green          => 32,
  :yellow         => 33,
  :blue           => 34,
  :magenta        => 35,
  :cyan           => 36,
  :white          => 37,
  :bright_black   => 30,
  :bright_red     => 31,
  :bright_green   => 32,
  :bright_yellow  => 33,
  :bright_blue    => 34,
  :bright_magenta => 35,
  :bright_cyan    => 36,
  :bright_white   => 37,
}
HOOK_COLORS =
%w( cyan yellow green magenta blue bright_cyan bright_yellow
bright_magenta bright_blue red bright_green bright_red )

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remote) ⇒ Hook

Returns a new instance of Hook.



31
32
33
34
35
36
37
38
39
40
# File 'lib/pushapp/hook.rb', line 31

def initialize(remote)
  @remote  = remote
  @config  = remote.config
  @options = remote.options

  @remote_index = @config.remotes.index(@remote)
  @remote_color = ANSI_COLORS[HOOK_COLORS[@remote_index % HOOK_COLORS.length].to_sym]
  @echo_color   = ANSI_COLORS[:bright_green]
  @error_color  = ANSI_COLORS[:bright_red]
end

Instance Attribute Details

#remoteObject

Returns the value of attribute remote.



29
30
31
# File 'lib/pushapp/hook.rb', line 29

def remote
  @remote
end

Instance Method Details

#setupObject



42
43
44
45
# File 'lib/pushapp/hook.rb', line 42

def setup
  prepare_hook
  deploy_hook
end