--------------050408090007090309090104 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Ryan Davis wrote: > On Mar 25, 2005, at 3:49 PM, Florian Gross wrote: > >> I have code in my Rakefile for uploading releases to RubyForge so that >> they will correctly appear under the project's file release page. >> (E.g. http://rubyforge.org/frs/?group_idU9) >> >> I've however not factored this out into a separate task. Would you >> still be interested in this? > > I am!!! I was just gonna write this soon. > > GIMME! :) I've attached the whole file (used for ruby-breakpoint, BTW) as that particular task depends on the presence of a few constants and other data. You'll probably want to refactor that a bit so that it works in your Rakefile as well, but the basic logic should still apply. The task that does the RubyForge file publishing is :publish_files. If you're going to refactor this into a general task it would be wonderful if you could contribute it to Jim, by the way. --------------050408090007090309090104 Content-Type: text/plain; name akefile" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename akefile" require 'rake' require 'find' readme ile.read("README") Release readme[/^ .+) README$/, 1] || "unknown").tr(" ", "-") Name elease[/\D+/].sub(/\-+$/, "") || "unknown" Version elease[/[\d.]+/] || "unknown" author_string eadme[/ Author\s+(.+)/, 1] || "unknown, unknown / unknown.tld" AuthorName, AuthorMail uthor_string.split(", ") RubyVersion eadme[/ Requirements.+?\* Ruby (.+?)$/m, 1] || "0.0.0" Description readme[/README\s+(.+?)\n\n/m, 1] || "unknown").gsub(/\s+/, " ") Summary escription[/^.+?\./] || "unknown" DocFiles w(README NEWS TODO COPYING GPL) RDocFiles ocFiles - %w(GPL) RDocOpts "--inline-source", "--line-numbers", "--title", Name ] AdditionalFiles ocFiles + %w(setup.rb) VersionFile ainFile ile.join("lib", Name.sub("ruby-", "") + ".rb") RubyForgeProject ame RubyForgeUser flgr" Homepage http://#{RubyForgeProject}.rubyforge.org/" task :none if File.exist?("test") then task :default [:unit_test] desc "Run all the unit tests" task :unit_test do ruby "test/tc_all.rb" end desc "Run the unit tests and create a coverage report" task :coverage ["test/coverage"] directory "test/coverage" file "test/coverage" ["lib", "test"] do sh "rcov.bat test/tc_all.rb -o test/coverage" end else task :unit_test do end task :test do end task :coverage do end end unless File.exist?("bin") then task :bin do end end desc "Publish a new release." task :publish ["upload", "publish_files"] desc "Upload everything to the web." task :upload ["upload_doc", "upload_pages", "upload_release"] desc "Upload the documentation to the web." task :upload_doc ["doc"] do if RubyForgeProject then path /var/www/gforge-projects/#{RubyForgeProject}" sh "pscp -scp -r -C -q doc #{RubyForgeUser}@rubyforge.org:#{path}" end end desc "Upload the release to the web." task :upload_release "release/#{Release}" do if RubyForgeProject then path /var/www/gforge-projects/#{RubyForgeProject}/release/#{Release}/" sh "pscp -scp -r -C -q release/#{Release}/ #{RubyForgeUser}@rubyforge.org:#{path}" end end desc "Upload the web pages to the web." task :upload_pages ["web"] do if RubyForgeProject then path /var/www/gforge-projects/#{RubyForgeProject}" sh "pscp -scp -r -C -q web/* #{RubyForgeUser}@rubyforge.org:#{path}" end end desc "Publish the release files to RubyForge." task :publish_files [:release] do files "md5sum", "gem", "tgz", "zip"].map { |ext| "release/#{Release}.#{ext}" } if RubyForgeProject then require 'net/http' require 'open-uri' changes " if File.exist?("NEWS") then changes_re ^ \s+ #{Regexp.quote(Name)} \s+ #{Regexp.quote(Version)} \s* (.+?) (?: \Z)/mx changes ile.read("NEWS")[changes_re, 1] || "" end project_uri http://rubyforge.org/projects/#{RubyForgeProject}/" project_data pen(project_uri) { |data| data.read } group_id roject_data[/[?&]group_id d+)/, 1] raise "Couldn't get group id" unless group_id # This echos password to shell which is a bit sucky print "#{RubyForgeUser}@rubyforge.org's password: " password TDIN.gets.chomp login_response et::HTTP.start("rubyforge.org", 80) do |http| data "login, "form_loginname RubyForgeUser}", "form_pw password}" ].join("&") http.post("/account/login.php", data) end cookie ogin_response["set-cookie"] raise "Login failed" unless cookie headers "Cookie" cookie } release_uri http://rubyforge.org/frs/admin/?group_id