From 2afe803348fd006efebb136596d1827835c46a8e Mon Sep 17 00:00:00 2001 From: Tim Vandecasteele Date: Sat, 14 Nov 2015 18:23:32 +0100 Subject: [PATCH] Update to recent bundler, and make it possible to use the same gemfile for the complete project and the specific ocra executable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You can now refer to a gemfile that is structured with groups and only include the gems that are relevant (in the below case ‘tiny_tds’) source 'https://rubygems.org' group :development do gem 'pry' gem ‘ocra’ end gem 'tiny_tds' --- bin/ocra | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/ocra b/bin/ocra index 3e2cb8f9..88999a12 100644 --- a/bin/ocra +++ b/bin/ocra @@ -563,7 +563,9 @@ EOF end ENV['BUNDLE_GEMFILE'] = Ocra.gemfile - Bundler.load.specs.each do |spec| + bundler_definition = Bundler::Definition.build(Bundler::SharedHelpers.default_gemfile, Bundler::SharedHelpers.default_lockfile, nil) + + bundler_definition.specs_for([:default]).each do |spec| Ocra.verbose_msg "From Gemfile, adding gem #{spec.full_name}" gems[spec.name] ||= spec end @@ -579,7 +581,7 @@ EOF if defined?(Gem) # Include Gems that are loaded - Gem.loaded_specs.each { |gemname, spec| gems[gemname] ||= spec } + Gem.loaded_specs.each { |gemname, spec| gems[gemname] ||= spec } unless Ocra.gemfile # Fall back to gem detection (loaded_specs are not population on # all Ruby versions) features.each do |feature|