Kenneth Kalmer
2008-Nov-24 15:05 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
On Mon, Nov 24, 2008 at 2:38 PM, Kenneth Kalmer <kenneth.kalmer@gmail.com> wrote:> On Fri, Oct 10, 2008 at 9:08 PM, Stephen Bannasch > <stephen.bannasch@deanbrook.org> wrote: >>>So unless I''m misreading this, it seems we''re requiring application.rb >>>before we try to run the gem installs, but we *haven''t* fired the >>>initializers yet? >>> >>>Is it perhaps caused by one of your plugins (rspec f.ex) requiring >>>application.rb?No it is not. I managed to get the issue reproduced in a very tiny application using Rails 2.2.2. The code is available at git://github.com/kennethkalmer/rails-broken-gems-example.git and shows exactly how to simulate the breakage mentioned by Steven. Please review the README file (http://github.com/kennethkalmer/rails-broken-gems-example/tree/master) for a complete breakdown of the issue and how to fix it. In a nutshell, it boils down to the one-line patch below: --- a/vendor/rails/railties/lib/initializer.rb +++ b/vendor/rails/railties/lib/initializer.rb @@ -284,7 +284,7 @@ module Rails def check_gem_dependencies unloaded_gems = @configuration.gems.reject { |g| g.loaded? } if unloaded_gems.size > 0 - @gems_dependencies_loaded = false + @gems_dependencies_loaded = false || $rails_gem_installer # don''t print if the gems rake tasks are being run unless $rails_gem_installer abort <<-end_error Any feedback would be appreciated, including pointers to the correct Lighthouse tickets for making my case. Best -- Kenneth Kalmer kenneth.kalmer@gmail.com http://opensourcery.co.za --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Kenneth Kalmer
2008-Nov-24 15:08 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
Original thread at http://groups.google.com/group/rubyonrails-core/browse_thread/thread/8409d0d8f006f8f5, my apologies. -- Kenneth Kalmer kenneth.kalmer@gmail.com http://opensourcery.co.za --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Kenneth Kalmer
2008-Nov-24 16:00 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
On Mon, Nov 24, 2008 at 5:05 PM, Kenneth Kalmer <kenneth.kalmer@gmail.com> wrote:> On Mon, Nov 24, 2008 at 2:38 PM, Kenneth Kalmer> > The code is available at > git://github.com/kennethkalmer/rails-broken-gems-example.git and shows > exactly how to simulate the breakage mentioned by Steven. Please > review the README file > (http://github.com/kennethkalmer/rails-broken-gems-example/tree/master) > for a complete breakdown of the issue and how to fix it. > > In a nutshell, it boils down to the one-line patch below: > > --- a/vendor/rails/railties/lib/initializer.rb > +++ b/vendor/rails/railties/lib/initializer.rb > @@ -284,7 +284,7 @@ module Rails > def check_gem_dependencies > unloaded_gems = @configuration.gems.reject { |g| g.loaded? } > if unloaded_gems.size > 0 > - @gems_dependencies_loaded = false > + @gems_dependencies_loaded = false || $rails_gem_installer > # don''t print if the gems rake tasks are being run > unless $rails_gem_installer > abort <<-end_error > > Any feedback would be appreciated, including pointers to the correct > Lighthouse tickets for making my case.Seems I was in a too big a hurry, this does solve the initial issue but creates a new one upon running ''rake gems'', which now complains about the gem specifications... I''ll investigate and report my findings. Best -- Kenneth Kalmer kenneth.kalmer@gmail.com http://opensourcery.co.za --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Matt Jones
2008-Nov-24 16:33 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
The problem with loading initializers is that they are likely to try to use the configured gems (ie, to set options, etc.). So loading them is going to cause more problems than it solves. FWIW, this problem goes away on edge - http://github.com/rails/rails/commit/a026b4c983681b71d876ea37958c3e5bc605acac avoids preloading ApplicationController, and thus solves this. (I tested it...) What''s the error about the specifications? --Matt On Nov 24, 2008, at 11:00 AM, Kenneth Kalmer wrote:> > On Mon, Nov 24, 2008 at 5:05 PM, Kenneth Kalmer > <kenneth.kalmer@gmail.com> wrote: >> On Mon, Nov 24, 2008 at 2:38 PM, Kenneth Kalmer> >> >> In a nutshell, it boils down to the one-line patch below: >> >> --- a/vendor/rails/railties/lib/initializer.rb >> +++ b/vendor/rails/railties/lib/initializer.rb >> @@ -284,7 +284,7 @@ module Rails >> def check_gem_dependencies >> unloaded_gems = @configuration.gems.reject { |g| g.loaded? } >> if unloaded_gems.size > 0 >> - @gems_dependencies_loaded = false >> + @gems_dependencies_loaded = false || $rails_gem_installer >> # don''t print if the gems rake tasks are being run >> unless $rails_gem_installer >> abort <<-end_error >> >> Any feedback would be appreciated, including pointers to the correct >> Lighthouse tickets for making my case. > > Seems I was in a too big a hurry, this does solve the initial issue > but creates a new one upon running ''rake gems'', which now complains > about the gem specifications... > > I''ll investigate and report my findings. > > Best > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Kenneth Kalmer
2008-Nov-24 19:08 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
On Mon, Nov 24, 2008 at 6:33 PM, Matt Jones <al2o3cr@gmail.com> wrote:> > The problem with loading initializers is that they are likely to try > to use the configured gems > (ie, to set options, etc.). So loading them is going to cause more > problems than it solves.This is a chicken and egg scenario, no wonder it is such hot topic. Good point, didn''t consider that since I was hunting the bug in extreme anger.> FWIW, this problem goes away on edge - http://github.com/rails/rails/commit/a026b4c983681b71d876ea37958c3e5bc605acac > avoids preloading ApplicationController, and thus solves this. (I > tested it...)Nice, will have a look too.> What''s the error about the specifications?$ rake gems (in /home/kenneth/work/tmp/rails-broken-gems-example) - [I] settingslogic rake aborted! You have a nil object when you didn''t expect it! The error occurred while evaluating nil.dependencies vendor/rails/railties/lib/rails/gem_dependency.rb:77:in `dependencies'' all_dependencies = specification.dependencies.map do |dependency| GemDependency.new(dependency.name, :requirement => dependency.version_requirements) end Thanks for digging into this with me. Best -- Kenneth Kalmer kenneth.kalmer@gmail.com http://opensourcery.co.za --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Matt Jones
2008-Nov-24 21:27 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
> > > Nice, will have a look too. > >> What''s the error about the specifications? > > $ rake gems > (in /home/kenneth/work/tmp/rails-broken-gems-example) > - [I] settingslogic > rake aborted! > You have a nil object when you didn''t expect it! > The error occurred while evaluating nil.dependencies > > vendor/rails/railties/lib/rails/gem_dependency.rb:77:in `dependencies'' > > all_dependencies = specification.dependencies.map do |dependency| > GemDependency.new(dependency.name, :requirement => > dependency.version_requirements) > end >Oops - this bit actually *is* a bug. It''s a short patch; I''ll put it up on Lighthouse tonight with a test case. --Matt Jones --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Matt Jones
2008-Nov-25 05:38 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
Patch is on lighthouse and includes a test for this case: http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1464 (patch against 2-2-stable branch) --Matt Jones On Nov 24, 2008, at 2:08 PM, Kenneth Kalmer wrote:> > > $ rake gems > (in /home/kenneth/work/tmp/rails-broken-gems-example) > - [I] settingslogic > rake aborted! > You have a nil object when you didn''t expect it! > The error occurred while evaluating nil.dependencies > > vendor/rails/railties/lib/rails/gem_dependency.rb:77:in `dependencies'' > > all_dependencies = specification.dependencies.map do |dependency| > GemDependency.new(dependency.name, :requirement => > dependency.version_requirements) > end > > T--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Kenneth Kalmer
2008-Nov-26 05:46 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
Thanks Matt, applied to the broken app example and it worked perfectly. Also commented on the ticket. On Tue, Nov 25, 2008 at 7:38 AM, Matt Jones <al2o3cr@gmail.com> wrote:> Patch is on lighthouse and includes a test for this case: > http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1464 > > (patch against 2-2-stable branch) > > --Matt Jones-- Kenneth Kalmer kenneth.kalmer@gmail.com http://opensourcery.co.za --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2008-Dec-01 19:46 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
Applied to master and 2-2 stable. Are there any other pending gems changes we should investigate before we cut a 2.2 point release to address On Wed, Nov 26, 2008 at 6:46 AM, Kenneth Kalmer <kenneth.kalmer@gmail.com> wrote:> > Thanks Matt, applied to the broken app example and it worked > perfectly. Also commented on the ticket. > > On Tue, Nov 25, 2008 at 7:38 AM, Matt Jones <al2o3cr@gmail.com> wrote: >> Patch is on lighthouse and includes a test for this case: >> http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1464 >> >> (patch against 2-2-stable branch) >> >> --Matt Jones > > -- > Kenneth Kalmer > kenneth.kalmer@gmail.com > http://opensourcery.co.za > > > >-- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Kenneth Kalmer
2008-Dec-02 06:46 UTC
Re: can''t run: rake gems:install if application.rb depends on initializers [REPRODUCED]
Not that I''m currently aware off. I''ll continue trying to find some fringe cases and in those cases address the issue more clearly than I did this one (and without anger). Thanks everyone On Mon, Dec 1, 2008 at 9:46 PM, Michael Koziarski <michael@koziarski.com> wrote:> > Applied to master and 2-2 stable. Are there any other pending gems > changes we should investigate before we cut a 2.2 point release to > address > > On Wed, Nov 26, 2008 at 6:46 AM, Kenneth Kalmer > <kenneth.kalmer@gmail.com> wrote: > > > > Thanks Matt, applied to the broken app example and it worked > > perfectly. Also commented on the ticket. > > > > On Tue, Nov 25, 2008 at 7:38 AM, Matt Jones <al2o3cr@gmail.com> wrote: > >> Patch is on lighthouse and includes a test for this case: > >> http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1464 > >> > >> (patch against 2-2-stable branch) > >>-- Kenneth Kalmer kenneth.kalmer@gmail.com http://opensourcery.co.za --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---