Skip to content
Browse files

Added task to export organizational data in GraphViz format

  • Loading branch information...
1 parent 60acd3a commit c7032b43306571cc08b9a1b311c0dc927fa6e584 @cthielen cthielen committed
Showing with 20 additions and 1 deletion.
  1. +1 −1 config/initializers/last_updated.rb
  2. +19 −0 lib/tasks/organization_tasks.rake
View
2 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'
View
19 lib/tasks/organization_tasks.rake
@@ -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.
Something went wrong with that request. Please try again.