RVM, Bash Scripting and Rails 3 Edge


I’ve only begun to tap into the power of bash scripting, but I had a need to automate setting up a Rails 3 app on edge, using RVM like I want.  So I decided to whip up a very simple script that does the following for the name of app you’re creating:

  1. Creates a new RVM gemset for the app
  2. Creates a directory for the app
  3. Creates an .rvmrc file under the new app directory to ensure the proper gemset is used whenever you switch to it
    1. Note: This assumes you have REE 1.8.7 installed under rvm (rvm install ree), which is the main ruby I’m still using for everything
  4. Installs latest prerelease of bundler
  5. Installs latest edge version of rails 3
Here’s the bash script:

</p>

What this quickly gives you is a new Rails 3 app running on edge, with everything installed in its own RVM gemset to keep from polluting the rest of your ruby environments or applications.
Of course I’m no bash expert, so I’d love to hear any improvements or other bash scripting-fu you guys are doing.

 

OSX Terminal Automation