Skip to content

Commit

Permalink
Wrapping up the update task
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Aug 5, 2009
1 parent 42b7d93 commit 21877dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Rakefile
Expand Up @@ -8,3 +8,5 @@ require 'tasks/rails'

desc "Run all tests and features"
task :default => ['gemcutter:index:create', :test, :features]

task :cron => ['gemcutter:update']
19 changes: 15 additions & 4 deletions lib/tasks/gemcutter.rake
Expand Up @@ -195,7 +195,11 @@ namespace :gemcutter do

desc 'Get the latest gems from rubyforge and index them here'
task :update => :environment do
return unless Rails.env.production?

require 'open-uri'
require 'rubygems/commands/list_command'

ins = StringIO.new
outs = StringIO.new
Gem::DefaultUserInteraction.ui = Gem::StreamUI.new(ins, outs)
Expand Down Expand Up @@ -224,10 +228,17 @@ namespace :gemcutter do
downloads << "#{name}-#{version}.gem"
end
end
puts downloads.size
downloads.each { |d| puts d }
# cutter = Gemcutter.new(nil, StringIO.new(File.open(path).read))
# cutter.pull_spec and cutter.find and cutter.save

end

downloads.each do |download|
puts "Downloading #{download}..."
begin
cutter = Gemcutter.new(nil, StringIO.new(open("http://gems.rubyforge.org/gems/#{download}").read))
cutter.pull_spec and cutter.find and cutter.build and cutter.save
rescue Exception => e
puts e.message
end
end
end
end

0 comments on commit 21877dd

Please sign in to comment.