code_node 0.1.3 → 0.1.4
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.
- data/Cogfile +15 -0
- data/lib/code_node/graph_builder.rb +4 -6
- data/lib/code_node/version.rb +1 -1
- data/{cog/templates → templates}/code_node/generator.rb.erb +0 -4
- data/{cog/templates → templates}/code_node/graph.dot.erb +0 -0
- data/{cog/templates → templates}/code_node/node.dot.erb +0 -0
- metadata +8 -8
- data/lib/code_node/cog_tool.rb +0 -13
data/Cogfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# All paths are relative to the directory containing this file.
|
2
|
+
|
3
|
+
stamp_generator do |name, dest|
|
4
|
+
@name = name
|
5
|
+
stamp 'code_node/generator.rb', dest, :absolute_destination => true
|
6
|
+
end
|
7
|
+
|
8
|
+
autoload_plugin :CodeNode, 'lib/code_node'
|
9
|
+
|
10
|
+
# Define a directory in which to find generators
|
11
|
+
generator_path 'generators'
|
12
|
+
|
13
|
+
# Define a directory in which to find templates
|
14
|
+
template_path 'templates'
|
15
|
+
|
@@ -6,6 +6,8 @@ module CodeNode
|
|
6
6
|
# Helps to build an {IR::Graph}
|
7
7
|
class GraphBuilder
|
8
8
|
|
9
|
+
include Cog::Generator
|
10
|
+
|
9
11
|
# @return [IR::Graph] the graph being built
|
10
12
|
attr_reader :graph
|
11
13
|
|
@@ -20,7 +22,7 @@ module CodeNode
|
|
20
22
|
|
21
23
|
# @return [Array<String>] paths to ruby source files
|
22
24
|
def sources
|
23
|
-
Dir.glob("#{Cog.
|
25
|
+
Dir.glob("#{Cog.project_path}/**/*.rb")
|
24
26
|
end
|
25
27
|
|
26
28
|
# Define the custom graph generation rules
|
@@ -67,11 +69,7 @@ module CodeNode
|
|
67
69
|
# Render the graph
|
68
70
|
# @return [nil]
|
69
71
|
def render
|
70
|
-
|
71
|
-
# so that cog will be able to find code_node templates
|
72
|
-
Cog.activate_tool 'code_node' do
|
73
|
-
stamp 'code_node/graph.dot', "#{@name}.dot"
|
74
|
-
end
|
72
|
+
stamp 'code_node/graph.dot', "#{@name}.dot"
|
75
73
|
nil
|
76
74
|
end
|
77
75
|
|
data/lib/code_node/version.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
<% if Cog.active_tool.explicit_require %>require '<%= Cog.active_tool.path %>'
|
2
|
-
<% else %>require '<%= Cog.active_tool.name %>'
|
3
|
-
<% end %>
|
4
|
-
|
5
1
|
# Makes a graph of the project_source_path.
|
6
2
|
# Nodes in the graph are clases and modules from your project.
|
7
3
|
CodeNode.graph '<%= @name %>' do |g|
|
File without changes
|
File without changes
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
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-12-
|
18
|
+
date: 2012-12-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: cog
|
@@ -111,10 +111,10 @@ extra_rdoc_files: []
|
|
111
111
|
|
112
112
|
files:
|
113
113
|
- LICENSE
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
114
|
+
- Cogfile
|
115
|
+
- templates/code_node/generator.rb.erb
|
116
|
+
- templates/code_node/graph.dot.erb
|
117
|
+
- templates/code_node/node.dot.erb
|
118
118
|
- lib/code_node/dsl/graph_definer.rb
|
119
119
|
- lib/code_node/dsl.rb
|
120
120
|
- lib/code_node/graph_builder.rb
|
data/lib/code_node/cog_tool.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'cog'
|
2
|
-
include Cog::Generator
|
3
|
-
|
4
|
-
# Register code_node as a tool with cog
|
5
|
-
Cog.register_tool __FILE__ do |tool|
|
6
|
-
|
7
|
-
# Define how new code_node generators are created
|
8
|
-
tool.stamp_generator do |name, dest|
|
9
|
-
@name = name
|
10
|
-
stamp 'code_node/generator.rb', dest, :absolute_destination => true
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|