Permalink
Browse files

Check each local gem's gemspec to see if any dependencies need to be …

…made local
  • Loading branch information...
1 parent 5567ca5 commit 0d5d197f4f026a659a8630ab261f3a6ef8746bf9 @ndbroadbent committed May 11, 2012
Showing with 13 additions and 1 deletion.
  1. +12 −0 lib/bundler/local_development.rb
  2. +1 −1 lib/bundler_local_development/version.rb
@@ -26,12 +26,24 @@ def gem_with_development(name, *args)
gem_dev_dir = ENV['GEM_DEV_DIR'] || "#{`echo $HOME`.strip}/code/gems"
path = File.join(gem_dev_dir, name)
if File.exist?(path)
+ # Check each local gem's gemspec to see if any dependencies need to be made local
+ gemspec_path = File.join(gem_dev_dir, name, "#{name}.gemspec")
+ process_gemspec_dependencies(gemspec_path, gem_dev_dir) if File.exist?(gemspec_path)
return gem_without_development name, :path => path
end
end
gem_without_development(name, *args)
end
alias :gem :gem_with_development
+
+ private
+ def process_gemspec_dependencies(gemspec_path, gem_dev_dir)
+ spec = Bundler.load_gemspec(gemspec_path)
+ spec.runtime_dependencies.each do |dep|
+ path = File.join(gem_dev_dir, dep.name)
+ gem_without_development(dep.name, :path => path) if File.exist?(path)
+ end
+ end
end
class Definition
@@ -1,3 +1,3 @@
module BundlerLocalDevelopment
- VERSION = "0.1.0"
+ VERSION = "0.2.0"
end

0 comments on commit 0d5d197

Please sign in to comment.