Require_gem is obsolete

Hi,

When I start the Webrick server I get the error messgage…
/config/boot.re.29:Warning: require_gem is obsolete. Use gem instead

Anyone know what this means.

Also, if I rake migrate I get the same message then the command promt
closes and the database does not update.

On 2/3/07, doucie [email protected] wrote:

When I start the Webrick server I get the error messgage…
/config/boot.re.29:Warning: require_gem is obsolete. Use gem instead

Anyone know what this means.

Also, if I rake migrate I get the same message then the command promt
closes and the database does not update.

I’m not sure why rake migrate would be disappearing on you with this.
However, you’ve recently upgraded RubyGems and have not upgrade some
code that still uses require_gem – which is obsolete and will be
removed soon.

-austin

Austin Z. * [email protected] * http://www.halostatue.ca/
* [email protected] * You are in a maze of twisty little passages, all alike. // halo • statue
* [email protected]

Well I installed the latest release of the all in one installer from the
ruby site, you would think that it would all work OK together!

On 2/3/07, doucie [email protected] wrote:

When I start the Webrick server I get the error messgage…
/config/boot.re.29:Warning: require_gem is obsolete. Use gem instead

Anyone know what this means.

It’s pretty explicit: ‘gem’ should be used instead of ‘require_gem’.
Have you tried examining the mentioned file at the given line number?

Open config/boot.rb, go to line 29, and change ‘require_gem’ to ‘gem’.
There’s another one 10 lines later, too.

It is of course only a warning, not an error, as it specifies. I
still find it visually annoying enough to merit changing.

HTH,

J.

Is the “rails” command for generating apps actually producing the code
with
require_gem? Has it not been patched so that RubyGems < 0.9.1 will
still
work? Other wise…

On 2/3/07, Jordan K. [email protected] wrote:

Have you tried examining the mentioned file at the given line number?


Thanks,
-Steve
http://www.stevelongdo.com

Try this

http://railsforum.com/viewtopic.php?pid=12402#p12402

Does it help?

Steve L. wrote:

Is the “rails” command for generating apps actually producing the code with
require_gem? Has it not been patched so that RubyGems < 0.9.1 will still
work? Other wise…

$ script/about
./script/…/config/boot.rb:29:Warning: require_gem is obsolete. Use
gem instead.
About your application’s environment
Ruby version 1.8.5 (powerpc-darwin8.8.0)
RubyGems version 0.9.1
Rails version 1.2.1

The above is from a MacPorts-installed rails. Locomotive has the same
issue:

$ script/about
./script/…/config/boot.rb:29:Warning: require_gem is obsolete. Use
gem instead.
About your application’s environment
Ruby version 1.8.5 (powerpc-darwin7.9.0)
RubyGems version 0.9.1
Rails version 1.2.1

On 2/3/07, Phlip [email protected] wrote:

I just ran rake rails:update (per my other post, and thaaanks for
teeelling me about it, guys!), and it fixed my gem() calls by
upgrading them to require_gem().

Shouldn’t that be the other way 'round?

J.

Jordan K. wrote:

I just ran rake rails:update (per my other post, and thaaanks for
teeelling me about it, guys!), and it fixed my gem() calls by
upgrading them to require_gem().

Shouldn’t that be the other way 'round?

That was my insinuation. I fixed things manually, like y’all are
discussing, then I ran rails:update, and it un-fixed them.

phlip@penbird:~/projects$ rails -v
Rails 1.2.1
phlip@penbird:~/projects$ rails scratch
phlip@penbird:~/projects$ cd scratch/
phlip@penbird:~/projects/scratch$ grep require_gem config/boot.rb
require_gem “rails”, “=#{rails_gem.version.version}”
require_gem “rails”

The base generator is generating the noisily deprecated version.


Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!

Phlip wrote:

phlip@penbird:~/projects$ rails -v
Rails 1.2.1
phlip@penbird:~/projects$ rails scratch
phlip@penbird:~/projects$ cd scratch/
phlip@penbird:~/projects/scratch$ grep require_gem config/boot.rb
require_gem “rails”, “=#{rails_gem.version.version}”
require_gem “rails”

The base generator is generating the noisily deprecated version.

Oooh, lookie here:

