Skip to content
This repository was archived by the owner on Feb 5, 2020. It is now read-only.

Commit 38e884c

Browse files
committed
Added rvmrc.
1 parent 8cefe76 commit 38e884c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.rvmrc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
4+
# development environment upon cd'ing into the directory
5+
6+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7+
# Only full ruby name is supported here, for short names use:
8+
# echo "rvm use 1.9.3" > .rvmrc
9+
environment_id="ruby-1.9.3-p194@growstuffproject"
10+
11+
# Uncomment the following lines if you want to verify rvm version per project
12+
# rvmrc_rvm_version="1.14.10 (stable)" # 1.10.1 seams as a safe start
13+
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14+
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15+
# return 1
16+
# }
17+
18+
# First we attempt to load the desired environment directly from the environment
19+
# file. This is very fast and efficient compared to running through the entire
20+
# CLI and selector. If you want feedback on which environment was used then
21+
# insert the word 'use' after --create as this triggers verbose mode.
22+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24+
then
25+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26+
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27+
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28+
if [[ $- == *i* ]] # check for interactive shells
29+
then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
30+
else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
31+
fi
32+
else
33+
# If the environment file has not yet been created, use the RVM CLI to select.
34+
rvm --create use "$environment_id" || {
35+
echo "Failed to create RVM environment '${environment_id}'."
36+
return 1
37+
}
38+
fi
39+
40+
# If you use bundler, this might be useful to you:
41+
# if [[ -s Gemfile ]] && {
42+
# ! builtin command -v bundle >/dev/null ||
43+
# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
44+
# }
45+
# then
46+
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
47+
# gem install bundler
48+
# fi
49+
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
50+
# then
51+
# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
52+
# fi

0 commit comments

Comments
 (0)