Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved things around to create Rake tasks

  • Loading branch information...
commit 49e55644132d1d833634ba49960e9a06001c3f8f 1 parent 21f56ce
@nelsonsilva authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+*~
+shoes2.run
View
1  init.rb
@@ -0,0 +1 @@
+require File.join(File.dirname(__FILE__), "lib", "yUMLmeRails")
View
0  railroad/aasm_diagram.rb → lib/railroad/aasm_diagram.rb
File renamed without changes
View
2  railroad/app_diagram.rb → lib/railroad/app_diagram.rb
@@ -9,6 +9,8 @@
# Root class for RailRoad diagrams
class AppDiagram
+ attr :graph
+
def initialize(options)
@options = options
@graph = DiagramGraph.new
View
0  railroad/controllers_diagram.rb → lib/railroad/controllers_diagram.rb
File renamed without changes
View
2  railroad/diagram_graph.rb → lib/railroad/diagram_graph.rb
@@ -79,7 +79,7 @@ def to_yuml
end
"[#{from}]#{association}[#{to}]"
}
- "http://yuml.me/diagram/scruffy/class/" << parts.join(",")
+ parts.join(",")
end
private
View
0  railroad/models_diagram.rb → lib/railroad/models_diagram.rb
File renamed without changes
View
0  railroad/options_struct.rb → lib/railroad/options_struct.rb
File renamed without changes
View
0  railroad/uml_dumper.rb → lib/railroad/uml_dumper.rb
File renamed without changes
View
5 lib/shoes_app.rb
@@ -0,0 +1,5 @@
+require "yUMLmeRails"
+
+Shoes.app do
+ image "http://yuml.me/diagram/scruffy/class/" << YUMLmeRails.generate_diagram
+end
View
49 lib/yUMLmeRails.rb
@@ -0,0 +1,49 @@
+APP_NAME = "railroad"
+APP_HUMAN_NAME = "RailRoad"
+APP_VERSION = [0,5,0]
+COPYRIGHT = "Copyright (C) 2007-2008 Javier Smaldone"
+
+require 'ostruct'
+require 'railroad/models_diagram'
+#require 'railroad/controllers_diagram'
+#require 'railroad/aasm_diagram'
+
+class YUMLmeRails
+ class << self
+ def generate_diagram
+ options = OpenStruct.new(
+ :all => true,
+ :brief => true,
+ :exclude => [],
+ :inheritance => false,
+ :join => false,
+ :label => false,
+ :modules => false,
+ :hide_magic => false,
+ :hide_types => false,
+ :hide_public => false,
+ :hide_protected => false,
+ :hide_private => false,
+ :plugins_models => false,
+ :root => '',
+ :transitive => true,
+ :verbose => false,
+ :xmi => false,
+ :yuml => true,
+ :command => 'models'
+ )
+
+
+ if options.command == 'models'
+ diagram = ModelsDiagram.new options
+ #elsif options.command == 'controllers'
+ # diagram = ControllersDiagram.new options
+ #elsif options.command == 'aasm'
+ # diagram = AasmDiagram.new options
+ end
+
+ diagram.generate
+ diagram.graph.to_yuml
+ end
+ end
+end
View
24 tasks/yUMLmeRails.rake
@@ -0,0 +1,24 @@
+namespace :yUMLmeRails do
+ desc "Show model diagram"
+ task :app do
+ system "shoes app.rb"
+ end
+
+ desc "Get yUML URL"
+ task :model_diagram_url => :environment do
+ puts "http://yuml.me/diagram/scruffy/class/" << YUMLmeRails.generate_diagram
+ end
+
+ desc "Download yUML model diagram"
+ task :model_diagram => :environment do
+ url="http://yuml.me/diagram/scruffy/class/" << YUMLmeRails.generate_diagram
+ DIR="diagrams"
+ FileUtils.mkdir_p DIR
+ filename="#{DIR}/model_" << Time.new.strftime("%b_%d_%Y") << ".png"
+ system "wget -O #{filename} #{url}"
+ # TODO - Make the following work
+ #require 'open-uri'
+ #open(, "wb").
+ # write(open("http://yuml.me/diagram/scruffy/class/" << YUMLmeRails.generate_diagram))
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.