From 8f58348025919738d106439c7dfd2fb3528e1eba Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Thu, 4 Apr 2013 17:22:42 -0700 Subject: [PATCH] Make the code look within the entire load_from path for bundler.gemspec instead of stopping on 2 tries. --- lib/warbler/traits/bundler.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/warbler/traits/bundler.rb b/lib/warbler/traits/bundler.rb index ef2330a2..d6d7a223 100644 --- a/lib/warbler/traits/bundler.rb +++ b/lib/warbler/traits/bundler.rb @@ -41,8 +41,16 @@ def add_bundler_gems # bundler gemspec from bundler/source.rb if spec.name == "bundler" full_gem_path = Pathname.new(spec.full_gem_path) - tries = 2 - (full_gem_path = full_gem_path.dirname; tries -= 1) while tries > 0 && !full_gem_path.join('bundler.gemspec').exist? + + while !full_gem_path.join('bundler.gemspec').exist? + full_gem_path = full_gem_path.dirname + # if at top of the path, meaning we cannot find bundler.gemspec, abort. + if full_gem_path.to_s=~/^[\.\/]$/ + $stderr.puts("warning: Unable to detect bundler spec under '#{spec.full_gem_path}'' and is sub-dirs") + exit + end + end + spec.loaded_from = full_gem_path.join('bundler.gemspec').to_s # RubyGems 1.8.x: @full_gem_path is cached, so we have to set it def spec.full_gem_path=(p); @full_gem_path = p; end