Permalink
Browse files

Fixed the way Bundler is used to require dependencies

We don't use `Bundler.setup` and `Bundler.require` any more because
this implies using the locked Gemfile. This may produce errors when the
user environment doesn't match the Gemfile.lock.
  • Loading branch information...
1 parent e1ca21c commit d2ec068ae5e842b81d0e9de0b337c9bb0df3c575 @koraktor committed Jun 11, 2011
Showing with 11 additions and 7 deletions.
  1. +8 −6 lib/metior.rb
  2. +3 −1 lib/metior/vcs.rb
View
@@ -5,12 +5,6 @@
require 'bundler'
-libdir = File.dirname(__FILE__)
-Dir.chdir libdir do
- Bundler.setup
-end
-$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
-
require 'core_ext/object'
require 'metior/git'
require 'metior/github'
@@ -22,6 +16,14 @@
# @author Sebastian Staudt
module Metior
+ # Returns the Bundler runtime to access Metior's dependencies
+ #
+ # @return [Bundler::Runtime] The Bundler runtime instance
+ def self.runtime
+ @@runtime ||= Bundler::Runtime.new File.dirname(__FILE__),
+ Bundler.definition
+ end
+
# Creates a new repository for the given repository type and path
#
# @param [Symbol] type The type of the repository, e.g. `:git`
View
@@ -64,7 +64,9 @@ def const_missing(const)
#
# @see Bundler.require
def init
- Bundler.require self::NAME
+ Metior.runtime.dependencies_for(self::NAME).each do |dep|
+ gem dep.name, dep.requirement
+ end
path = self::NAME.to_s
require "metior/#{path}/actor"

0 comments on commit d2ec068

Please sign in to comment.