Post #234,259
11/15/05 12:37:29 PM
|
Re: My environment
and here is what I have now:[... list of gem packages elided ...] Good, it looks like you only have one version of each package installed. (Gems should handle multiple versions, but since you are having problems it is good to eliminate variables). I assume that none of these are installed directly (as non-gem packages), correct? As to the role of dependencies in loading process, don't you try to activate dependencies before activating the main gem?Yes, but gems should be handling that. As soon as you require a file that is not found in the search path, RubyGems will find a gem that can satisfy that required file and activate it automatically. There is no need for the user to do anything special unless (a) they desire a particular version of a package and wish to manually activate it, or (b) there are some conflicts where RubyGems activates the wrong gem because of a name clash. I will try to get a small example, but it would require me to manufacture gems, something I really have no experience with. I'll try it during the week.If you get another together, I would love to see it. I just had a thought. You might want to try out the latest beta version of RubyGems to see if that addresses the issue. There are some subtle autorequire bugs that were stamped out in the beta version and perhaps there is one that is affecting you. You can get the latest beta version of RubyGems with: gem update --system --source [link|http://onestepback.org/betagems|http://onestepback.org/betagems]
-- -- Jim Weirich jim@weirichhouse.org [link|http://onestepback.org|http://onestepback.org] --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
|
Post #234,894
11/18/05 2:07:33 PM
|
OK, I see more clearly now
I have sample code that repropduces the problem.
The code is essentially a top-level gem that depends on gems 1, 2 and 3.
2 and 3 depend on 1
3 uses "load("second.rb")" to load 2 in the middle of its .rb file (that's a huge simplification, but the complex code in rails boils down to "load". They do it to be able to refresh code after it gets changed during development, I think).
Now, if I have a test file that contains
require 'rubygems' require 'top' require 'third' require 'second'
I get "second" loaded twice.
If you need my source, let me know where to post a tarball.
------
179. I will not outsource core functions. -- [link|http://omega.med.yale.edu/~pcy5/misc/overlord2.htm|.]
|
Post #235,049
11/19/05 2:29:34 AM
11/19/05 2:31:10 AM
|
The rain has gone
--\n-------------------------------------------------------------------\n* Jack Troughton jake at consultron.ca *\n* [link|http://consultron.ca|http://consultron.ca] [link|irc://irc.ecomstation.ca|irc://irc.ecomstation.ca] *\n* Kingston Ontario Canada [link|news://news.consultron.ca|news://news.consultron.ca] *\n-------------------------------------------------------------------
Edited by jake123
Nov. 19, 2005, 02:31:10 AM EST
|
Post #235,050
11/19/05 2:30:04 AM
|
I can see all obstacles in my way
--\n-------------------------------------------------------------------\n* Jack Troughton jake at consultron.ca *\n* [link|http://consultron.ca|http://consultron.ca] [link|irc://irc.ecomstation.ca|irc://irc.ecomstation.ca] *\n* Kingston Ontario Canada [link|news://news.consultron.ca|news://news.consultron.ca] *\n-------------------------------------------------------------------
|
Post #235,051
11/19/05 2:31:30 AM
|
Gone are the dark clouds that had me blind
--\n-------------------------------------------------------------------\n* Jack Troughton jake at consultron.ca *\n* [link|http://consultron.ca|http://consultron.ca] [link|irc://irc.ecomstation.ca|irc://irc.ecomstation.ca] *\n* Kingston Ontario Canada [link|news://news.consultron.ca|news://news.consultron.ca] *\n-------------------------------------------------------------------
|
Post #235,052
11/19/05 2:32:26 AM
|
It's gonna be a bright (bright) bright (bright) sunshiny day
--\n-------------------------------------------------------------------\n* Jack Troughton jake at consultron.ca *\n* [link|http://consultron.ca|http://consultron.ca] [link|irc://irc.ecomstation.ca|irc://irc.ecomstation.ca] *\n* Kingston Ontario Canada [link|news://news.consultron.ca|news://news.consultron.ca] *\n-------------------------------------------------------------------
|
Post #235,064
11/19/05 8:12:12 AM
|
A source of annoying catchphrases now.
|
Post #235,065
11/19/05 8:14:02 AM
|
Sorry, saw Arkadiy's subject line and it just popped into my
head, fully formed. After that it was just inevitable that I was going to do that... gotta do something about that I guess.
--\n-------------------------------------------------------------------\n* Jack Troughton jake at consultron.ca *\n* [link|http://consultron.ca|http://consultron.ca] [link|irc://irc.ecomstation.ca|irc://irc.ecomstation.ca] *\n* Kingston Ontario Canada [link|news://news.consultron.ca|news://news.consultron.ca] *\n-------------------------------------------------------------------
|
Post #235,067
11/19/05 8:17:43 AM
|
(Twas just the LRPDism. :-)
|
Post #235,072
11/19/05 8:31:48 AM
|
Except the song has no "ok" or "more"
Of course, I thought of them as well.
|
Post #235,073
11/19/05 8:41:01 AM
|
Ditto. It's got staying power.
|
Post #235,074
11/19/05 8:55:10 AM
|
But not in that way, pervs.
--\n-------------------------------------------------------------------\n* Jack Troughton jake at consultron.ca *\n* [link|http://consultron.ca|http://consultron.ca] [link|irc://irc.ecomstation.ca|irc://irc.ecomstation.ca] *\n* Kingston Ontario Canada [link|news://news.consultron.ca|news://news.consultron.ca] *\n-------------------------------------------------------------------
|
Post #235,082
11/19/05 10:14:40 AM
|
Grrrrrrr.
------
179. I will not outsource core functions. -- [link|http://omega.med.yale.edu/~pcy5/misc/overlord2.htm|.]
|
Post #235,197
11/19/05 11:24:23 PM
|
Re: OK, I see more clearly now
3 uses "load("second.rb")" to load 2 in the middle of its .rb file (that's a huge simplification, but the complex code in rails boils down to "load". They do it to be able to refresh code after it gets changed during development, I think).
Ahhh ... require won't load the same file twice, but load doesn't know anything about require's list of file names. So files loaded by 'load' are not reported to 'require' ... or something like that.
If Rails is working hard to load the file itself, is it possible for you to omit your require statement? There are a lot of declarations in rails that just handle the file loading automatically for you ... is there something you can take advantage of?
-- -- Jim Weirich jim@weirichhouse.org [link|http://onestepback.org|http://onestepback.org] --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
|
Post #235,334
11/21/05 12:46:00 PM
|
It should be possible
But in the real code the require statementr is not there, either. The only thing that's "require"d is the top-level module.
I need to improve my model to figure out how that happens. Will try to do it later.
------
179. I will not outsource core functions. -- [link|http://omega.med.yale.edu/~pcy5/misc/overlord2.htm|.]
|