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