code_node 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,13 @@
1
1
  require 'cog'
2
+ include Cog::Generator
2
3
 
3
4
  # Register code_node as a tool with cog
4
- Cog::Config.instance.register_tool __FILE__ do |tool|
5
+ Cog.register_tool __FILE__ do |tool|
5
6
 
6
7
  # Define how new code_node generators are created
7
- #
8
- # Add context as required by your generator template.
9
- #
10
- # When the block is executed, +self+ will be an instance of Cog::Config::Tool::GeneratorStamper
11
- tool.stamp_generator do
12
- stamp 'code_node/generator.rb', generator_dest, :absolute_destination => true
8
+ tool.stamp_generator do |name, dest|
9
+ @name = name
10
+ stamp 'code_node/generator.rb', dest, :absolute_destination => true
13
11
  end
14
12
 
15
13
  end
@@ -1,5 +1,5 @@
1
1
  module Code_node
2
2
  unless const_defined? :VERSION
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
data/lib/code_node.rb CHANGED
@@ -16,7 +16,7 @@ module CodeNode
16
16
  # @yield [GraphDefinition] define rules for creating the graph
17
17
  def self.graph(graph_name, opt={}, &block)
18
18
  feedback_color = :white
19
- root = Cog::Config.instance.project_source_path
19
+ root = Cog.project_source_path
20
20
  @graph = IR::Graph.new
21
21
  graph_definer = DSL::GraphDefiner.new @graph
22
22
  block.call graph_definer
@@ -60,7 +60,7 @@ module CodeNode
60
60
 
61
61
  # Activate code_node while rendering templates
62
62
  # so that cog will be able to find code_node templates
63
- Cog::Config.instance.activate_tool 'code_node' do
63
+ Cog.activate_tool 'code_node' do
64
64
  stamp 'code_node/graph.dot', "#{graph_name}.dot"
65
65
  end
66
66
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_node
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kevin Tonon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-27 00:00:00 Z
18
+ date: 2012-12-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: cog
@@ -111,7 +111,6 @@ extra_rdoc_files: []
111
111
 
112
112
  files:
113
113
  - LICENSE
114
- - cog/generators/overview.rb
115
114
  - cog/templates/code_node/generator.rb.erb
116
115
  - cog/templates/code_node/graph.dot.erb
117
116
  - cog/templates/code_node/node.dot.erb
@@ -1,49 +0,0 @@
1
- require '/Users/kevin/bc/code_node/lib/code_node.rb'
2
-
3
- # Makes a graph of the project_source_path.
4
- # Nodes in the graph are clases and modules from your project.
5
- CodeNode.graph 'overview' do |g|
6
-
7
- # Nodes
8
- # =====
9
-
10
- # Ignore nodes with no relations to other nodes
11
- g.ignore &:island?
12
-
13
- # Uncomment and change the value to ignore a specific node
14
- # g.ignore 'Foo::Bar::Car'
15
-
16
- # Uncomment to ignore nodes named ClassMethods
17
- # g.ignore /::ClassMethods$/
18
-
19
- # Uncomment and change the value to ignore all nodes descending
20
- # from a specific node
21
- # g.ignore {|node| node.inherits_from? 'Foo::Bar::Car'}
22
-
23
- # Apply styles common to all classes
24
- g.style :shape => 'ellipse', :fillcolor => '#cccccc', :fontcolor => :black do |node|
25
- node.class?
26
- end
27
-
28
- # Apply styles common to all nodes
29
- g.style :shape => 'box', :fillcolor => '#333333', :fontcolor => :white do |node|
30
- node.module?
31
- end
32
-
33
- # Apply more specific style here
34
- # ...
35
-
36
- # Edges
37
- # =====
38
- #
39
- # There is currently no way to style edges from the DSL.
40
- # For now, there are only four categories of edges:
41
- # - containment
42
- # - inheritance
43
- # - inclusion
44
- # - extension
45
- #
46
- # They are style in the template. You can override the template
47
- # and change the color if you like.
48
- # $ cog -t code_node template new -f code_node/graph.dot
49
- end