Results 1 to 1 of 1

Thread: HOWTO: Ruby, Rails, Capistrano

  1. #1
    Join Date
    Oct 2008
    Location
    Durham, NC
    Beans
    3
    Distro
    Ubuntu 8.10 Intrepid Ibex

    HOWTO: Ruby, Rails, Capistrano

    So, I spent about 30 minutes working out how to get Ruby, Rails and Capistrano installed on my desktop. Granted, I'm a relative n00b, so you may be more efficient at it. However, for those newbies out there like me, I wrote a simple bash script to take care of all the dependencies and get it all setup.

    Currently it sets up everything with a SQLite database. As I have time I will add sections for MySQL and PostgreSQL.

    This has been tested and works in my 8.10 Desktop environment (relatively basic install). Please feel free to test on other versions and let me know how it worked.

    Any comments or criticism or corrections are welcome!

    Code:
    #!/bin/bash
    #
    # Written by clcollins
    # Comments, criticism welcome.
    
    # Take database option from command line argument
    # Currently valid: sqlite or <BLANK>
    # Others will error politely
    # Support for MySQL, PostgreSQL
    DB=$1
    
    ## If no database specified in the
    #  command line, then default to
    #  SQLite
    
    if [ "$DB" = "" ] ; then
      DB="sqlite"
      echo "sqlite"
    fi
    
    if [ "$DB" = "sqlite" ] ; then
      # Install necessary aptitude packages
      aptitude -y install build-essential \
                            ruby rubygems ruby1.8-dev \
                            libsqlite3-dev
    
      # Gems 1.3.1 needed for rake
      # Updating here
      gem install rubygems-update
      # Need to run actual update seperately
      /var/lib/gems/1.8/bin/update_rubygems
    
      # Install rake, capistrano, sqlite and rails
      gem install rake capistrano sqlite3-ruby
      gem install -v=2.2.2 rails
      exit 0
    
    else
      # Fill this out with support for MySQL and PostgreSQL
      echo ""
      echo "NOTE: That DB support not setup yet...exiting."
      echo ""
      exit 1
    fi
    Last edited by clcollins; March 24th, 2010 at 07:27 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •