class Object

Public Instance Methods

deploy_user() click to toggle source
# File lib/hipchat/capistrano.rb, line 105
def deploy_user
  fetch(:hipchat_deploy_user, "Deploy")
end
deployment_name() click to toggle source
# File lib/hipchat/capistrano.rb, line 75
def deployment_name
  if fetch(:branch, nil)
    name = "#{application}/#{branch}"
    name += " (revision #{real_revision[0..7]})" if real_revision
    name
  else
    application
  end
end
env() click to toggle source
# File lib/hipchat/capistrano.rb, line 121
def env
  fetch(:hipchat_env, fetch(:rack_env, fetch(:rails_env, "production")))
end
failed_message_color() click to toggle source
# File lib/hipchat/capistrano.rb, line 93
def failed_message_color
  fetch(:hipchat_failed_color, "red")
end
human() click to toggle source
# File lib/hipchat/capistrano.rb, line 109
def human
  ENV['HIPCHAT_USER'] ||
    fetch(:hipchat_human,
          if (u = %x{git config user.name}.strip) != ""
            u
          elsif (u = ENV['USER']) != ""
            u
          else
            "Someone"
          end)
end
message_color() click to toggle source
# File lib/hipchat/capistrano.rb, line 85
def message_color
  fetch(:hipchat_color, nil)
end
message_format() click to toggle source
# File lib/hipchat/capistrano.rb, line 101
def message_format
  fetch(:hipchat_message_format, "html")
end
message_notification() click to toggle source
# File lib/hipchat/capistrano.rb, line 97
def message_notification
  fetch(:hipchat_announce, false)
end
send(message, options) click to toggle source
# File lib/hipchat/capistrano.rb, line 54
def send(message, options)
  set :hipchat_client, HipChat::Client.new(hipchat_token) if fetch(:hipchat_client, nil).nil?

  if hipchat_room_name.is_a?(String)
    rooms = [hipchat_room_name]
  elsif hipchat_room_name.is_a?(Symbol)
    rooms = [hipchat_room_name.to_s]
  else
    rooms = hipchat_room_name
  end

  rooms.each { |room|
    begin
      hipchat_client[room].send(deploy_user, message, options)
    rescue => e
      puts e.message
      puts e.backtrace
    end
  }
end
send_options() click to toggle source
# File lib/hipchat/capistrano.rb, line 46
def send_options
  return @send_options if defined?(@send_options)
  @send_options = message_format ? {:message_format => message_format } : {}
  @send_options.merge!(:notify => message_notification)
  @send_options.merge!(:color => message_color)
  @send_options
end
success_message_color() click to toggle source
# File lib/hipchat/capistrano.rb, line 89
def success_message_color
  fetch(:hipchat_success_color, "green")
end