16

We are using RVM for managing Ruby installations and environments.

Usually we are using this .rvmrc script:

#!/bin/bash
if [ ! -e '.version' ]; then
  VERSION=`pwd | sed 's/[a-z/-]//g'`
  echo $VERSION > .version
  rvm gemset create $VERSION
fi
VERSION=`cat .version`
rvm use 1.9.2@$VERSION

This script forces RVM to create new gem environment for each our project/version.

But each time we was deploying new version RVM asks us to confirm new .rvmrc file.

When we cd to this directory first time, we are getting something like:

  ===============================================================
  = NOTICE:                                                     =
  ===============================================================
  = RVM has encountered a not yet trusted .rvmrc file in the    =
  = current working directory which may contain nasty code.     =
  =                                                             =
  = Examine the contents of this file to be sure the contents   =
  = are good before trusting it!                                =
  =                                                             =
  = Press 'q' to exit the reader when finished reading the file =
  ===============================================================

  (press enter to continue when ready)

This is not as bad for development environments, but with auto deploy it require to manually confirm each new version on each server.

Is it possible to skip this confirmation?

4 Answers 4

24

I found these notes on Waynes blog, http://wayneeseguin.beginrescueend.com/

Basically, adding:

export rvm_trust_rvmrcs_flag=1

to ~/.rvmrc will bypass the check.

There is also rvm rvmrc <command> [dir] for manually trusting/untrusting .rvmrc files.

Looking for the same thing so thought I'd post the solution.

HTH

Regards,

Phil

1
  • Just what I needed!
    – b01
    Nov 1, 2013 at 12:18
3

In my deployement, I don't use the .rvmrc. I use only rvm use 1.9.2 --default like that I a; sure that my default ruby is 1.9.2 and not another if I am not in this particular directory.

After with the option rvm_project_rvmrc=0 in your rvmrc, you be sure there are no other ruby used.

0
0
$ curl -L https://get.rvm.io | bash -s -- --version 1.16.20

$ rvm --version

rvm 1.16.20 (version) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

$ grep less .rvm/scripts/cli .rvm/bin/rvm-installer .rvm/src/rvm/scripts/cli .rvm/src/rvm/binscripts/rvm-installer
.rvm/scripts/cli:            } | less
.rvm/bin/rvm-installer:    } | less
.rvm/src/rvm/scripts/cli:            } | less
.rvm/src/rvm/binscripts/rvm-installer:    } | less

The fix:

$ sed -i 's/ | less//' .rvm/scripts/cli .rvm/bin/rvm-installer .rvm/src/rvm/scripts/cli .rvm/src/rvm/binscripts/rvm-installer
1
  • I am reviewing this "late answer" and think it is good that you answer this question. The only improvement I could think of is to actually explain the changes the sed command would do.
    – eckes
    Dec 13, 2012 at 2:33
0

Alternative but unexpected exit 0 requires multiple execution

e.g. to install both ruby (without altering original rvm installation) will repeated execution

#!/bin/bash
rvm list | grep ree-1.8.7-2011.12 ||
(  
    rvm install ree-1.8.7-2011.12 &  
    expect "^Press 'q' to continue."  
    send "q\n"
    exp_continue
)

rvm list | grep ruby-1.9.3-p194 ||
(
    rvm install ruby-1.9.3-p194 &
    expect "^Press 'q' to continue."
    send "q\n"
    exp_continue
)
1
  • What did you mean with your answer? What does this code do? @PhilT already answered this question. Dec 11, 2012 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .