ruby-graphviz 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS CHANGED
@@ -1,6 +1,7 @@
1
1
  Gregoire Lejeune <glejeune.lejeune@free.fr>
2
2
  Brandon Coleman <metrix1978@gmail.com>
3
3
  Dave Burt <http://github.com/dburt>
4
+ Miguel Cabrera <http://mfcabrera.com>
4
5
 
5
6
  Thanks to :
6
7
 
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 0.9.5 :
2
+ * Remove 'mkmf' dependency
3
+ * GraphViz::Edge#[] modification
4
+ * Small correction to escape the dot ('.') character (by Miguel Cabrera)
5
+
1
6
  0.9.4 :
2
7
  * Escape nodes and edges attributs
3
8
  * GraphViz::escape corrections (by Dave Burt)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ GraphViz.new(:G){ |g|
7
+ (g.hello - g.world) [:style => :bold, :label => " axgle says"]
8
+ }.save( :png => "#{$0}.png" )
data/lib/graphviz.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
  require 'tempfile'
18
- require 'mkmf'
18
+ # require 'mkmf'
19
19
 
20
20
  require 'graphviz/node'
21
21
  require 'graphviz/edge'
@@ -636,20 +636,46 @@ class GraphViz
636
636
  # Escape a string to be acceptable as a node name in a graphviz input file
637
637
  #
638
638
  def self.escape(str, force = false) #:nodoc:
639
- if force or str.match( /\A[a-zA-Z_]+[a-zA-Z0-9_:\.]*\Z/ ).nil?
640
- '"' + str.gsub('"', '\\"').gsub("\n", '\\\\n') + '"'
639
+ if force or str.match( /\A[a-zA-Z_]+[a-zA-Z0-9_:]*\Z/ ).nil?
640
+ '"' + str.gsub('"', '\\"').gsub("\n", '\\\\n').gsub(".","\\.") + '"'
641
641
  else
642
642
  str
643
643
  end
644
644
  end
645
645
 
646
- def find_executable( ) #:nodoc:
647
- cmd = find_executable0( @prog )
648
- if cmd == nil and @path != nil
649
- __cmd = File.join( @path, @prog )
650
- cmd = __cmd if File.executable?( __cmd )
646
+ # def find_executable( ) #:nodoc:
647
+ # cmd = find_executable0( @prog )
648
+ # if cmd == nil and @path != nil
649
+ # __cmd = File.join( @path, @prog )
650
+ # cmd = __cmd if File.executable?( __cmd )
651
+ # end
652
+ # return cmd
653
+ # end
654
+
655
+ # Since this code is an adaptation of Launchy::Application#find_executable
656
+ # (http://copiousfreetime.rubyforge.org/launchy/Launchy/Application.html)
657
+ # it follow is licence :
658
+ #
659
+ # Permission to use, copy, modify, and/or distribute this software for any
660
+ # purpose with or without fee is hereby granted, provided that the above
661
+ # copyright notice and this permission notice appear in all copies.
662
+ #
663
+ # THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
664
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
665
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
666
+ # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
667
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
668
+ # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
669
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
670
+ def find_executable(bin = @prog, *paths) #:nodoc:
671
+ paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
672
+ paths.each do |path|
673
+ file = File.join(path,bin)
674
+ if File.executable?(file) then
675
+ return file
676
+ end
651
677
  end
652
- return cmd
678
+ return nil
653
679
  end
654
680
  end
655
681
 
@@ -15,7 +15,7 @@
15
15
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
  module Constants
18
- RGV_VERSION = "0.9.4"
18
+ RGV_VERSION = "0.9.5"
19
19
 
20
20
  ## Const: Output formats
21
21
  FORMATS = [
data/lib/graphviz/edge.rb CHANGED
@@ -60,10 +60,18 @@ class GraphViz
60
60
  end
61
61
 
62
62
  #
63
- # Get the value of the node attribut +xAttrName+
63
+ # Set values for edge attributs or
64
+ # get the value of the given edge attribut +xAttrName+
64
65
  #
65
66
  def []( xAttrName )
66
- @oAttrEdge[xAttrName.to_s].clone
67
+ # Modification by axgle (http://github.com/axgle)
68
+ if Hash === xAttrName
69
+ xAttrName.each do |key, value|
70
+ self[key] = value
71
+ end
72
+ else
73
+ @oAttrEdge[xAttrName.to_s].clone
74
+ end
67
75
  end
68
76
 
69
77
  def <<( oNode ) #:nodoc:
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
4
+ version: 0.9.5
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-10-21 00:00:00 +02:00
12
+ date: 2009-11-17 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -86,6 +86,7 @@ files:
86
86
  - examples/sample23.rb
87
87
  - examples/sample24.rb
88
88
  - examples/sample25.rb
89
+ - examples/sample26.rb
89
90
  - examples/shapes.rb
90
91
  - examples/test.xml
91
92
  - examples/testorder.rb