module Deployinator::Helpers::ViewHelpers

Public Instance Methods

allowed_to_push_to_prod?() click to toggle source
# File lib/deployinator/helpers/view.rb, line 9
def allowed_to_push_to_prod?
  true
end
groups() click to toggle source
# File lib/deployinator/helpers/view.rb, line 13
def groups
  @groups.join(", ")
end
log_lines() click to toggle source
# File lib/deployinator/helpers/view.rb, line 30
def log_lines
  log_to_hash(:stack => stack)
end
log_to_hash(opts={}) click to toggle source
# File lib/deployinator/helpers/view.rb, line 34
def log_to_hash(opts={})
  times = {}
  last_time = 0
  l = log_entries(opts).map do |ll|
    fields = ll.split("|")
    times[fields[1]] ||= []
    times[fields[1]] << fields[0]

    env = fields[1]

    utc_time = Time.parse(fields[0] + "UTC")
    {
      :timestamp => fields[0],
      :time      => utc_time,
      :time_secs => utc_time.to_i,
      :env       => env,
      :who       => fields[2],
      :msg       => hyperlink(fields[3]),
      :old       => fields[3] && fields[3][/old[\s:]*(\w+)/, 1],
      :new       => fields[3] && fields[3][/new[\s:]*(\w+)/, 1],
      :stack     => fields[4],
      :run_log_url => (fields.length < 6) ? false : fields[5],
      :diff_url => true,
      :from_timestamp      => utc_time.to_i - 1800, # + half hour before
      :until_timestamp     => utc_time.to_i + 1800, # + half hour after
      :diff_method => 'diff'
    }
  end
  times.each { |e,t| t.shift }
  l
end
logout_url() click to toggle source

TODO: assimilate with plugin

# File lib/deployinator/helpers/view.rb, line 22
def logout_url
  raise_event(:logout_url)
end
my_entries() click to toggle source
# File lib/deployinator/helpers/view.rb, line 26
def my_entries
  log_entries(:stack => stack)
end
my_url() click to toggle source
# File lib/deployinator/helpers/view.rb, line 17
def my_url
  "http://#{@host}"
end
username() click to toggle source
# File lib/deployinator/helpers/view.rb, line 5
def username
  @username
end