phlip@penbird:~/projects/scratch$ public/dispatch.rb
./public/…/config/boot.rb:29:Warning: require_gem is obsolete. Use
gem instead.
Status: 400 Bad Request
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:405:in
to_constant_name': Anonymous modules ha ve no name to be referenced by (ArgumentError) from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:215:in qualified_name_for’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:477:in
const_missing' from /usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:117:in reset_after_dispatch’
from
/usr/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:51:in
`dispatch’
from public/dispatch.rb:10

A brand-new Rails program has the bug that I’m stuck on, as mentioned
in my other post.


Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!

Steve L. wrote:

Is the “rails” command for generating apps actually producing the code with
require_gem? Has it not been patched so that RubyGems < 0.9.1 will still
work? Other wise…

I just ran rake rails:update (per my other post, and thaaanks for
teeelling me about it, guys!), and it fixed my gem() calls by
upgrading them to require_gem().


Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!

I found a trac ticket that shows the remaining files in Rails that still
use
require gem.
http://dev.rubyonrails.org/ticket/6886

These two in particular are what are causing the commotion on 1.2.1:

railties/environments/boot.rb
railties/lib/rails_generator.rb

On 2/3/07, Phlip [email protected] wrote:

That was my insinuation. I fixed things manually, like y’all are
The base generator is generating the noisily deprecated version.


Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!


Thanks,
-Steve
http://www.stevelongdo.com

doucie wrote:

Hi,

When I start the Webrick server I get the error messgage…
/config/boot.re.29:Warning: require_gem is obsolete. Use gem instead

Anyone know what this means.

Also, if I rake migrate I get the same message then the command promt
closes and the database does not update.

Steve L. wrote:

I found a trac ticket that shows the remaining files in Rails that still
use
require gem.
http://dev.rubyonrails.org/ticket/6886

These two in particular are what are causing the commotion on 1.2.1:

railties/environments/boot.rb
railties/lib/rails_generator.rb

On 2/3/07, Phlip [email protected] wrote:

That was my insinuation. I fixed things manually, like y’all are
The base generator is generating the noisily deprecated version.


Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!


Thanks,
-Steve
http://www.stevelongdo.com

I tried changing require_gem to just gem but the prompt still closed
after running rake migrate. I’ve unistalled and installed instant rails
(I know lazy of me) but this problem has ot resurfaced.

Thanks for all your input.

serge wrote:

doucie wrote:

Hi,

When I start the Webrick server I get the error messgage…
/config/boot.re.29:Warning: require_gem is obsolete. Use gem instead

Anyone know what this means.

Also, if I rake migrate I get the same message then the command promt
closes and the database does not update.

Sorry, hit the wrong button…
Just wanted to add that on my machine (with Ruby Version 1.8.5p12
Installer Version 185-22 - just fresh installed an hour ago) rake
db:migrate crashes commend prompt. I also saw require_gem obsolete
thing, but I think this crashing has little/nothing to with require_gem

  • even after I got rid of it (manually), it still crashes the command
    shell.

I’m not sure why rake migrate would be disappearing on you with this.
However, you’ve recently upgraded RubyGems and have not upgrade some
code that still uses require_gem – which is obsolete and will be
removed soon.

I really hope that’s not true, as a ton of apps use require_gem
including stuff in the latest version of rails. If they remove it
anytime soon stuff is going to break left and right.

Chris

run rake with the -t option to get a stack trace.( rake -t db:migrate )
Check your database.yml, that can be a source of silent failure with the
db:migrate task.

On 2/4/07, serge [email protected] wrote:


Posted via http://www.ruby-forum.com/.


Thanks,
-Steve
http://www.stevelongdo.com

On 2/4/07, snacktime [email protected] wrote:

I’m not sure why rake migrate would be disappearing on you with this.
However, you’ve recently upgraded RubyGems and have not upgrade some
code that still uses require_gem – which is obsolete and will be
removed soon.
I really hope that’s not true, as a ton of apps use require_gem
including stuff in the latest version of rails. If they remove it
anytime soon stuff is going to break left and right.

Then the current version of rails is broken. require_gem is bad juju.

#require_gem will be removed for RubyGems 1.0.

-austin

Austin Z. * [email protected] * http://www.halostatue.ca/
* [email protected] * You are in a maze of twisty little passages, all alike. // halo • statue
* [email protected]

Steve L. wrote:

run rake with the -t option to get a stack trace.( rake -t db:migrate )
Check your database.yml, that can be a source of silent failure with the
db:migrate task.

I experimented a bit with this - here is what it looks like.

rake crashes command prompt anytime - first I thought that it happens
when there is an error. However, it happens EVERY time rake is run.
Below is the result of a successful rake -t db:migrate (piped to a file

  • the only way to get the output). After it finishes, command shell
    disappears.

(in D:/ruby/shekn)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreateUsers: migrating

– create_table(:users_test)
-> 0.1500s
== CreateUsers: migrated (0.1500s)

** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump

Here is a trace when rake is aborted - but it does not matter if it
successful or not - command prompt gone every time no matter what.

(in D:/ruby/shekn)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreateUsers: migrating

– create_table(:users)
rake aborted!
Mysql::Error: #42S01Table ‘users’ already exists: CREATE TABLE users
(id int(11) DEFAULT NULL auto_increment PRIMARY KEY, name
varchar(255) DEFAULT NULL, hashed_password varchar(255) DEFAULT NULL,
salt varchar(255) DEFAULT NULL) ENGINE=InnoDB
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/connection_adapters/abstract_adapter.rb:128:in
log' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/connection_adapters/mysql_adapter.rb:243:inexecute’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:104:in
create_table' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/connection_adapters/mysql_adapter.rb:353:increate_table’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:275:in
send' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:275:inmethod_missing’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:259:in
say_with_time' D:/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:259:in
say_with_time' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:273:inmethod_missing’
./db/migrate//001_create_users.rb:3:in real_up' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:212:insend’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:212:in
migrate' D:/ruby/lib/ruby/1.8/benchmark.rb:293:inmeasure’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:212:in
migrate' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:335:inmigrate’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:330:in
each' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:330:inmigrate’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:297:in
up' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/migration.rb:288:inmigrate’
D:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/tasks/databases.rake:4
D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in call' D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:inexecute’
D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in each' D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:inexecute’
D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in invoke' D:/ruby/lib/ruby/1.8/thread.rb:135:insynchronize’
D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in invoke' D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:inrun’
D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in each' D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:inrun’
D:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
D:/ruby/bin/rake.bat:25:in `load’
D:/ruby/bin/rake.bat:25

Serge

Austin Z. wrote:

Then the current version of rails is broken. require_gem is bad juju.

Why did it get renamed? What’s wrong with calling it require_gem?

I remember the fanfare when it was invented - everyone was delighted.
That might not validate its name, though…


Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!