Skip to content

Commit

Permalink
Add rake and method to send all reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
quirkey committed Dec 21, 2011
1 parent cd01bdb commit 4454b6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Rakefile
Expand Up @@ -28,4 +28,9 @@ namespace :graphiti do
puts "Got #{list.length} metrics"
end

desc 'Send email reports per dashboard. Needs `reports` settings in settings.yml'
task :send_reports do
Dashboard.send_reports
end

end
8 changes: 7 additions & 1 deletion lib/dashboard.rb
Expand Up @@ -86,7 +86,7 @@ def self.snapshot_graphs(slug)
snapshots
end

def self.send_report(slug)
def self.send_report(dashboard)
dashboard = find(slug, true)
if dashboard
graphs = snapshot_graphs(slug)
Expand All @@ -104,4 +104,10 @@ def self.send_report(slug)
end
end

def self.send_reports
Dashboard.all.each do |dashboard|
send_report(dashboard['slug'])
end
end

end

0 comments on commit 4454b6f

Please sign in to comment.