Class: DataMapper::Visualizer::Rake::GraphVizTask
- Defined in:
- lib/dm-visualizer/rake/graphviz_task.rb
Direct Known Subclasses
Constant Summary collapse
- DIAGRAMS =
The types of GraphViz diagrams.
Set[:relational, :schema]
- FORMATS =
The image formats for GraphViz diagrams.
Set[:png, :svg]
Instance Attribute Summary collapse
-
#diagrams ⇒ Object
readonly
The types of diagrams to generate.
-
#formats ⇒ Object
readonly
The formats of the diagrams to generate.
Attributes inherited from Task
Instance Method Summary collapse
-
#define ⇒ Object
Defines the
dm:doc:graphviz
namespace. -
#initialize(options = {}) {|task| ... } ⇒ GraphVizTask
constructor
Creates a new
dm:doc:graphviz
task.
Constructor Details
#initialize(options = {}) {|task| ... } ⇒ GraphVizTask
Creates a new dm:doc:graphviz
task.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 49 def initialize(={},&block) = lambda { |keys| if keys.any? { |key| [key] } keys.select { |key| .delete(key) } else keys end } @diagrams = [DIAGRAMS] @formats = [FORMATS] super(,&block) end |
Instance Attribute Details
#diagrams ⇒ Object (readonly)
The types of diagrams to generate.
18 19 20 |
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 18 def diagrams @diagrams end |
#formats ⇒ Object (readonly)
The formats of the diagrams to generate.
21 22 23 |
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 21 def formats @formats end |
Instance Method Details
#define ⇒ Object
Defines the dm:doc:graphviz
namespace.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 67 def define super do namespace(:graphviz) do @diagrams.each do |type| namespace(type) do @formats.each do |format| desc "Generates a #{format.to_s.upcase} GraphViz #{type} diagram of the DataMapper Models" task(format) do GraphViz.new(@options.merge( :naming => type, :file => "doc/#{type}_diagram", :format => format )).visualize! end end end task(type => @formats.map { |format| "#{type}:#{format}" }) end end task(:graphviz => @diagrams.map { |type| "graphviz:#{type}" }) end end |