Class: DataMapper::Visualizer::Rake::GraphVizTask

Inherits:
Task
  • Object
show all
Defined in:
lib/dm-visualizer/rake/graphviz_task.rb

Direct Known Subclasses

Rails::GraphVizTask

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|task| ... } ⇒ GraphVizTask

Creates a new dm:doc:graphviz task.

Parameters:

  • options (Hash) (defaults to: {})

    Additional options.

Yields:

  • (task)

    The given block will be passed the newly created task.

Yield Parameters:

See Also:

  • GraphViz.new


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 29

def initialize(options={})
  @relational = GraphViz.new(options.merge(
    :naming => :relational,
    :file => 'doc/relational_diagram'
  ))

  @schema = GraphViz.new(options.merge(
    :naming => :schema,
    :file => 'doc/schema_diagram'
  ))

  super
end

Instance Attribute Details

#relationalObject (readonly)

The relational diagram GraphViz visualizer



10
11
12
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 10

def relational
  @relational
end

#schemaObject (readonly)

The schema diagram GraphViz visualizer



13
14
15
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 13

def schema
  @schema
end

Instance Method Details

#defineObject

Defines the dm:doc:graphviz namespace.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/dm-visualizer/rake/graphviz_task.rb', line 46

def define
  super do
    namespace :graphviz do
      desc 'Generates a GraphViz relational diagram of the DataMapper Models'
      task :relational do
        @relational.visualize!
      end

      desc 'Generates a GraphViz schema diagram of the DataMapper Models'
      task :schema do
        @schema.visualize!
      end
    end

    task :graphviz => ['graphviz:relational', 'graphviz:schema']
  end
end