[DRE-commits] r2035 - tools/gemsd
daigo at alioth.debian.org
daigo at alioth.debian.org
Mon Nov 5 12:17:32 UTC 2007
Author: daigo
Date: 2007-11-05 12:17:32 +0000 (Mon, 05 Nov 2007)
New Revision: 2035
Modified:
tools/gemsd/dh_rubygems.rb
tools/gemsd/download_gems.rb
Log:
It works with rubygems 0.9.4-4
Modified: tools/gemsd/dh_rubygems.rb
===================================================================
--- tools/gemsd/dh_rubygems.rb 2007-11-04 23:29:36 UTC (rev 2034)
+++ tools/gemsd/dh_rubygems.rb 2007-11-05 12:17:32 UTC (rev 2035)
@@ -168,7 +168,7 @@
save_pwd = Dir.pwd
Dir.chdir(debdir)
begin
- command = "dh_make --createorig --single --packagename #{deb_name} --templates #{tmp_tmpldir}"
+ command = "dh_make --createorig --single --packagename '#{deb_name}' --templates #{tmp_tmpldir}"
IO.popen(command, "w+") do |io|
io.puts "\n"
while l = io.gets do
Modified: tools/gemsd/download_gems.rb
===================================================================
--- tools/gemsd/download_gems.rb 2007-11-04 23:29:36 UTC (rev 2034)
+++ tools/gemsd/download_gems.rb 2007-11-05 12:17:32 UTC (rev 2035)
@@ -28,25 +28,23 @@
require "utils"
-def download_gems(source)
- rsf = Gem::RemoteSourceFetcher.new(source, nil)
- puts "Downloading the index for #{source}..."
- source_index = rsf.source_index
+def download_gems
+ ri = Gem::RemoteInstaller.new({})
+ ri.source_index_hash.each do |source, source_index|
+ puts "Downloading the index for #{source}..."
- gems = {} # {spec.name => spec}
- # Selects the highest versions
- source_index.each do |fullname, spec|
- gems[spec.name] ||= spec
- gems[spec.name] = spec if gems[spec.name].version < spec.version
- end
+ gems = {} # {spec.name => spec}
+ # Selects the highest versions
+ source_index.each do |fullname, spec|
+ gems[spec.name] ||= spec
+ gems[spec.name] = spec if gems[spec.name].version < spec.version
+ end
- gems.each_value do |spec|
- puts "Downloading #{spec.full_name} ..."
- begin
- data = rsf.fetch_path("/gems/#{spec.full_name}.gem")
- File.open(File.join(DIR_DOWNLOAD, "#{spec.full_name}.gem"), "w+") {|f| f.write data}
- rescue OpenURI::HTTPError => e
- puts "OpenURI::HTTPError #{e}"
+ gems.each_value do |spec|
+ puts "Downloading #{spec.full_name} ..."
+ dest_file = File.join(DIR_DOWNLOAD, "#{spec.full_name}.gem")
+ p dest_file
+ ri.download_gem(dest_file, source, spec)
end
end
end
@@ -57,9 +55,6 @@
if __FILE__ == $0
FileUtils.rm_rf(DIR_DOWNLOAD); safe_mkdir(DIR_DOWNLOAD)
- ri = Gem::RemoteInstaller.new({})
- ri.sources.each do |source|
- download_gems(source)
- end
+ download_gems
end
More information about the Pkg-ruby-extras-commits
mailing list