ruby-graphviz 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/ChangeLog +4 -0
- data/examples/maketest.sh +16 -16
- data/lib/graphviz.rb +50 -4
- data/lib/graphviz/constants.rb +1 -1
- metadata +2 -2
data/AUTHORS
CHANGED
data/ChangeLog
CHANGED
data/examples/maketest.sh
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
3
|
echo "arrowhead.rb"
|
4
|
-
ruby arrowhead.rb
|
4
|
+
ruby arrowhead.rb
|
5
5
|
echo "HTML-Labels.rb"
|
6
6
|
ruby HTML-Labels.rb
|
7
7
|
echo "p2p.rb"
|
8
|
-
ruby p2p.rb
|
8
|
+
ruby p2p.rb
|
9
9
|
|
10
10
|
echo "sample01.rb"
|
11
|
-
ruby sample01.rb
|
11
|
+
ruby sample01.rb
|
12
12
|
echo "sample02.rb"
|
13
|
-
ruby sample02.rb
|
13
|
+
ruby sample02.rb
|
14
14
|
echo "sample03.rb"
|
15
|
-
ruby sample03.rb
|
15
|
+
ruby sample03.rb
|
16
16
|
echo "sample04.rb"
|
17
|
-
ruby sample04.rb
|
17
|
+
ruby sample04.rb
|
18
18
|
echo "sample05.rb"
|
19
|
-
ruby sample05.rb
|
19
|
+
ruby sample05.rb
|
20
20
|
echo "sample06.rb"
|
21
21
|
ruby sample06.rb
|
22
22
|
echo "sample07.rb"
|
23
|
-
ruby sample07.rb
|
23
|
+
ruby sample07.rb
|
24
24
|
echo "sample08.rb"
|
25
|
-
ruby sample08.rb
|
25
|
+
ruby sample08.rb
|
26
26
|
echo "sample09.rb"
|
27
|
-
ruby sample09.rb
|
27
|
+
ruby sample09.rb
|
28
28
|
echo "sample10.rb"
|
29
|
-
ruby sample10.rb
|
29
|
+
ruby sample10.rb
|
30
30
|
echo "sample11.rb"
|
31
|
-
ruby sample11.rb
|
31
|
+
ruby sample11.rb
|
32
32
|
echo "sample12.rb"
|
33
|
-
ruby sample12.rb
|
33
|
+
ruby sample12.rb
|
34
34
|
echo "sample13.rb"
|
35
35
|
ruby sample13.rb
|
36
36
|
echo "sample14.rb"
|
@@ -59,11 +59,11 @@ echo "sample25.rb"
|
|
59
59
|
ruby sample25.rb
|
60
60
|
|
61
61
|
echo "shapes.rb"
|
62
|
-
ruby shapes.rb
|
62
|
+
ruby shapes.rb
|
63
63
|
echo "testorder.rb"
|
64
|
-
ruby testorder.rb
|
64
|
+
ruby testorder.rb
|
65
65
|
echo "testxml.rb"
|
66
|
-
ruby testxml.rb
|
66
|
+
ruby testxml.rb
|
67
67
|
|
68
68
|
cd dot
|
69
69
|
pwd
|
data/lib/graphviz.rb
CHANGED
@@ -14,6 +14,15 @@
|
|
14
14
|
# along with this program; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
16
16
|
|
17
|
+
|
18
|
+
begin
|
19
|
+
include Java
|
20
|
+
IS_JRUBY = true
|
21
|
+
rescue
|
22
|
+
IS_JRUBY= false
|
23
|
+
end
|
24
|
+
|
25
|
+
|
17
26
|
require 'tempfile'
|
18
27
|
# require 'mkmf'
|
19
28
|
|
@@ -369,6 +378,7 @@ class GraphViz
|
|
369
378
|
else
|
370
379
|
Tempfile::open( File.basename($0) )
|
371
380
|
end
|
381
|
+
|
372
382
|
t.print( xDOTScript )
|
373
383
|
t.close
|
374
384
|
|
@@ -376,7 +386,9 @@ class GraphViz
|
|
376
386
|
if cmd == nil
|
377
387
|
raise StandardError, "GraphViz not installed or #{@prog} not in PATH. Install GraphViz or use the 'path' option"
|
378
388
|
end
|
379
|
-
|
389
|
+
|
390
|
+
cmd = escape_path_containing_blanks(cmd) if IS_JRUBY
|
391
|
+
|
380
392
|
xOutputWithFile = ""
|
381
393
|
xOutputWithoutFile = ""
|
382
394
|
unless @format.nil?
|
@@ -402,7 +414,12 @@ class GraphViz
|
|
402
414
|
|
403
415
|
#xCmd = "#{cmd} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
404
416
|
#if /Windows/.match( ENV['OS'] )
|
417
|
+
|
418
|
+
if IS_JRUBY
|
419
|
+
xCmd = "#{cmd} -q#{@errors} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
420
|
+
else
|
405
421
|
xCmd = "\"#{cmd}\" -q#{@errors} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
422
|
+
end
|
406
423
|
#end
|
407
424
|
|
408
425
|
output_from_command( xCmd )
|
@@ -419,7 +436,7 @@ class GraphViz
|
|
419
436
|
end
|
420
437
|
|
421
438
|
alias :save :output
|
422
|
-
|
439
|
+
|
423
440
|
def output_and_errors_from_command(cmd) #:nodoc:
|
424
441
|
unless defined? Open3
|
425
442
|
begin
|
@@ -431,10 +448,12 @@ class GraphViz
|
|
431
448
|
begin
|
432
449
|
Open3.popen3( cmd ) do |stdin, stdout, stderr|
|
433
450
|
stdin.close
|
451
|
+
stdout.binmode
|
434
452
|
[stdout.read, stderr.read]
|
435
453
|
end
|
436
454
|
rescue NotImplementedError, NoMethodError
|
437
455
|
IO.popen( cmd ) do |stdout|
|
456
|
+
stdout.binmode
|
438
457
|
[stdout.read, nil]
|
439
458
|
end
|
440
459
|
end
|
@@ -660,7 +679,7 @@ class GraphViz
|
|
660
679
|
# purpose with or without fee is hereby granted, provided that the above
|
661
680
|
# copyright notice and this permission notice appear in all copies.
|
662
681
|
#
|
663
|
-
# THE SOFTWARE IS PROVIDED
|
682
|
+
# THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
664
683
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
665
684
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
666
685
|
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
@@ -668,14 +687,41 @@ class GraphViz
|
|
668
687
|
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
669
688
|
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
670
689
|
def find_executable(bin = @prog, *paths) #:nodoc:
|
690
|
+
|
671
691
|
paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
|
672
692
|
paths.each do |path|
|
673
|
-
file = File.join(path,bin)
|
693
|
+
file = File.join(path, add_exe_suffix(bin))
|
674
694
|
if File.executable?(file) then
|
675
695
|
return file
|
676
696
|
end
|
677
697
|
end
|
678
698
|
return nil
|
679
699
|
end
|
700
|
+
|
701
|
+
|
702
|
+
def add_exe_suffix(prog)
|
703
|
+
if /Windows/.match( ENV['OS'] )
|
704
|
+
suffix = '.exe'
|
705
|
+
else
|
706
|
+
suffix = ''
|
707
|
+
end
|
708
|
+
"#{prog}#{suffix}"
|
709
|
+
end
|
710
|
+
|
711
|
+
|
712
|
+
def escape_path_containing_blanks(path)
|
713
|
+
path.gsub!(File::ALT_SEPARATOR, File::SEPARATOR)
|
714
|
+
path_elements = path.split(File::SEPARATOR)
|
715
|
+
path_elements.map! do |element|
|
716
|
+
if element.include?(' ')
|
717
|
+
"\"#{element}\""
|
718
|
+
else
|
719
|
+
element
|
720
|
+
end
|
721
|
+
end
|
722
|
+
path_elements.join(File::SEPARATOR)
|
723
|
+
end
|
724
|
+
|
725
|
+
|
680
726
|
end
|
681
727
|
|
data/lib/graphviz/constants.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-graphviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregoire Lejeune
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-05 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|