Skip to content
Browse files

cleanup gemcutter.rake

  • Loading branch information...
1 parent 3b8d6e7 commit 7bb6cf11de1b23f229148216f3df888b8d8083ac @qrush qrush committed Apr 14, 2012
Showing with 2 additions and 90 deletions.
  1. +2 −90 lib/tasks/gemcutter.rake
View
92 lib/tasks/gemcutter.rake
@@ -1,25 +1,4 @@
namespace :gemcutter do
- desc "Reorder gem versions"
- task :reorder_versions => :environment do
- current = 1
- count = Rubygem.count
- Rubygem.find_each do |rubygem|
- puts "Reordering #{current}/#{count} - #{rubygem.name}"
- rubygem.reorder_versions
- current += 1
- end
- end
-
- desc "fix full names"
- task :fix_full_names => :environment do
- Version.without_any_callbacks do
- def Version.run_callbacks; "no idea why this is necessary"; end
- Version.all(:include => :rubygem).each do |version|
- version.full_nameify!
- end
- end
- end
-
namespace :index do
desc "Update the index"
task :update => :environment do
@@ -31,87 +10,20 @@ namespace :gemcutter do
b.report(" pre index") { g.upload("prerelease_specs.4.8.gz", g.prerelease_index) }
end
end
-
- desc "benchmark index creation"
- task :benchmark => :environment do
- require 'benchmark'
- puts "Total versions: #{Version.count}"
- Benchmark.bm do|b|
- g = Pusher.new(nil, StringIO.new)
- b.report(" specs index") { g.stringify(g.specs_index) }
- b.report("latest index") { g.stringify(g.latest_index) }
- b.report(" pre index") { g.stringify(g.prerelease_index) }
- end
- end
end
namespace :import do
- desc 'Upload gems to s3 like a boss'
- task :upload => :environment do
- return unless Rails.env.production?
- Version.all.each do |version|
- local_path = File.join(ARGV[1], "#{version.rubygem.name}-#{version.number}.gem")
- if File.exists?(local_path)
- puts "Processing #{local_path}"
- begin
- cutter = Pusher.new(nil, StringIO.new(File.open(local_path).read))
- cutter.pull_spec
- cutter.write
- rescue Exception => e
- puts "Problem uploading #{local_path}: #{e}"
- end
- else
- puts "Couldn't find #{local_path}"
- end
- end
- end
-
desc 'Bring the gems through the gemcutter process'
task :process => :environment do
- gems = Dir[File.join(ARGV[1], "*.gem")].sort.reverse
+ gems = Dir[File.join(ARGV[1] || "#{Gem.path.first}/cache", "*.gem")].sort.reverse
puts "Processing #{gems.size} gems..."
gems.each do |path|
puts "Processing #{path}"
- cutter = Pusher.new(nil, StringIO.new(File.open(path).read))
+ cutter = Pusher.new(nil, File.open(path))
cutter.pull_spec and cutter.find and cutter.save
end
end
-
- desc 'Just create the index and save the gems in the db'
- task :indexify => :environment do
- gems = Dir[File.join(ARGV[1], "*.gem")].sort.reverse
- puts "Processing #{gems.size} gems..."
- source_index = Gem::SourceIndex.new
-
- gems.each do |path|
- puts "Processing #{path}"
- cutter = Pusher.new(nil, StringIO.new(File.open(path).read))
-
- begin
- cutter.pull_spec and cutter.find and cutter.build
- spec_path = File.join(ARGV[1], "#{cutter.rubygem.name}-#{cutter.rubygem.versions.last.to_s}.gem")
-
- if path == spec_path
- cutter.rubygem.save
- spec = cutter.spec
- Pusher.indexer.abbreviate spec
- Pusher.indexer.sanitize spec
- source_index.add_spec(spec, spec.original_name)
- else
- puts "Processed path (#{spec_path}) did not match: #{path}"
- end
- rescue Exception => e
- puts "Bad gem: #{e}"
- end
- end
-
- File.open(Pusher.server_path("source_index"), "wb") do |f|
- f.write Gem.deflate(Marshal.dump(source_index))
- end
-
- Pusher.indexer.update_index(source_index)
- end
end
namespace :rubygems do

0 comments on commit 7bb6cf1

Please sign in to comment.
Something went wrong with that request. Please try again.