GraphvizR 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +10 -0
- data/README.txt +16 -1
- data/lib/graphviz_r.rb +1 -1
- data/vendor/plugins/rdot/README +4 -0
- data/vendor/plugins/rdot/Rakefile +22 -0
- data/vendor/plugins/rdot/init.rb +1 -0
- data/vendor/plugins/rdot/install.rb +1 -0
- data/vendor/plugins/rdot/lib/rdot.rb +23 -0
- data/vendor/plugins/rdot/tasks/rdot_tasks.rake +4 -0
- data/vendor/plugins/rdot/test/rdot_test.rb +8 -0
- metadata +11 -1
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -5,3 +5,13 @@ Rakefile
|
|
5
5
|
bin/graphviz_r
|
6
6
|
lib/graphviz_r.rb
|
7
7
|
test/test_graphviz_r.rb
|
8
|
+
vendor/plugins/rdot
|
9
|
+
vendor/plugins/rdot/lib
|
10
|
+
vendor/plugins/rdot/lib/rdot.rb
|
11
|
+
vendor/plugins/rdot/tasks
|
12
|
+
vendor/plugins/rdot/tasks/rdot_tasks.rake
|
13
|
+
vendor/plugins/rdot/test/rdot_test.rb
|
14
|
+
vendor/plugins/rdot/README
|
15
|
+
vendor/plugins/rdot/Rakefile
|
16
|
+
vendor/plugins/rdot/init.rb
|
17
|
+
vendor/plugins/rdot/install.rb
|
data/README.txt
CHANGED
@@ -14,7 +14,7 @@ Generate Graphviz dot file.
|
|
14
14
|
|
15
15
|
=== Command Line:
|
16
16
|
|
17
|
-
graphviz_r sample/record.rdot
|
17
|
+
bin/graphviz_r sample/record.rdot
|
18
18
|
|
19
19
|
=== In Your Code:
|
20
20
|
This ruby code:
|
@@ -39,6 +39,19 @@ replies the dot code:
|
|
39
39
|
|
40
40
|
To know more detail, please see test/test_graphviz_r.rb
|
41
41
|
|
42
|
+
=== In Your Rails Controller:
|
43
|
+
|
44
|
+
render :rdot do
|
45
|
+
graph [:size => '1.5, 2.5']
|
46
|
+
node [:shape => :record]
|
47
|
+
node1 [:label => "<p_left> left|<p_center>center|<p_right> right"]
|
48
|
+
node2 [:label => "left|center|right"]
|
49
|
+
node1 >> node2
|
50
|
+
node1(:p_left) >> node2
|
51
|
+
node2 >> node1(:p_center)
|
52
|
+
(node2 >> node1(:p_right)) [:label => 'record']
|
53
|
+
end
|
54
|
+
|
42
55
|
== DEPENDENCIES:
|
43
56
|
|
44
57
|
* Graphviz (http://www.graphviz.org/)
|
@@ -50,6 +63,8 @@ To know more detail, please see test/test_graphviz_r.rb
|
|
50
63
|
== INSTALL:
|
51
64
|
|
52
65
|
* sudo gem install graphviz_r
|
66
|
+
* if you want to use this in ruby on rails
|
67
|
+
* script/plugin install http://technohippy.net/svn/repos/graphviz_r/trunk/vendor/plugins/rdot
|
53
68
|
|
54
69
|
== LICENSE:
|
55
70
|
|
data/lib/graphviz_r.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the rdot plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.pattern = 'test/**/*_test.rb'
|
12
|
+
t.verbose = true
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Generate documentation for the rdot plugin.'
|
16
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'Rdot'
|
19
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
20
|
+
rdoc.rdoc_files.include('README')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'rdot'
|
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'graphviz_r'
|
2
|
+
|
3
|
+
class ActionController::Base
|
4
|
+
def render_with_rdot(options = nil, deprecated_status = nil, &block)
|
5
|
+
if options == :rdot
|
6
|
+
render_rdot deprecated_status, &block
|
7
|
+
else
|
8
|
+
render_without_rdot options, deprecated_status, &block
|
9
|
+
end
|
10
|
+
end
|
11
|
+
#alias_method_chain :render, :rdot
|
12
|
+
alias_method :render_without_rdot, :render
|
13
|
+
alias_method :render, :render_with_rdot
|
14
|
+
|
15
|
+
def render_rdot(options=nil, &block)
|
16
|
+
options ||= {}
|
17
|
+
format = options[:format] || 'png'
|
18
|
+
content_type = format == 'svg' ? 'application/xml' : "image/#{format}"
|
19
|
+
gvr = GraphvizR.new 'generated'
|
20
|
+
gvr.instance_eval &block
|
21
|
+
send_data gvr.data(format), :type => content_type #,disposition => 'inline'
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: GraphvizR
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
6
|
+
version: 0.2.0
|
7
7
|
date: 2007-02-15 00:00:00 +09:00
|
8
8
|
summary: The author was too lazy to write a summary
|
9
9
|
require_paths:
|
@@ -37,6 +37,16 @@ files:
|
|
37
37
|
- bin/graphviz_r
|
38
38
|
- lib/graphviz_r.rb
|
39
39
|
- test/test_graphviz_r.rb
|
40
|
+
- vendor/plugins/rdot
|
41
|
+
- vendor/plugins/rdot/lib
|
42
|
+
- vendor/plugins/rdot/lib/rdot.rb
|
43
|
+
- vendor/plugins/rdot/tasks
|
44
|
+
- vendor/plugins/rdot/tasks/rdot_tasks.rake
|
45
|
+
- vendor/plugins/rdot/test/rdot_test.rb
|
46
|
+
- vendor/plugins/rdot/README
|
47
|
+
- vendor/plugins/rdot/Rakefile
|
48
|
+
- vendor/plugins/rdot/init.rb
|
49
|
+
- vendor/plugins/rdot/install.rb
|
40
50
|
test_files:
|
41
51
|
- test/test_graphviz_r.rb
|
42
52
|
rdoc_options: []
|