Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

making ruby apps work with or without gems

I have an application that does require 'sqlite3'. This works if you've installed the sqlite3 package directly. If you instead install it via gem install sqlite3-ruby, it installs into a subdirectory and the require fails; you have to require 'rubygems' first. But that fails to run if you don't have RubyGems installed.

Is there a standard way to make this work? Or should I just prefix all my programs with
begin require 'rubygems' except Exception; end
?

Within a library that uses sqlite, should it also do the same trick? Or should it require that the caller has done this?
Tags: fourth wall, ruby
Subscribe

  • your vcs sucks

    I've been hacking on some Haskell stuff lately that's all managed in darcs and it's reminded me of an observation I made over two years ago now (see…

  • using git grafts to restore svn merge history

    Here's a quick tutorial on using git grafts to fill in implied svn merge history. Say you're using git-svn to track a project, which has a trunk…

  • topgit

    TopGit - A different patch queue manager: this looks like exactly what I've been wishing for! You can express interdependencies between branches,…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 9 comments