rvm(ruby version manager)
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
gemset
RVM gives you compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained - from the system, and from each other.
Instructions for initial setup (RVM, gemset)
step 1
sudo apt-get install curl
step 2
\curl -L https://get.rvm.io | bash -s stable
step 3
source ~/.rvm/scripts/rvm
step 4
rvm requirements
step 5
rvm install ruby / rvm install ruby -v 1.9.3
get into rails project directory
step 6
rvm use 1.9.3 (select ruby version)
step 7
rvm gemset create gemset_name
step 8
rvm gemset use gemset_name
step 9
bundle install
(install rails through gem. ex : gem install rails -v '3.2')
once setup is done, follow instructions to select already created gemset.
get into rails project directory
rvm list (shows different ruby version installed)
rvm use ruby_version (ex: rvm use 1.9.3)
rvm gemset list (shows list of gemset created )
rvm gemset use gemset_name (ex: rvm use app)
start installing gems......
now can able to have project specific gems
rvmrc
There are 3 types of rvmrc files: system, user, and project.
System (/etc/rvmrc)
The system rvmrc file is loaded before RVM initializes and before the user's ~/.rvmrc. /etc/rvmrc settings are applied to all users on the system.
User ($HOME/.rvmrc)
The users rvmrc file overwrites settings in /etc/rvmrc and is loaded before RVM initializes. $HOME/.rvmrc settings are applied only for the user belonging to $HOME.
Project (project_directory/.rvmrc)
The project .rvmrc file is different than the system & user. System & user rvmrc files are meant for altering the settings and behavior of RVM as a whole. The project rvmrc files are intended to be used to setup your project's ruby environment when you switch to the project root directory.
As of RVM 1.8.0, after a survey where greater than 80% of respondants wanted the feature on by default, automatic loading of project .rvmrc files is opt-out by default (therefore on).
Instructions for rvmrc (project_directory/.rvmrc)
a. create .rvmrc file in project directory
b. add rvm_version@gemset_name in .rvmrc file. ex: rvm ruby-1.8.7-head@test
Tuesday, 19 August 2014
Ruby on Rails environment settings
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment