Hi list. I''ve added the following line to my `config/environment.rb` file, within the `Initializer`: config.gem ''mislav-will_paginate'', :version => ''2.3.11'', :lib => ''will_paginate'', :source => ''http://gems.github.com'' When I then run the command `sudo rake gems:install`, I get the following output: tkn@tkn-desktop-ubuntu ~/work/trunk $ sudo rake gems:install (in /home/tkn/work/trunk) Missing these required gems: mislav-will_paginate = 2.3.11 You''re running: ruby 1.8.6.287 at /usr/local/bin/ruby rubygems 1.3.1 at /home/tkn/.gem/ruby/1.8, /usr/local/lib/ruby/gems/1.8 Run `rake gems:install` to install the missing gems. What is going on here? -- Posted via http://www.ruby-forum.com/.
What version of rails are you running? --Matt Jones On Jun 26, 6:09 am, Troels Knak-nielsen <rails-mailing-l...@andreas- s.net> wrote:> Hi list. > > I''ve added the following line to my `config/environment.rb` file, within > the `Initializer`: > > config.gem ''mislav-will_paginate'', :version => ''2.3.11'', :lib => > ''will_paginate'', :source => ''http://gems.github.com'' > > When I then run the command `sudo rake gems:install`, I get the > following output: > > tkn@tkn-desktop-ubuntu ~/work/trunk $ sudo rake gems:install > (in /home/tkn/work/trunk) > Missing these required gems: > mislav-will_paginate = 2.3.11 > > You''re running: > ruby 1.8.6.287 at /usr/local/bin/ruby > rubygems 1.3.1 at /home/tkn/.gem/ruby/1.8, > /usr/local/lib/ruby/gems/1.8 > > Run `rake gems:install` to install the missing gems. > > What is going on here? > -- > Posted viahttp://www.ruby-forum.com/.
Matt Jones wrote:> What version of rails are you running?2.3.2 I found out what the problem is though. Some gems are loaded by the Rails initializer, so if they are missing, the rake tasks can''t be loaded. It''s a catch-22 really. I wrote a wrapper script to fix it. If any body else needs it, you can get it from here: http://gist.github.com/136461 Just put in `script/install_gems` and remember to `chmod +x`. -- troels -- Posted via http://www.ruby-forum.com/.
More info on the matter here (And a hackety workaround): http://www.railsforum.com/viewtopic.php?id=28417 -- troels -- Posted via http://www.ruby-forum.com/.
I use mislav-will_paginate. I place the following at the bottom of my environment.rb file: require "will_paginate" Make sure you place it after the end in configs... I''m using 2.3.2 -- Posted via http://www.ruby-forum.com/.
You shouldn''t be seeing this problem with 2.3.2 - I just tried it in a fresh Rails app using the 2.3.2 gem. Something weird''s going on in your version, as the install task sets $gems_rake_task which *should* prevent the display of the error message you''re seeing. Do you happen to have an RC version frozen in vendor/rails? That''s my next guess... --Matt Jones On Jun 27, 2:51 pm, Troels Knak-nielsen <rails-mailing-l...@andreas- s.net> wrote:> Matt Jones wrote: > > What version of rails are you running? > > 2.3.2 > > I found out what the problem is though. Some gems are loaded by the > Rails initializer, so if they are missing, the rake tasks can''t be > loaded. It''s a catch-22 really. I wrote a wrapper script to fix it. If > any body else needs it, you can get it from here: > > http://gist.github.com/136461 > > Just put in `script/install_gems` and remember to `chmod +x`. > > -- > troels > -- > Posted viahttp://www.ruby-forum.com/.
On Jun 29, 4:03 am, Matt Jones <al2o...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You shouldn''t be seeing this problem with 2.3.2 - I just tried it in a > fresh Rails app using the 2.3.2 gem. Something weird''s going on in > your version, as the install task sets $gems_rake_task which *should* > prevent the display of the error message you''re seeing.I have exactly the same problem with Rails 2.3.2. Since it is an open source project, you can easily grab it from here and verify for yourself the problem: http://github.com/ari/clockingit/tree/master Ari Maniatis
Matt Jones wrote:> Do you happen to have an RC version frozen in vendor/rails? That''s my > next guess...Nope, but it''s an application that has been upgraded from an older version, so there might be some leftover somewhere, that is causing this. I''ll try to see if I can replicate the issue in a fresh project. -- troels -- Posted via http://www.ruby-forum.com/.
Ari: your problem is in lib/tasks/localization.rake. You require config/environment, which loads the initializer and causes the error. The gems tasks never even get a chance to run. Troels - I''d recommend that you look for the same kind of thing in your Rakefiles. --Matt Jones On Jun 28, 6:37 pm, Ari Maniatis <a...-WeiC9bTY98EQrrorzV6ljw@public.gmane.org> wrote:> On Jun 29, 4:03 am, Matt Jones <al2o...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You shouldn''t be seeing this problem with 2.3.2 - I just tried it in a > > fresh Rails app using the 2.3.2 gem. Something weird''s going on in > > your version, as the install task sets $gems_rake_task which *should* > > prevent the display of the error message you''re seeing. > > I have exactly the same problem with Rails 2.3.2. Since it is an open > source project, you can easily grab it from here and verify for > yourself the problem: > > http://github.com/ari/clockingit/tree/master > > Ari Maniatis
Matt: thank you so much for finding that. I have removed it and the problem goes away as you say. Can I recommend some improvements to Rails to help others in this predicament: * rake gems:install should not try to load all the rake tasks since it has a very specific job to do and should not be sidetracked by loading everything it comes across on the class path * better error reporting which detects this condition and reports where the problem might lie Thank you again for your help. Ari Maniatis
Matt Jones wrote:> Troels - I''d recommend that you look for the same kind of thing in > your Rakefiles.Indeed - I had a rake task in `lib/tasks/` that included `config/environment.rb`. Thanks for your help. Ari Maniatis wrote:> * rake gems:install should not try to load all the rake tasks since it > has a very specific job to do and should not be sidetracked by loading > everything it comes across on the class pathThat''s not possible. Rake works by finding files with the name *.task and then loading them. If these files try to invoke gems at load-time, there is nothing rake can do. It''s a fundamentally design flaw/limitation of rake.> * better error reporting which detects this condition and reports > where the problem might lieWould definitely be nice with a trace that points to the error. An solution could also be to move the `config.gem` lines from `config/environment.rb` into a separate file (Say - `config/gemconf.rb`), and then include it in the config file. This would make it possible to write a script in `script/`, that loads this config file and invokes gem for each dependency. Since it doesn''t depend on rake, it wouldn''t have the load-time-dependencies problem. The reason I''m suggesting this is that some times you really need load-time dependencies in your rake tasks; Namely if your task extends some generic task, present in a gem. For example, installing the `rails_rcov` plugin [1] will cause an error if you don''t have the `rcov` gem installed, since the task depends on the file `rcov/rcovtask`. Having a script that didn''t use rake, would solve this problem entirely. Might the rails developers be interested in a patch for this? [1] http://svn.codahale.com/rails_rcov -- troels -- Posted via http://www.ruby-forum.com/.
FYI, I have created a plugin, that moves gem-dependencies into a separate file (`config/gemconf.rb`) and then makes `script/install_gems` use this file for finding dependencies. This makes the install script completely independent of rake and any rake tasks. http://github.com/troelskn/gemconf_plugin/tree/master You can install it to you existing Rails projects, using: ./script/plugin install http://github.com/troelskn/gemconf_plugin/tree/master Hope this helps someone. -- troels -- Posted via http://www.ruby-forum.com/.
Troels Knak-nielsen wrote:> FYI, I have created a plugin, that moves gem-dependencies into a > separate file (`config/gemconf.rb`) and then makes `script/install_gems` > use this file for finding dependencies. This makes the install script > completely independent of rake and any rake tasks. > > http://github.com/troelskn/gemconf_plugin/tree/master > > You can install it to you existing Rails projects, using: > > ./script/plugin install > http://github.com/troelskn/gemconf_plugin/tree/master > > Hope this helps someone. > > -- > troelsThanks troels. I am using your plugin now. It is working well. Although I had to comment out ''unless local_install'' line 55 as I''m not running as root but do have superuser access(cygwin). Thanks for developing this plugin! -- Posted via http://www.ruby-forum.com/.