lib/bundler/source/rubygems.rb in bundler-1.6.0.pre.2 vs lib/bundler/source/rubygems.rb in bundler-1.6.0.rc
- old
+ new
@@ -112,10 +112,14 @@
spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec"
["Installing #{version_message(spec)}", spec.post_install_message]
end
def cache(spec, custom_path = nil)
+ # Gems bundled with Ruby don't have .gem files cached locally, but it doesn't matter
+ # since they're always going to be installed on this Ruby version.
+ return if builtin_gem?(spec)
+
cached_path = cached_gem(spec)
raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
return if File.dirname(cached_path) == Bundler.app_cache.to_s
Bundler.ui.info " * #{File.basename(cached_path)}"
FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
@@ -271,8 +275,15 @@
ensure
Bundler.rubygems.sources = old
end
end
+ def builtin_gem?(spec)
+ # Ruby 2.1-style
+ return true if spec.summary =~ /is bundled with Ruby/
+
+ # Ruby 2.0 style
+ spec.loaded_from.include?("specifications/default/")
+ end
end
end
end