Skip to content

Commit

Permalink
Added task to export organizational data in GraphViz format
Browse files Browse the repository at this point in the history
  • Loading branch information
cthielen committed Feb 27, 2014
1 parent 60acd3a commit c7032b4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/initializers/last_updated.rb
@@ -1 +1 @@
LAST_UPDATED = 'Wed Feb 26 11:41:01 PST 2014'
LAST_UPDATED = 'Wed Feb 26 16:27:37 PST 2014'
19 changes: 19 additions & 0 deletions lib/tasks/organization_tasks.rake
Expand Up @@ -270,5 +270,24 @@ namespace :organization do

puts "#{org_count} organization(s) dropped."
end

desc 'Generate a GraphViz-compatible output to STDOUT'
task :graphviz => :environment do
Authorization.ignore_access_control(true)

puts "digraph unix {"
puts "\tsize=\"6,6\";"
puts "\tnode [color=lightblue2, style=filled];"

Organization.all.each do |org|
org.child_organizations.each do |child|
puts "\t\"#{org.id}:#{org.name}\" -> \"#{child.id}:#{child.name}\";"
end
end

puts "}"

Authorization.ignore_access_control(false)
end
end

0 comments on commit c7032b4

Please sign in to comment.