Module: Deployinator::Helpers::ViewHelpers
- Included in:
- Mustache
- Defined in:
- lib/deployinator/helpers/view.rb
Instance Method Summary collapse
- #allowed_to_push_to_prod? ⇒ Boolean
- #groups ⇒ Object
- #log_lines ⇒ Object
- #log_to_hash(opts = {}) ⇒ Object
-
#logout_url ⇒ Object
TODO: assimilate with plugin.
- #my_entries ⇒ Object
- #my_url ⇒ Object
- #username ⇒ Object
Instance Method Details
#allowed_to_push_to_prod? ⇒ Boolean
9 10 11 |
# File 'lib/deployinator/helpers/view.rb', line 9 def allowed_to_push_to_prod? true end |
#groups ⇒ Object
13 14 15 |
# File 'lib/deployinator/helpers/view.rb', line 13 def groups @groups.join(", ") end |
#log_lines ⇒ Object
30 31 32 |
# File 'lib/deployinator/helpers/view.rb', line 30 def log_lines log_to_hash(:stack => stack) end |
#log_to_hash(opts = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# 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 ⇒ Object
TODO: assimilate with plugin
22 23 24 |
# File 'lib/deployinator/helpers/view.rb', line 22 def logout_url raise_event(:logout_url) end |
#my_entries ⇒ Object
26 27 28 |
# File 'lib/deployinator/helpers/view.rb', line 26 def my_entries log_entries(:stack => stack) end |
#my_url ⇒ Object
17 18 19 |
# File 'lib/deployinator/helpers/view.rb', line 17 def my_url "http://#{@host}" end |
#username ⇒ Object
5 6 7 |
# File 'lib/deployinator/helpers/view.rb', line 5 def username @username end |