ruby-graphviz 0.9.6 → 0.9.7
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/AUTHORS +1 -0
- data/{ChangeLog → ChangeLog.rdoc} +6 -0
- data/examples/sample27.rb +8 -0
- data/lib/graphviz/constants.rb +1 -1
- data/lib/graphviz.rb +26 -37
- metadata +5 -4
data/AUTHORS
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.9.7 :
|
2
|
+
* Issue #2: Small bug correction in escape_path_containing_blanks (by Andreas Ronge)
|
3
|
+
* Issue #4: New find_executable (by reactive)
|
4
|
+
* Issue #3: Tempfiles created in current working directory only in Windows
|
5
|
+
* Issue #6: Respect "none" format in output options hash and respect String output-filename when the "none" format is selected. See examples/sample27.rb (by Dave Burt)
|
6
|
+
|
1
7
|
0.9.6 :
|
2
8
|
* jRuby support (by obruening)
|
3
9
|
* Issue #1 : STDOUT in binmode
|
data/lib/graphviz/constants.rb
CHANGED
data/lib/graphviz.rb
CHANGED
@@ -22,9 +22,7 @@ rescue
|
|
22
22
|
IS_JRUBY= false
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
25
|
require 'tempfile'
|
27
|
-
# require 'mkmf'
|
28
26
|
|
29
27
|
require 'graphviz/node'
|
30
28
|
require 'graphviz/edge'
|
@@ -370,15 +368,15 @@ class GraphViz
|
|
370
368
|
|
371
369
|
xDOTScript = "#{@oGraphType} #{@name} {\n" << xDOTScript
|
372
370
|
|
373
|
-
xOutputString =
|
374
|
-
|
371
|
+
xOutputString = (@filename == String ||
|
372
|
+
@output.any? {|format, file| file == String })
|
373
|
+
|
374
|
+
xOutput =
|
375
|
+
if @format.to_s == "none" || @output.any? {|fmt, fn| fmt.to_s == "none" }
|
376
|
+
xDOTScript
|
377
|
+
else
|
375
378
|
## Act: Save script and send it to dot
|
376
|
-
t =
|
377
|
-
Tempfile::open( File.basename($0), "." )
|
378
|
-
else
|
379
|
-
Tempfile::open( File.basename($0) )
|
380
|
-
end
|
381
|
-
|
379
|
+
t = Tempfile::open( File.basename($0) )
|
382
380
|
t.print( xDOTScript )
|
383
381
|
t.close
|
384
382
|
|
@@ -392,39 +390,27 @@ class GraphViz
|
|
392
390
|
xOutputWithFile = ""
|
393
391
|
xOutputWithoutFile = ""
|
394
392
|
unless @format.nil?
|
395
|
-
if @filename.nil?
|
396
|
-
xOutputWithoutFile = "-T#{@format} "
|
397
|
-
elsif @filename == String
|
393
|
+
if @filename.nil? || @filename == String
|
398
394
|
xOutputWithoutFile = "-T#{@format} "
|
399
|
-
xOutputString = true
|
400
395
|
else
|
401
396
|
xOutputWithFile = "-T#{@format} -o#{@filename} "
|
402
397
|
end
|
403
398
|
end
|
404
399
|
@output.each do |format, file|
|
405
|
-
if file.nil?
|
400
|
+
if file.nil? || file == String
|
406
401
|
xOutputWithoutFile << "-T#{format} "
|
407
|
-
elsif file == String
|
408
|
-
xOutputWithoutFile << "-T#{format} "
|
409
|
-
xOutputString = true
|
410
402
|
else
|
411
403
|
xOutputWithFile << "-T#{format} -o#{file} "
|
412
404
|
end
|
413
405
|
end
|
414
406
|
|
415
|
-
#xCmd = "#{cmd} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
416
|
-
#if /Windows/.match( ENV['OS'] )
|
417
|
-
|
418
407
|
if IS_JRUBY
|
419
408
|
xCmd = "#{cmd} -q#{@errors} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
420
409
|
else
|
421
410
|
xCmd = "\"#{cmd}\" -q#{@errors} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
|
422
411
|
end
|
423
|
-
#end
|
424
412
|
|
425
413
|
output_from_command( xCmd )
|
426
|
-
else
|
427
|
-
xDOTScript
|
428
414
|
end
|
429
415
|
|
430
416
|
if xOutputString
|
@@ -662,15 +648,6 @@ class GraphViz
|
|
662
648
|
end
|
663
649
|
end
|
664
650
|
|
665
|
-
# def find_executable( ) #:nodoc:
|
666
|
-
# cmd = find_executable0( @prog )
|
667
|
-
# if cmd == nil and @path != nil
|
668
|
-
# __cmd = File.join( @path, @prog )
|
669
|
-
# cmd = __cmd if File.executable?( __cmd )
|
670
|
-
# end
|
671
|
-
# return cmd
|
672
|
-
# end
|
673
|
-
|
674
651
|
# Since this code is an adaptation of Launchy::Application#find_executable
|
675
652
|
# (http://copiousfreetime.rubyforge.org/launchy/Launchy/Application.html)
|
676
653
|
# it follow is licence :
|
@@ -687,17 +664,29 @@ class GraphViz
|
|
687
664
|
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
688
665
|
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
689
666
|
def find_executable(bin = @prog, *paths) #:nodoc:
|
690
|
-
|
691
667
|
paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
|
692
668
|
paths.each do |path|
|
693
|
-
file = File.join(path,
|
669
|
+
file = File.join(path,bin)
|
694
670
|
if File.executable?(file) then
|
695
671
|
return file
|
672
|
+
elsif RUBY_PLATFORM =~ /mswin|mingw/
|
673
|
+
found_ext = (ENV['PATHEXT'] || '.exe;.bat;.com').split(";").find {|ext| File.executable?(file + ext) }
|
674
|
+
return file + found_ext if found_ext
|
696
675
|
end
|
697
676
|
end
|
698
677
|
return nil
|
699
678
|
end
|
700
|
-
|
679
|
+
# def find_executable(bin = @prog, *paths) #:nodoc:
|
680
|
+
#
|
681
|
+
# paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
|
682
|
+
# paths.each do |path|
|
683
|
+
# file = File.join(path, add_exe_suffix(bin))
|
684
|
+
# if File.executable?(file) then
|
685
|
+
# return file
|
686
|
+
# end
|
687
|
+
# end
|
688
|
+
# return nil
|
689
|
+
# end
|
701
690
|
|
702
691
|
def add_exe_suffix(prog)
|
703
692
|
if /Windows/.match( ENV['OS'] )
|
@@ -710,7 +699,7 @@ class GraphViz
|
|
710
699
|
|
711
700
|
|
712
701
|
def escape_path_containing_blanks(path)
|
713
|
-
path.gsub!(File::ALT_SEPARATOR, File::SEPARATOR)
|
702
|
+
path.gsub!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
|
714
703
|
path_elements = path.split(File::SEPARATOR)
|
715
704
|
path_elements.map! do |element|
|
716
705
|
if element.include?(' ')
|
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.7
|
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-
|
12
|
+
date: 2009-12-21 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,11 +30,11 @@ extensions: []
|
|
30
30
|
|
31
31
|
extra_rdoc_files:
|
32
32
|
- README.rdoc
|
33
|
-
- ChangeLog
|
33
|
+
- ChangeLog.rdoc
|
34
34
|
- COPYING
|
35
35
|
- AUTHORS
|
36
36
|
files:
|
37
|
-
- ChangeLog
|
37
|
+
- ChangeLog.rdoc
|
38
38
|
- COPYING
|
39
39
|
- README.rdoc
|
40
40
|
- AUTHORS
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- examples/sample24.rb
|
88
88
|
- examples/sample25.rb
|
89
89
|
- examples/sample26.rb
|
90
|
+
- examples/sample27.rb
|
90
91
|
- examples/shapes.rb
|
91
92
|
- examples/test.xml
|
92
93
|
- examples/testorder.rb
|