Warning: require_gem is obsolete

I’m going to continue poking at rails – it’s very exciting :slight_smile:

However, I’m a bit concerned about the warnings about obsolete gems
usage. How can I update rails?

Googling indicates to re-install all gems, or grep for old code and
manually replace. Is there a single command to do that?

thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ rails dummy
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create script/process
create test/fixtures
create test/functional
create test/integration
create test/mocks/development
create test/mocks/test
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create Rakefile
create README
create app/controllers/application.rb
create app/helpers/application_helper.rb
create test/test_helper.rb
create config/database.yml
create config/routes.rb
create public/.htaccess
create config/boot.rb
create config/environment.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/breakpointer
create script/console
create script/destroy
create script/generate
create script/performance/benchmarker
create script/performance/profiler
create script/process/reaper
create script/process/spawner
create script/runner
create script/server
create script/plugin
create public/dispatch.rb
create public/dispatch.cgi
create public/dispatch.fcgi
create public/404.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log
thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ ruby /home/thufir/rubyCode/dummy/script/
generate
/home/thufir/rubyCode/dummy/script/…/config/boot.rb:28:Warning:
require_gem is obsolete. Use gem instead.
Usage: /home/thufir/rubyCode/dummy/script/generate generator [options]
[args]

General Options:
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already exist.
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on
errors.
-h, --help Show this help message.
-c, --svn Modify files with subversion.
(Note:
svn must be in path)

Installed Generators
Builtin: controller, integration_test, mailer, migration, model,
plugin, scaffold, session_migration, web_service

More are available at http://rubyonrails.org/show/Generators

  1. Download, for example, login_generator.zip
  2. Unzip to directory /home/thufir/.rails/generators/login
    to use the generator with all your Rails apps
    or to /home/thufir/rubyCode/dummy/generators/login
    to use with this app only.
  3. Run generate with no arguments for usage information
    /home/thufir/rubyCode/dummy/script/generate login

Generator gems are also available:

  1. gem search -r generator
  2. gem install login_generator
  3. /home/thufir/rubyCode/dummy/script/generate login

thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ mysql --user=root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>
mysql> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| dummy_development |
| dummy_production |
| dummy_test |
| feed_on_feeds |
| mysql |
| test |
±-------------------+
7 rows in set (0.12 sec)

mysql>
mysql> use dummy_development;
Database changed
mysql>
mysql> describe dummy_development;
ERROR 1146 (42S02): Table ‘dummy_development.dummy_development’ doesn’t
exist
mysql>
mysql> show tables;
Empty set (0.00 sec)

mysql>
mysql> quit
Bye
thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ cat /home/thufir/rubyCode/dummy/config/
database.yml

MySQL (default setup). Versions 4.1 and 5.0 are recommended.

Install the MySQL driver:

gem install mysql

On MacOS X:

gem install mysql – --include=/usr/local/lib

On Windows:

There is no gem for Windows. Install mysql.so from RubyForApache.

http://rubyforge.org/projects/rubyforapache

And be sure to use new-style password hashing:

http://dev.mysql.com/doc/refman/5.0/en/old-client.html

development:
adapter: mysql
database: dummy_development
username: root
password:
host: localhost

Warning: The database defined as ‘test’ will be erased and

re-generated from your development database when you run ‘rake’.

Do not set this db to the same as development or production.

test:
adapter: mysql
database: dummy_test
username: root
password:
host: localhost

production:
adapter: mysql
database: dummy_production
username: root
password:
host: localhost
thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ ruby dummy/script/server
./dummy/script/…/config/boot.rb:28:Warning: require_gem is obsolete.
Use gem instead.
=> Booting WEBrick…
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-11-20 16:45:36] INFO WEBrick 1.3.1
[2007-11-20 16:45:36] INFO ruby 1.8.5 (2006-12-04) [i686-linux]
[2007-11-20 16:45:36] INFO WEBrick::HTTPServer#start: pid=8001
port=3000
127.0.0.1 - - [20/Nov/2007:16:45:45 PST] “GET / HTTP/1.1” 200 7552

  • → /
    127.0.0.1 - - [20/Nov/2007:16:45:45 PST] “GET /javascripts/prototype.js
    HTTP/1.1” 200 55149
    http://localhost:3000/ → /javascripts/prototype.js
    127.0.0.1 - - [20/Nov/2007:16:45:45 PST] “GET /javascripts/effects.js
    HTTP/1.1” 200 32871
    http://localhost:3000/ → /javascripts/effects.js
    127.0.0.1 - - [20/Nov/2007:16:45:46 PST] “GET /images/rails.png
    HTTP/1.1”
    200 1787
    http://localhost:3000/ → /images/rails.png
    127.0.0.1 - - [20/Nov/2007:16:45:48 PST] “GET /rails/info/properties
    HTTP/1.1” 500 60
    http://localhost:3000/ → /rails/info/properties
    [2007-11-20 16:45:55] INFO going to shutdown …
    [2007-11-20 16:45:55] INFO WEBrick::HTTPServer#start done.
    thufir@arrakis ~/rubyCode $
    thufir@arrakis ~/rubyCode $
    thufir@arrakis ~/rubyCode $ cat /etc/gentoo-release
    Gentoo Base System release 1.12.9
    thufir@arrakis ~/rubyCode $
    thufir@arrakis ~/rubyCode $ date
    Tue Nov 20 16:46:02 PST 2007
    thufir@arrakis ~/rubyCode $
    thufir@arrakis ~/rubyCode $

thanks,

Thufir

thufir@arrakis ~ $ gem update rails --include-dependencies

change config/boot.rb line 28 to gem … instead of require_gem.

On Nov 20, 8:23 pm, Ryan [email protected] wrote:

thufir@arrakis ~ $ gem update rails --include-dependencies

change config/boot.rb line 28 to gem … instead of require_gem.
[…]

I might end up doing that, thank you :slight_smile:

-Thufir