Ruby1.9.2 On Rails3.0.0

阅读更多

Ruby1.9.2 On Rails3.0.0



Required:
sudo aptitude install bison
sudo aptitude install libmysqlclient-dev
sudo aptitude install libxml2-dev libxslt-dev

sudo aptitude install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev


1. Install ruby 1.9.2 and rails3 -- In rvm

You should install the git or ruby && gem

1) Install rvm with Git

> bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )


2) Install rvm with gem

>sudo gem install rvm

>rvm-install


3) Add this line to the end of .bashrc:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

The above will make the environment correct for all new terminal windows. In order to make the environment correct for the current terminal, execute this:
source "$HOME/.rvm/scripts/rvm"

4) Install ruby 1.9.2
> rvm package install readline
> rvm install 1.9.2
> rvm 1.9.2
> ruby -v


5) Install rails3 and dependences


> gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
> gem install rails


6) Install rspec 2.0.0beta

> gem install rspec --prerelease
> gem install rspec-rails --prerelease


Done

Hopefully everything worked:


> ruby -v

  ruby 1.9.2p0

> rails --version

  Rails 3.0.0


Switching back to your system Ruby


>rvm system

Back to your Rails3.0 environment


>rvm 1.9.2

Use your RVM environment as your Default

>rvm 1.9.2 --default


2. Create a new app

> rails new AC_rails3 -d mysql

> cd AC_rails3

> bundle install

> rails server

 


3. Rspec


To configure your app to use rspec-rails, add a declaration to your Gemfile.
  If you are using Bundler's grouping feature in your Gemfile, be sure to include
  rspec-rails in the :development group as well as the :test group so that you
  can access its generators and rake tasks.

#{RAILS_PATH}/Gemfile
Add

    group :development, :test do
      gem "rspec-rails", ">= 2.0.0.beta.19"
      gem "webrat"
    end


  Be sure to run the following command in each of your Rails apps if you're
  upgrading:

   > script/rails generate rspec:install


You should set config, let it autoload lib.

config/application.rb

config.autoload_paths += %W(#{config.root}/lib)



4. RESTful_authentication For Rails3

http://github.com/Satish/restful-authentication

 

你可能感兴趣的:(rspec,Rails,Ruby,Rack,Git)