Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Try to avoid infinite loops when loading Gemfiles

  • Loading branch information...
commit 479a77d750697607e9db6905b68d1f6c537d7601 1 parent f95775e
@ndbroadbent authored
View
17 lib/bundler/local_development.rb
@@ -26,6 +26,8 @@ def development_gems
end
class Dsl
+ @@loaded_gemfiles = []
+
alias :gem_without_development :gem
def gem_with_development(name, *args)
if ENV['GEM_DEV']
@@ -36,14 +38,19 @@ def gem_with_development(name, *args)
# Check each local gem's gemspec to see if any dependencies need to be made local
gemspec_path = File.join(dir, name, "#{name}.gemspec")
process_gemspec_dependencies(gemspec_path) if File.exist?(gemspec_path)
+
# Evaluate local gem's Gemfile, if present
gemfile_path = File.join(dir, name, "Gemfile")
- if File.exist?(gemfile_path)
- gemfile = File.read(gemfile_path).
- gsub(/^(source|gemspec).*\s+/, ''). # Strip sources and gemspecs
- gsub(/^\s*gem ['"]rake['"].*/, '') # Strip rake
- eval gemfile
+ if File.exist?(gemfile_path) && !@@loaded_gemfiles.include?(gemfile_path)
+ gemfile_body = File.read(gemfile_path).
+ gsub(/^(source|gemspec).*\s+/, ''). # Strip sources and gemspecs
+ gsub(/^\s*gem ['"]rake['"].*/, '') # Strip rake
+ # Evaluate stripped Gemfile
+ eval gemfile_body
+ # Try to avoid infinite loops
+ @@loaded_gemfiles << gemfile_path
end
+
return gem_without_development name, :path => path
end
end
View
2  lib/bundler_local_development/version.rb
@@ -1,3 +1,3 @@
module BundlerLocalDevelopment
- VERSION = "0.4.0"
+ VERSION = "0.4.1"
end
Please sign in to comment.
Something went wrong with that request. Please try again.