Permalink
Browse files

starting on fixing the index

  • Loading branch information...
1 parent 5df4fb4 commit 62413877fe23beed513a78f0448a1db86696eaff @qrush qrush committed Aug 25, 2009
View
@@ -47,4 +47,8 @@ def update_attributes_from_gem_specification!(spec)
)
end
+ def to_index
+ [rubygem.name, number, platform]
+ end
+
end
@@ -0,0 +1,11 @@
+class TextifySummaries < ActiveRecord::Migration
+ def self.up
+ remove_column :versions, :summary
+ add_column :versions, :summary, :text
+ end
+
+ def self.down
+ remove_column :versions, :summary
+ add_column :versions, :summary, :string
+ end
+end
@@ -0,0 +1,9 @@
+class AddPlatformsToVersions < ActiveRecord::Migration
+ def self.up
+ add_column :versions, :platform, :string
+ end
+
+ def self.down
+ remove_column :versions, :platform
+ end
+end
View
@@ -100,8 +100,9 @@
t.integer "rubygem_id"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "summary"
t.string "rubyforge_project"
+ t.text "summary"
+ t.string "platform"
end
add_index "versions", ["rubygem_id"], :name => "index_versions_on_rubygem_id"
View
@@ -26,6 +26,47 @@ namespace :gemcutter do
task :update => :environment do
Gemcutter.indexer.update_index
end
+
+ desc "fix the index"
+ task :reprocess => :environment do
+ specs = []
+ latest_specs = []
+ Rubygem.all.each do |rubygem|
+ rubygem.versions.each do |version|
+
+ install = "#{rubygem.name}-#{version.number}"
+ quick_path = "quick/Marshal.#{Gem.marshal_version}/#{install}.gemspec.rz"
+
+ if VaultObject.exists?(quick_path)
+ puts ">> Processing #{install}"
+ spec = Marshal.load(Gem.inflate(VaultObject.value(quick_path)))
+ version.description = spec.description
+ version.summary = spec.summary
+ version.number = spec.version.to_s
+
+ platform = spec.original_platform
+ platform = Gem::Platform::RUBY if platform.nil? or platform.empty?
+ version.platform = platform
+ version.save
+
+ spec.development_dependencies.each { |dep| version.dependencies.create_from_gem_dependency!(dep) }
+
+ latest_specs << version.to_index
+ specs << version.to_index
+ else
+ puts ">> BAD GEM: #{install}"
+ end
+
+ p latest_specs
+ puts ">>> latest: #{latest_specs.size}"
+ puts ">>> all: #{specs.size}"
+ end
+ end
+
+ puts ">> ding, gems are done!"
+ File.open("/tmp/latest_specs", "wb") { |f| f.write Marshal.dump(latest_specs) }
+ File.open("/tmp/specs", "wb") { |f| f.write Marshal.dump(specs) }
+ end
end
desc "Look for migrations and try to match the key"
View
@@ -8,7 +8,7 @@ def store
end
def source_path
- "specs.#{Gem.marshal_version}.gz"
+ "source_index"
end
def source_index

0 comments on commit 6241387

Please sign in to comment.