Enable a per-project RVM configuration file
NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:
$ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."
The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.
Approach A: Bitnami installations using system packages
Bitnami installations using system packages don’t include RVM, but rbenv. Refer to this guide for usage instructions.
Approach B: Self-contained Bitnami installations
This feature allows developers to define project-specific settings such as the Ruby version and dems to use. Those settings will be loaded when entering the project directory.
To enable this feature, follow these steps:
Edit the file /opt/bitnami/rvm/.rvmrc and change the property rvm_project_rvmrc=0 to rvm_project_rvmrc=1. The result will be similar to the output below:
export rvm_project_rvmrc=1 export rvm_bin_path="/home/bitrock/rubystack-3.2.3-0/rvm/bin" export rvm_usr_path="/home/bitrock/rubystack-3.2.3-0/common" export rvm_patch_names="osx-arch-fix" export rvm_path="/home/bitrock/rubystack-3.2.3-0/rvm" export rvm_prefix="/home/bitrock/rubystack-3.2.3-0"
After enabling this feature, when entering a directory containing an .rvmrc file, you will receive a warning message asking for permissions to use the .rvmrc file:
==================================================================================== = NOTICE = ==================================================================================== = RVM has encountered a new or modified .rvmrc file in the current directory = = This is a shell script and therefore may contain any shell commands. = = = = Examine the contents of this file carefully to be sure the contents are = = safe before trusting it! ( Choose v[iew] below to view the contents ) = ==================================================================================== Do you wish to trust this .rvmrc file? (/home/bitrock/rubystack-3.2.3-0/rvm/.rvmrc) y[es], n[o], v[iew], c[ancel]>
If you know the contents of the file and that it is safe, accept. You will receive this message every time a new .rvmrc file is found or when a known .rvmrc file changes.
Change into the project directory and use rvm to create the sample .rvmrc file. For example, if you want to use Ruby 1.9.3 with the gemset bitrock-sample, use thse commands:
$ cd /home/bitrock/projects/rubystack-3.2.3-0 $ rvm --rvmrc --create 1.9.3@bitrock-sample
Leave and re-enter the directory. You will be prompted as above and the configured environment will be loaded. To manually trust the new .rvmrc file, execute this command:
$ rvm rvmrc trust