Skip to content
Browse files

Removes unused type of diagrams.

  • Loading branch information...
1 parent eafa46e commit 1412b54536f62a8010b603cae895e8e7ccddfa43 @tute committed Nov 26, 2010
Showing with 1 addition and 172 deletions.
  1. +0 −81 lib/railroad/aasm_diagram.rb
  2. +1 −2 lib/railroad/app_diagram.rb
  3. +0 −83 lib/railroad/controllers_diagram.rb
  4. +0 −6 lib/yUMLmeRails.rb
View
81 lib/railroad/aasm_diagram.rb
@@ -1,81 +0,0 @@
-# RailRoad - RoR diagrams generator
-# http://railroad.rubyforge.org
-#
-# Copyright 2007-2008 - Javier Smaldone (http://www.smaldone.com.ar)
-# See COPYING for more details
-
-# AASM code provided by Ana Nelson (http://ananelson.com/)
-
-require 'railroad/app_diagram'
-
-# Diagram for Acts As State Machine
-class AasmDiagram < AppDiagram
-
- def initialize(options)
- #options.exclude.map! {|e| e = "app/models/" + e}
- super options
- @graph.diagram_type = 'Models'
- # Processed habtm associations
- @habtm = []
- end
-
- # Process model files
- def generate
- STDERR.print "Generating AASM diagram\n" if @options.verbose
- files = Dir.glob("app/models/**/*.rb")
- files += Dir.glob("vendor/plugins/**/app/models/*.rb") if @options.plugins_models
- files -= @options.exclude
- files.each do |f|
- process_class extract_class_name(f).constantize
- end
- end
-
- private
-
- # Load model classes
- def load_classes
- begin
- disable_stdout
- files = Dir.glob("app/models/**/*.rb")
- files += Dir.glob("vendor/plugins/**/app/models/*.rb") if @options.plugins_models
- files -= @options.exclude
- files.each {|m| require m }
- enable_stdout
- rescue LoadError
- enable_stdout
- print_error "model classes"
- raise
- end
- end # load_classes
-
- # Process a model class
- def process_class(current_class)
-
- STDERR.print "\tProcessing #{current_class}\n" if @options.verbose
-
- # Only interested in acts_as_state_machine models.
- return unless current_class.respond_to?'states'
-
- node_attribs = []
- node_type = 'aasm'
-
- current_class.states.each do |state_name|
- state = current_class.read_inheritable_attribute(:states)[state_name]
- node_shape = (current_class.initial_state === state_name) ? ", peripheries = 2" : ""
- node_attribs << "#{current_class.name.downcase}_#{state_name} [label=#{state_name} #{node_shape}];"
- end
- @graph.add_node [node_type, current_class.name, node_attribs]
-
- current_class.read_inheritable_attribute(:transition_table).each do |event_name, event|
- event.each do |transition|
- @graph.add_edge [
- 'event',
- current_class.name.downcase + "_" + transition.from.to_s,
- current_class.name.downcase + "_" + transition.to.to_s,
- event_name.to_s
- ]
- end
- end
- end # process_class
-
-end # class AasmDiagram
View
3 lib/railroad/app_diagram.rb
@@ -67,8 +67,7 @@ def enable_stdout
# Print error when loading Rails application
def print_error(type)
- STDERR.print "Error loading #{type}.\n (Are you running " +
- "#{APP_NAME} on the aplication's root directory?)\n\n"
+ STDERR.print "Error loading #{type}.\n\n"
end
# Load Rails application's environment
View
83 lib/railroad/controllers_diagram.rb
@@ -1,83 +0,0 @@
-# RailRoad - RoR diagrams generator
-# http://railroad.rubyforge.org
-#
-# Copyright 2007-2008 - Javier Smaldone (http://www.smaldone.com.ar)
-# See COPYING for more details
-
-require 'railroad/app_diagram'
-
-# RailRoad controllers diagram
-class ControllersDiagram < AppDiagram
-
- def initialize(options)
- #options.exclude.map! {|e| "app/controllers/" + e}
- super options
- @graph.diagram_type = 'Controllers'
- end
-
- # Process controller files
- def generate
- STDERR.print "Generating controllers diagram\n" if @options.verbose
-
- files = Dir.glob("app/controllers/**/*_controller.rb") - @options.exclude
- files << 'app/controllers/application.rb'
- files.each do |f|
- class_name = extract_class_name(f)
- # ApplicationController's file is 'application.rb'
- class_name += 'Controller' if class_name == 'Application'
- process_class class_name.constantize
- end
- end # generate
-
- private
-
- # Load controller classes
- def load_classes
- begin
- disable_stdout
- # ApplicationController must be loaded first
- require "app/controllers/application.rb"
- files = Dir.glob("app/controllers/**/*_controller.rb") - @options.exclude
- files.each {|c| require c }
- enable_stdout
- rescue LoadError
- enable_stdout
- print_error "controller classes"
- raise
- end
- end # load_classes
-
- # Proccess a controller class
- def process_class(current_class)
-
- STDERR.print "\tProcessing #{current_class}\n" if @options.verbose
-
- if @options.brief
- @graph.add_node ['controller-brief', current_class.name]
- elsif current_class.is_a? Class
- # Collect controller's methods
- node_attribs = {:public => [],
- :protected => [],
- :private => []}
- current_class.public_instance_methods(false).sort.each { |m|
- node_attribs[:public] << m
- } unless @options.hide_public
- current_class.protected_instance_methods(false).sort.each { |m|
- node_attribs[:protected] << m
- } unless @options.hide_protected
- current_class.private_instance_methods(false).sort.each { |m|
- node_attribs[:private] << m
- } unless @options.hide_private
- @graph.add_node ['controller', current_class.name, node_attribs]
- elsif @options.modules && current_class.is_a?(Module)
- @graph.add_node ['module', current_class.name]
- end
-
- # Generate the inheritance edge (only for ApplicationControllers)
- if @options.inheritance &&
- (ApplicationController.subclasses.include? current_class.name)
- @graph.add_edge ['is-a', current_class.superclass.name, current_class.name]
- end
- end # process_class
-
-end # class ControllersDiagram
View
6 lib/yUMLmeRails.rb
@@ -1,7 +1,5 @@
require 'ostruct'
require 'railroad/models_diagram'
-#require 'railroad/controllers_diagram'
-#require 'railroad/aasm_diagram'
require 'yUMLmeRails/railtie' if defined?(Rails)
module YUMLmeRails
@@ -31,10 +29,6 @@ def generate_diagram
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

0 comments on commit 1412b54

Please sign in to comment.
Something went wrong with that request. Please try again.