aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/fetcher
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-12-13 16:28:50 +0800
committerSamuel Giddins <segiddins@segiddins.me>2016-01-25 10:49:36 -0600
commite554ef0746d9669d2a2a4b917d45dbe069b48d02 (patch)
treef34e94ee78332c957035e71c078219653e973037 /lib/bundler/fetcher
parentb907dece4e2af7d3762b5f0906ec3d73f077e0c0 (diff)
downloadbundler-e554ef0746d9669d2a2a4b917d45dbe069b48d02.tar.gz
build spec objects only in Fetcher#specs
Diffstat (limited to 'lib/bundler/fetcher')
-rw-r--r--lib/bundler/fetcher/compact_index.rb12
-rw-r--r--lib/bundler/fetcher/dependency.rb25
2 files changed, 8 insertions, 29 deletions
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb
index d48654d7..7e97d5c5 100644
--- a/lib/bundler/fetcher/compact_index.rb
+++ b/lib/bundler/fetcher/compact_index.rb
@@ -17,7 +17,7 @@ module Bundler
end
def specs_for_names(gem_names)
- gemspecs = []
+ gem_info = []
complete_gems = []
remaining_gems = gem_names.dup
@@ -29,18 +29,12 @@ module Bundler
deps = compact_index_client.dependencies(remaining_gems)
next_gems = deps.flat_map {|d| d[3].flat_map(&:first) }.uniq
-
- deps.each do |contents|
- contents[1] = Gem::Version.new(contents[1])
- contents[3].map! {|name, reqs| Gem::Dependency.new(name, reqs) }
- gemspecs << EndpointSpecification.new(*contents)
- end
-
+ deps.each { |dep| gem_info << dep }
complete_gems.push(*deps.map(&:first).uniq)
remaining_gems = next_gems - complete_gems
end
- gemspecs
+ gem_info
end
def fetch_spec(spec)
diff --git a/lib/bundler/fetcher/dependency.rb b/lib/bundler/fetcher/dependency.rb
index b67f725c..5cd0cd85 100644
--- a/lib/bundler/fetcher/dependency.rb
+++ b/lib/bundler/fetcher/dependency.rb
@@ -52,21 +52,18 @@ module Bundler
gem_list = []
gem_names.each_slice(Source::Rubygems::API_REQUEST_SIZE) do |names|
marshalled_deps = downloader.fetch(dependency_api_uri(names)).body
- gem_list += Bundler.load_marshal(marshalled_deps)
+ gem_list.push(*Bundler.load_marshal(marshalled_deps))
end
gem_list
end
def get_formatted_specs_and_deps(gem_list)
deps_list = []
- spec_list = gem_list.map do |s|
- dependencies = s[:dependencies].map do |name, requirement|
- dep = well_formed_dependency(name, requirement.split(", "))
- deps_list << dep.name
- dep
- end
+ spec_list = []
- [s[:name], Gem::Version.new(s[:number]), s[:platform], dependencies]
+ gem_list.each do |s|
+ deps_list.push(*s[:dependencies].keys)
+ spec_list.push([s[:name], s[:number], s[:platform], s[:dependencies]])
end
[spec_list, deps_list]
end
@@ -77,18 +74,6 @@ module Bundler
uri
end
- def well_formed_dependency(name, *requirements)
- Gem::Dependency.new(name, *requirements)
- rescue ArgumentError => e
- illformed = 'Ill-formed requirement ["#<YAML::Syck::DefaultKey'
- raise e unless e.message.include?(illformed)
- puts # we shouldn't print the error message on the "fetching info" status line
- raise GemspecError,
- "Unfortunately, the gem #{name} has an invalid " \
- "gemspec. \nPlease ask the gem author to yank the bad version to fix " \
- "this issue. For more information, see http://bit.ly/syck-defaultkey."
- end
-
private
def log_specs(query_list)