Permalink
Browse files

Added simple HTML wrapping

 - precursor to full mailing support
  • Loading branch information...
1 parent fb62c01 commit 871a0d329c2232e38f8ab8a3abc372dda7cd456c @jamesc jamesc committed Jul 6, 2011
Showing with 15 additions and 3 deletions.
  1. +15 −3 rotation-report.rb
View
@@ -65,6 +65,11 @@
options[:campfire_message] = true
end
+ options[:html] = false
+ opts.on('--html', "HTML Output") do
+ options[:html] = true
+ end
+
opts.on('-h', '--help', 'Display this message') do
puts opts
exit
@@ -221,7 +226,12 @@ def collect_alerts(pagerduty, alerts, year, month)
#
# Header
-report = "Rotation report for #{current_start.strftime("%B %d")} - "
+report = ""
+if options[:html]
+ report << "<html><body><pre>\n"
+end
+
+report << "Rotation report for #{current_start.strftime("%B %d")} - "
report << "#{current_end.strftime("%B %d")}:\n"
# Incident volume
@@ -245,13 +255,15 @@ def collect_alerts(pagerduty, alerts, year, month)
# Top triggers
report << "Top triggers:\n"
-trigger_report = triggers.map do |trigger, count|
+trigger_report = triggers.map do |trigger, count|
trigger_change = Report.pct_change(incidents.previous_count {|incident| incident.trigger_name == trigger }, count)
" #{count} \'#{trigger}\' (#{trigger_change})"
end
report << trigger_report.take(5).join("\n")
report << "\n"
-
+if options[:html]
+ report << "</pre></body></html>"
+end
#
# Report output
#

0 comments on commit 871a0d3

Please sign in to comment.