Skip to content

Instantly share code, notes, and snippets.

@DAddYE
Created November 13, 2009 14:04
Show Gist options
  • Save DAddYE/233848 to your computer and use it in GitHub Desktop.
Save DAddYE/233848 to your computer and use it in GitHub Desktop.
# Attempts to require all dependencies with bundler
begin
require 'bundler'
Bundler::Environment.load(root_path + "/Gemfile").require_env(RACK_ENV)
rescue Bundler::DefaultManifestNotFound => e
puts "You didn't create Bundler Gemfile manifest or you are not in a Sinatra application."
end
# Attempts to load budled gems if it fail we try to use system wide gems
begin
require root_path('/../vendor', 'gems', RACK_ENV)
puts "We use bundled gems"
rescue LoadError => e
puts "We use system wide gems"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment