Difference between revisions of "RVM"
(→Instalējam Rails 3) |
m (→RVM installation) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{TocRight}} |
{{TocRight}} |
||
Ruby Version Manager - |
[http://rvm.beginrescueend.com/ Ruby Version Manager] - allows switching between versions of ruby, gems, rails etc. |
||
== RVM installation == |
|||
⚫ | |||
⚫ | |||
RVM instalācija (paskatamies arī komentārus par .bashrc un return): |
|||
This will download the source and compile the necessary tools, |
|||
⚫ | |||
and will also allow to switch between different versions, for example, ruby-1.8 and ruby-1.9.2. |
|||
⚫ | |||
== Konfigurāciju vadība == |
|||
⚫ | |||
RVM tells you to update your .bashrc. Add the following at the end of the file: |
|||
Kā paskatīties tekošo |
|||
<nowiki>[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"</nowiki> |
|||
RVM is also concerned if you have any 'return' in your .bashrc script. |
|||
Replace it using if and fi as in the RVM comments after its installation. Comment the first line below and add the second. Then add fi at the end of the file. |
|||
# [ -z "$PS1" ] && return |
|||
<nowiki>if [[ -n "$PS1" ]] ; then</nowiki> |
|||
== Upgrading RVM == |
|||
Either from the latest gem |
|||
rvm update |
|||
Or from the head version in repository |
|||
rvm get head |
|||
Do not forget to reload it or reopen the terminal |
|||
rvm reload |
|||
== Configuration management == |
|||
How to check the current configuration |
|||
rvm use |
rvm use |
||
Switch to the default configuration |
|||
Kā pārslēgties uz noklusēto konfigurāciju |
|||
rvm use system |
rvm use system |
||
Switch to another (1.9.2@rails3) configuration |
|||
rvm use 1.9.2@rails3 |
rvm use 1.9.2@rails3 |
||
Create a new (1.9.2) configuration with a (rails3) gemset |
|||
rvm use --create 1.9.2@rails3 |
rvm use --create 1.9.2@rails3 |
||
Making the configuration default |
|||
== Piemērs videi: Ruby 1.9.2 un Rails 3 == |
|||
rvm use 1.9.2@rails3 --default |
|||
== Ruby 1.9.2 and Rails3 (example setup) == |
|||
=== Install Ruby 1.9.2 === |
|||
rvm 1.9.2 |
rvm 1.9.2 |
||
Create Rails 3 gemset and switch to it: |
|||
rvm use --create 1.9.2@rails3 |
rvm use --create 1.9.2@rails3 |
||
=== |
=== Install gems === |
||
* sqlite3 |
|||
==== Sqlite3 ==== |
|||
⚫ | |||
sudo apt-get install sqlite3 libsqlite3-dev |
|||
gem install sqlite3-ruby |
gem install sqlite3-ruby |
||
==== Mysql ==== |
|||
* mysql |
|||
sudo apt-get install mysql |
sudo apt-get install mysql-server libmysqlclient15-dev |
||
gem install mysql |
gem install mysql |
||
==== Postgres ==== |
|||
* postgres (jaunākais gems saucās pg, nevis postgres!) |
|||
(note, the newer gem is "pg", not "postgres"!) |
|||
sudo apt-get install postgresql-server-dev-8.4 |
sudo apt-get install postgresql-server-dev-8.4 |
||
gem install pg |
gem install pg |
||
=== |
=== Rails 3 === |
||
⚫ | |||
=== Instalējam Rails 3 === |
|||
gem install rails |
gem install rails |
||
rails --version |
rails --version |
||
... |
...or without "ri" and "rdoc" documentation (faster) |
||
gem install rails --no-ri --no-rdoc |
gem install rails --no-ri --no-rdoc |
||
=== Other gems as needed === |
|||
⚫ | |||
=== Test and Done === |
|||
Test your installation by making a test application |
|||
rails new tetsApp |
|||
cd testApp |
|||
rails server |
|||
Now check the http://localhost:3000 in your browser. Rail on. |
|||
== More about Rails== |
== More about Rails== |
||
More about [[Rails3]] |
* More local info about [[Rails3]] |
||
* Here is [http://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project a good first tutorial] for the current Rails. |
|||
* A few other installation tutorials: |
|||
** http://rbjl.net/19-rubybuntu-1-installing-ruby-and-rails-on-ubuntu |
Latest revision as of 17:42, 28 December 2010
Ruby Version Manager - allows switching between versions of ruby, gems, rails etc.
RVM installation
First install RVM (Ruby version manager). This will download the source and compile the necessary tools, and will also allow to switch between different versions, for example, ruby-1.8 and ruby-1.9.2.
sudo apt-get install curl git-core bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
RVM tells you to update your .bashrc. Add the following at the end of the file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
RVM is also concerned if you have any 'return' in your .bashrc script. Replace it using if and fi as in the RVM comments after its installation. Comment the first line below and add the second. Then add fi at the end of the file.
# [ -z "$PS1" ] && return if [[ -n "$PS1" ]] ; then
Upgrading RVM
Either from the latest gem
rvm update
Or from the head version in repository
rvm get head
Do not forget to reload it or reopen the terminal
rvm reload
Configuration management
How to check the current configuration
rvm use
Switch to the default configuration
rvm use system
Switch to another (1.9.2@rails3) configuration
rvm use 1.9.2@rails3
Create a new (1.9.2) configuration with a (rails3) gemset
rvm use --create 1.9.2@rails3
Making the configuration default
rvm use 1.9.2@rails3 --default
Ruby 1.9.2 and Rails3 (example setup)
Install Ruby 1.9.2
rvm 1.9.2
Create Rails 3 gemset and switch to it:
rvm use --create 1.9.2@rails3
Install gems
Sqlite3
sudo apt-get install sqlite3 libsqlite3-dev gem install sqlite3-ruby
Mysql
sudo apt-get install mysql-server libmysqlclient15-dev gem install mysql
Postgres
(note, the newer gem is "pg", not "postgres"!)
sudo apt-get install postgresql-server-dev-8.4 gem install pg
Rails 3
gem install rails rails --version
...or without "ri" and "rdoc" documentation (faster)
gem install rails --no-ri --no-rdoc
Other gems as needed
gem install ...
Test and Done
Test your installation by making a test application
rails new tetsApp cd testApp rails server
Now check the http://localhost:3000 in your browser. Rail on.
More about Rails
- More local info about Rails3
- Here is a good first tutorial for the current Rails.
- A few other installation tutorials: