Browse files

Issue #56 : ruby2gv is failing

  • Loading branch information...
1 parent 3c8c8f5 commit 7fc9548cf88ceca69ec78284488667e35f6ccc13 @glejeune committed Mar 12, 2013
Showing with 13 additions and 16 deletions.
  1. +13 −16 bin/ruby2gv
View
29 bin/ruby2gv
@@ -78,24 +78,25 @@ class Rb2Gv
# Search in "standard" paths
xPath.each do |xDir|
- xCurrentPath = Config::expand( Config::CONFIG[xDir] )
+ xCurrentPath = RbConfig::expand( RbConfig::CONFIG[xDir] )
xFileFound = File.join( xCurrentPath, xRbFileWithExt )
if File.exist?( xFileFound )
return xFileFound
end
end
# Search in "rubygems" :: This is not utile but...
- spec = Gem.searcher.find(xLib)
- unless spec.nil?
- spec.require_paths.unshift spec.bindir if spec.bindir
- xPath = spec.require_paths.map do |path|
- File.join spec.full_gem_path, path
- end
- xPath.each do |xCurrentPath|
- xFileFound = File.join( xCurrentPath, xRbFileWithExt )
- if File.exist?( xFileFound )
- return xFileFound
+ Gem::Specification.find_all do |spec|
+ if spec == xLib
+ spec.require_paths.unshift spec.bindir if spec.bindir
+ xPath = spec.require_paths.map do |path|
+ File.join spec.full_gem_path, path
+ end
+ xPath.each do |xCurrentPath|
+ xFileFound = File.join( xCurrentPath, xRbFileWithExt )
+ if File.exist?( xFileFound )
+ return xFileFound
+ end
end
end
end
@@ -112,11 +113,7 @@ class Rb2Gv
puts "Parse #{xFile} :" if DEBUG
end
- fp = open( xFile, 'r' )
- xData = fp.read()
- fp.close
-
- xData.each do |xLine|
+ File.open(xFile, 'r').each_line do |xLine|
if lxLineMatch = REQUIRE.match( xLine )
xRequiredLib = lxLineMatch[2].gsub( /\.(rb|so)$/, "" )

0 comments on commit 7fc9548

Please sign in to comment.