Skip to content
Browse files

Add a rake task to update rubygems version, go live with 1.5.0

  • Loading branch information...
1 parent c06e812 commit d489e637f59f05ce77a1d2ca7b2996f95b91d24f @qrush qrush committed Jan 31, 2011
Showing with 33 additions and 1 deletion.
  1. +1 −1 config/application.rb
  2. +32 −0 lib/tasks/gemcutter.rake
View
2 config/application.rb
@@ -13,7 +13,7 @@
$rubygems_config = YAML.load_file("config/rubygems.yml")[Rails.env].symbolize_keys
HOST = $rubygems_config[:host]
-RUBYGEMS_VERSION = "1.4.1"
+RUBYGEMS_VERSION = "1.5.0"
module Gemcutter
class Application < Rails::Application
View
32 lib/tasks/gemcutter.rake
@@ -179,4 +179,36 @@ namespace :gemcutter do
Pusher.indexer.update_index(source_index)
end
end
+
+ namespace :rubygems do
+ desc "update rubygems. run as: rake gemcutter:rubygems:update VERSION=[version number] RAILS_ENV=[staging|production] S3_KEY=[key] S3_SECRET=[secret]"
+ task :update => :environment do
+ version = ENV["VERSION"]
+ app_path = Rails.root.join("config", "application.rb")
+ old_content = app_path.read
+ new_content = old_content.gsub(/RUBYGEMS_VERSION = "(.*)"/, %{RUBYGEMS_VERSION = "#{version}"})
+
+ app_path.open("w") do |file|
+ file.write new_content
+ end
+
+ class Updater
+ include Vault
+ end
+
+ updater = Updater.new
+ html = Nokogiri.parse(open("http://rubyforge.org/frs/?group_id=126"))
+ links = html.css("a[href*='#{version}']").map { |n| n["href"] }
+ links.each do |link|
+ url = "http://rubyforge.org#{link}"
+
+ puts "Uploading #{url}..."
+ updater.directory.files.create({
+ :body => open(url).read,
+ :key => "rubygems/#{File.basename(url)}",
+ :public => true
+ })
+ end
+ end
+ end
end

0 comments on commit d489e63

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