Finally gotten around to changing my 'require_gem' code, and I've
noticed that for many gems, the name of the file to "require" is not
the same as the gem's name. Furthermore, there's no way to find out
what file I *do* need to require other than looking at the directory
structure of the gem. An option to gem that would list all requirable
files would be a nice addition.
martin
Martin DeMello wrote:
Finally gotten around to changing my 'require_gem' code, and I've
noticed that for many gems, the name of the file to "require" is not
the same as the gem's name. Furthermore, there's no way to find out
what file I *do* need to require other than looking at the directory
structure of the gem. An option to gem that would list all requirable
files would be a nice addition.
Personally, I'd prefer that a require 'gemname' just loaded all files in the gem's lib directory, but that's probably just me...
···
--
Alex
Finally gotten around to changing my 'require_gem' code, and I've
noticed that for many gems, the name of the file to "require" is not
the same as the gem's name.
99.9% of the time you don't need require_gem.
Furthermore, there's no way to find out
what file I *do* need to require other than looking at the directory
structure of the gem. An option to gem that would list all requirable
files would be a nice addition.
You mean "gem contents"?
$ gem help contents
Usage: gem contents [options]
Options:
-v, --version VERSION Specify version of gem to contents
-l, --list List the files inside a Gem
-s, --spec-dir a,b,c Search for gems under specific paths
-V, --verbose Be verbose when showing status
Common Options:
--source URL Use URL as the remote source for gems
-p, --[no-]http-proxy [URL] Use HTTP proxy for remote operations
-h, --help Get help on this command
--config-file FILE Use this config file instead of default
--backtrace Show stack backtrace on errors
--debug Turn on Ruby debugging
Summary:
Display the contents of the installed gems
$ gem contents memcache-client
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/History.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/LICENSE.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/Manifest.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/README.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/Rakefile
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/lib/memcache.rb
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/lib/memcache_util.rb
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/test/test_mem_cache.rb
···
On Mar 13, 2007, at 05:41, Martin DeMello wrote:
yikes! i've got about 80 libs installed!
considering that rails, for instance, takes about 1/2 second to load it's libs,
we could be looking at __tens__ of seconds of startup delay for every ruby
script on a large system
-a
···
On Wed, 14 Mar 2007, Alex Young wrote:
Martin DeMello wrote:
Finally gotten around to changing my 'require_gem' code, and I've
noticed that for many gems, the name of the file to "require" is not
the same as the gem's name. Furthermore, there's no way to find out
what file I *do* need to require other than looking at the directory
structure of the gem. An option to gem that would list all requirable
files would be a nice addition.
Personally, I'd prefer that a require 'gemname' just loaded all files in the gem's lib directory, but that's probably just me...
--
be kind whenever possible... it is always possible.
- the dalai lama
No - that just spits out everything in the gem. What's needed is a
command that just lists those files in the directories that 'gem' adds
to $:
martin
···
On 3/18/07, Eric Hodel <drbrain@segment7.net> wrote:
> Furthermore, there's no way to find out
> what file I *do* need to require other than looking at the directory
> structure of the gem. An option to gem that would list all requirable
> files would be a nice addition.
You mean "gem contents"?
$ gem contents memcache-client
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/History.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/LICENSE.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/Manifest.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/README.txt
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/Rakefile
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/lib/memcache.rb
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/lib/
memcache_util.rb
/usr/local/lib/ruby/gems/1.8/gems/memcache-client-1.3.0/test/
test_mem_cache.rb
I think he meant the files in the individual gem's
lib/ruby/gems/...../gemname/lib folder, not all the files in
lib/ruby/gems
martin
···
On 3/14/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Wed, 14 Mar 2007, Alex Young wrote:
> Personally, I'd prefer that a require 'gemname' just loaded all files in the
> gem's lib directory, but that's probably just me...
yikes! i've got about 80 libs installed!
considering that rails, for instance, takes about 1/2 second to load it's libs,
we could be looking at __tens__ of seconds of startup delay for every ruby
script on a large system
Not *all* the gems... just the named one
F'rinstance, from my machine:
require 'activerecord'
would load gems/activerecord-1.15-1/lib/active_record.rb, and
require 'actionpack'
would load gems/actionpack-1.13.1/lib/{action_controller.rb, action_pack.rb, action_view.rb}
and so on. It's just one way around the disconnect between the gem's name and the name of the file you need to require, which keeps catching me off guard. Mainly because I'm lazy.
···
ara.t.howard@noaa.gov wrote:
On Wed, 14 Mar 2007, Alex Young wrote:
Martin DeMello wrote:
Finally gotten around to changing my 'require_gem' code, and I've
noticed that for many gems, the name of the file to "require" is not
the same as the gem's name. Furthermore, there's no way to find out
what file I *do* need to require other than looking at the directory
structure of the gem. An option to gem that would list all requirable
files would be a nice addition.
Personally, I'd prefer that a require 'gemname' just loaded all files in the gem's lib directory, but that's probably just me...
yikes! i've got about 80 libs installed!
--
Alex
Have you filed a bug? I guarantee it won't get added without it.
···
On Mar 18, 2007, at 02:15, Martin DeMello wrote:
On 3/18/07, Eric Hodel <drbrain@segment7.net> wrote:
> Furthermore, there's no way to find out
> what file I *do* need to require other than looking at the directory
> structure of the gem. An option to gem that would list all requirable
> files would be a nice addition.
You mean "gem contents"?
No - that just spits out everything in the gem. What's needed is a
command that just lists those files in the directories that 'gem' adds
to $:
But we still don't want to do that. Some libraries provide alternate interfaces or features based on which file you require.
James Edward Gray II
···
On Mar 13, 2007, at 2:19 PM, Martin DeMello wrote:
On 3/14/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Wed, 14 Mar 2007, Alex Young wrote:
> Personally, I'd prefer that a require 'gemname' just loaded all files in the
> gem's lib directory, but that's probably just me...
yikes! i've got about 80 libs installed!
considering that rails, for instance, takes about 1/2 second to load it's libs,
we could be looking at __tens__ of seconds of startup delay for every ruby
script on a large system
I think he meant the files in the individual gem's
lib/ruby/gems/...../gemname/lib folder, not all the files in
lib/ruby/gems
Yep. Which is why what I want is an argument to gem that will list a
gem's requirable files.
martin
···
On 3/14/07, James Edward Gray II <james@grayproductions.net> wrote:
But we still don't want to do that. Some libraries provide alternate
interfaces or features based on which file you require.
James Edward Gray II wrote:
···
On Mar 13, 2007, at 2:19 PM, Martin DeMello wrote:
On 3/14/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Wed, 14 Mar 2007, Alex Young wrote:
> Personally, I'd prefer that a require 'gemname' just loaded all files in the
> gem's lib directory, but that's probably just me...
yikes! i've got about 80 libs installed!
considering that rails, for instance, takes about 1/2 second to load it's libs,
we could be looking at __tens__ of seconds of startup delay for every ruby
script on a large system
I think he meant the files in the individual gem's
lib/ruby/gems/...../gemname/lib folder, not all the files in
lib/ruby/gems
But we still don't want to do that. Some libraries provide alternate interfaces or features based on which file you require.
Oh, I realise I'm not likely to get my wish - there's too much code already out there that wouldn't work like I'm suggesting.
--
Alex