------art_29766_23808467.1220478358862
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Yes, rubygems are quite common so the solution should probably should
include support for them, at least if I wanted to really use it in the
future.

Here is one that only shows dependencies between gems (and stdlib),
not the requires inside gems.

It generates somewhat excessive output when gems are involved as their
paths tend to be long.

Thanks

Michal

$ cat q175t.rb

require 'date'
require 'readline'
require 'matrix'
require 'rubygems'
require 'time'
require 'hpricot'
require 'rubyforge'
require 'hoe'
require 'curses'

$ ruby -r q175.rb q175t.rb
require: q175t.rb:1: date /usr/lib/ruby/1.8/date.rb
require: q175t.rb:2: readline /usr/lib/ruby/1.8/x86_64-linux/readline.so
require: q175t.rb:3: matrix /usr/lib/ruby/1.8/matrix.rb
require: q175t.rb:4: rubygems /usr/lib/ruby/1.8/rubygems.rb
require: q175t.rb:5: time /usr/lib/ruby/1.8/time.rb
require: /var/lib/gems/1.8/gems/hpricot-0.6.161/lib/hpricot/traverse.rb:2:
uri /usr/lib/ruby/1.8/uri.rb
require: /var/lib/gems/1.8/gems/hpricot-0.6.161/lib/hpricot/inspect.rb:1:
pp /usr/lib/ruby/1.8/pp.rb
require: /var/lib/gems/1.8/gems/hpricot-0.6.161/lib/hpricot/builder.rb:2:
fast_xs /var/lib/gems/1.8/gems/hpricot-0.6.161/lib/universal-darwin9.0/fast_xs.so
require: q175t.rb:6: hpricot /var/lib/gems/1.8/gems/hpricot-0.6.161/lib/hpricot.rb
require: /var/lib/gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge.rb:5:
yaml /usr/lib/ruby/1.8/yaml.rb
require: /var/lib/gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge.rb:6:
open-uri /usr/lib/ruby/1.8/open-uri.rb
require: /var/lib/gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge/client.rb:1:
webrick/cookie /usr/lib/ruby/1.8/webrick/cookie.rb
require: /var/lib/gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge/client.rb:2:
net/http /usr/lib/ruby/1.8/net/http.rb
require: /var/lib/gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge/client.rb:3:
net/https /usr/lib/ruby/1.8/net/https.rb
require: q175t.rb:7: rubyforge /var/lib/gems/1.8/gems/rubyforge-1.0.0/lib/rubyforge.rb
require: /var/lib/gems/1.8/gems/rake-0.8.1/lib/rake.rb:35: getoptlong
/usr/lib/ruby/1.8/getoptlong.rb
require: /var/lib/gems/1.8/gems/rake-0.8.1/lib/rake.rb:37: singleton
/usr/lib/ruby/1.8/singleton.rb
require: /var/lib/gems/1.8/gems/rake-0.8.1/lib/rake.rb:39: ostruct /usr/lib/ruby/1.8/ostruct.rb
require: /var/lib/gems/1.8/gems/hoe-1.7.0/lib/hoe.rb:4: rake /var/lib/gems/1.8/gems/rake-0.8.1/lib/rake.rb
require: /var/lib/gems/1.8/gems/hoe-1.7.0/lib/hoe.rb:5:
rake/gempackagetask /var/lib/gems/1.8/gems/rake-0.8.1/lib/rake/gempackagetask.rb
require: /var/lib/gems/1.8/gems/hoe-1.7.0/lib/hoe.rb:6: rake/rdoctask
/var/lib/gems/1.8/gems/rake-0.8.1/lib/rake/rdoctask.rb
require: /var/lib/gems/1.8/gems/hoe-1.7.0/lib/hoe.rb:7: rake/testtask
/var/lib/gems/1.8/gems/rake-0.8.1/lib/rake/testtask.rb
require: q175t.rb:8: hoe /var/lib/gems/1.8/gems/hoe-1.7.0/lib/hoe.rb
require: q175t.rb:9: curses /usr/lib/ruby/1.8/x86_64-linux/curses.so

------art_29766_23808467.1220478358862
Content-Type: application/x-ruby; name=q175.rb
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fkoh3xh5
Content-Disposition: attachment; filename=q175.rb

dW5sZXNzIEtlcm5lbC5jb25zdGFudHMuaW5jbHVkZT8gIlExNzUiCgpyZXF1aXJlICdyYmNvbmZp
ZycKCm1vZHVsZSBLZXJuZWwKCiAgbW9kdWxlIFExNzUKCiAgICBkZWYgc2VsZi5nZXRfZXh0cwog
ICAg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