How to Remove Ruby on Rails 4 Beta

How do I completely uninstall rails, ruby and rubygems?

I suggest you to simply uninstall all Gems using gem uninstall [name_of_gem], then use RVM to install a new Ruby version and make it the default one.

RVM also makes incredibly easy to remove a Ruby version and all its data since it installs everything in a folder within your home directory.

Remove ActiveRecord in Rails 3

I'm going by this from reading the source, so let me know if it actually worked. :)

The rails command that generates the application template now has an option -O, which tells it to skip ActiveRecord.

If you don't feel like rerunning rails, you should check the following in your existing app:

  • Check that your config/application.rb doesn't have require 'rails/all' or require "active_record/railtie". Instead, for a standard Rails setup without ActiveRecord, it should have only the following requires:

    require File.expand_path('../boot', __FILE__)

    require "action_controller/railtie"
    require "action_mailer/railtie"
    require "active_resource/railtie"
    require "rails/test_unit/railtie"
    require "sprockets/railtie"

    # Auto-require default libraries and those for the current Rails environment.
    Bundler.require :default, Rails.env
  • If, in config/application.rb, you are using the config.generators section, make sure it doesn't have the line g.orm :active_record. You can set this explicitly to nil, if you want, but this should be the default when g.orm is completely omitted.

  • Optional, but in your Gemfile, remove the gem line that loads the module for your database. This could be the line gem "mysql" for example.

How can I start my Ruby environment from scratch?

I would try to start from scratch. Check which rvms you have installed:

$rvm list

and you should get something like this:

rvm rubies

jruby-1.5.5 [ x86_64-java ]
ree-1.8.7-2010.02 [ x86_64 ]
ruby-1.8.6-p399 [ x86_64 ]
ruby-1.8.7-p299 [ x86_64 ]
=> ruby-1.8.7-p302 [ x86_64 ]
ruby-1.9.2-p0 [ x86_64 ]

Do a rvm uninstall on each piece:

$rvm uninstall 1.8.7
$rvm uninstall 1.9.2

Install Ruby 1.8.7:

$ rvm install 1.8.7

Install latest Ruby 1.9.2:

$ rvm install 1.9.2

Set your default (or 1.8.7 if u want that):

$ rvm use 1.9.2 --default

Install PostgreSQL and SQLite gems (assume snow leopard):

$ env ARCHFLAGS="-arch x86_64" gem install pg sqlite3-ruby

Install Rails 3 (includes Bundler):

$ gem install rails

If you are in a rails 2x project:

$rvm use 1.8.7

If you are in a rails 3 project:

$rvm use 1.9.2

When you are in each rvm, load the gems associated to the project via 'bundle install' if you are using bundler, or 'rake gems:install' if you have everything dumped into your environment.rb

How to completely wipe rubygems along with rails etc

I've recently had to so just this. I had built up alot of cruft with my system installed ruby and gems and wanted to clean all that out and move everything over to run under rvm for various projects.

1. Clean up old and busted

First thing I did, before messing with rvm (or run rvm system to get back to the system ruby), was to remove all my gems:

gem list | cut -d" " -f1 | xargs gem uninstall -aIx

WARNING: this will uninstall all ruby gems. If you installed as root you may want to switch to root and run this.

2. Install new hotness

Now you can run gem list to see what is left.

Time to install rvm, I recomend blowing away your current install and reinstall fresh:

rm -rf $HOME/.rvm
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Now the real trick is to use gemsets to install rails 3, and this is easy if you follow Waynee Seguin's gist:

rvm update --head
rvm install 1.8.7
rvm --create use 1.8.7@rails3
curl -L http://rvm.beginrescueend.com/gemsets/rails3b3.gems -o rails3b3.gems
rvm gemset import rails3b3.gems

One difference is I use 1.8.7 since I have had issues with 1.9.2-head and RSpec, but 1.8.7 has been smooth.



Related Topics



Leave a reply



Submit