Archive for the ‘sqlite3’ Category

Prepping for @MadisonRuby with RVM JRuby and Rails

@MadisonRuby is finally here. I’m excited to attend the conference at my home state’s capital. It will be a unique opportunity to meet up with many of the contributors and characters known in the Ruby community, and to finally put a voice and face to the name. There will be plenty to learn and do at the conference, and lots of kick-ass people to meet while we’re there.

Before we get to the conference, I figured it would be wise to get my local environment prepped and ready for some mid-conference hacking sessions so I’m not scrambling to install stuff I need while I’m at the conference.

I find that searching through a ton of different blogs to find the right steps to complete can be a pain, especially when under a time crunch at a conference, when you just want to Get Things Done.

If you don’t have a jruby environment installed yet, hopefully you will find my bash script reusable for your environment. The goal is to simply install RVM, JRuby and Rails with one simple step. In addition, I have added the installation of essential Ruby gems that you will need to use in order to develop rails apps in JRuby, like the jdbc activerecord sqlite3 adapter, and even deployment/debugging gems.

This script is intended to be used from your user/home directory. If you encounter any issues using the script, please let me know as soon as possible and we can work towards fixing it before the conference this week. Enjoy! I welcome any kind of feedback. I’ll see you on Thursday, Friday and Saturday in Mad Town!

# Install RVM

curl -s;

# Place RVM in .bash_profile so that it's recognized as a command
echo "[[ -s "/Users/`echo $USER`/.rvm/scripts/rvm" ]] && source "/Users/`echo $USER`/.rvm/scripts/rvm"  # This loads RVM into a shell session." >> .bash_profile

source ~/.bash_profile;

# Install JRuby
rvm install jruby-1.6.5;

# Set JRuby paths in your .bash_profile
echo "export JRUBY_HOME=/Users/`echo $USER`/.rvm/src/jruby-1.6.5" >> .bash_profile
echo "export PATH=$JRUBY_HOME/bin:$PATH" >> .bash_profile

source ~/.bash_profile;

# Activate JRuby
rvm jruby-1.6.5;
rvm use jruby-1.6.5;

# Update the core gem system
gem update --system

# Install core gems needed for rails / jruby development
gem install rails;
gem install jruby-openssl;
gem install activerecord-jdbcsqlite3-adapter;

# Deploy with Capistrano
gem install 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
gem install 'ruby-debug'
gem install 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
gem install 'bj'
gem install 'nokogiri'

JRuby and SQLite3 Living Together

A few days ago I decided to download the Fat Free CRM, an open source Rails based CRM platform. In order to get it going with sqlite3 with JRuby on Rails, there were a couple things I needed to do in order to get started. This solution can be used for any general jruby/rails/sqlite3 that you may have; I only mention this particular application to give some context to the problem.

First of all, you’ll need to install a couple gems.

sudo jruby -S gem install jdbc-sqlite3
sudo jruby -S gem install activerecord-jdbcsqlite3-adapter

Next, you’ll need to configure your config/database.yml file to use the appropriate driver for sqlite3.

  adapter: jdbcsqlite3
  database: db/development.sqlite3
  timeout: 5000

That should solve any dreaded “no such file to load” errors that you encounter.