lib/bundler/source.rb in bundler-0.9.21 vs lib/bundler/source.rb in bundler-0.9.22
- old
+ new
@@ -25,10 +25,11 @@
@specs ||= fetch_specs
end
def fetch(spec)
Bundler.ui.debug " * Downloading"
+ spec.fetch_platform
Gem::RemoteFetcher.fetcher.download(spec, uri, Gem.dir)
end
def install(spec)
Bundler.ui.debug " * Installing"
@@ -141,10 +142,11 @@
@specs ||= begin
index = Index.new
Dir["#{@path}/*.gem"].each do |gemfile|
spec = Gem::Format.from_file_by_path(gemfile).spec
+ next unless Gem::Platform.match(spec.platform)
spec.source = self
index << spec
end
index
@@ -248,16 +250,12 @@
private
def generate_bin(spec)
gem_dir = spec.full_gem_path
- gem_file = nil # so we have access after it's set in the block
+ gem_file = Dir.chdir(gem_dir){ Gem::Builder.new(spec).build }
- Dir.chdir(gem_dir) do
- gem_file = Gem::Builder.new(spec).build
- end
-
installer = Gem::Installer.new File.join(gem_dir, gem_file),
:bin_dir => "#{Gem.dir}/bin",
:wrappers => true,
:env_shebang => false,
:format_executable => false
@@ -276,10 +274,12 @@
"repository, please contact #{spec.email} and ask them " \
"to modify their .gemspec so it can work with `gem build`."
end
Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}"
+ ensure
+ Dir.chdir(gem_dir){ FileUtils.rm_rf(gem_file) if gem_file && File.exist?(gem_file) }
end
end
class Git < Path
@@ -372,9 +372,10 @@
end
end
def checkout
unless File.exist?(path.join(".git"))
+ FileUtils.mkdir_p(path.dirname)
git %|clone --no-checkout "#{cache_path}" "#{path}"|
end
Dir.chdir(path) do
git "fetch --force --quiet"
git "reset --hard #{revision}"