Rakefile in parlement-0.1 vs Rakefile in parlement-0.2

- old
+ new

@@ -1,9 +1,10 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/switchtower.rake, and they will automatically be available to Rake. -require(File.join(File.dirname(__FILE__), 'config', 'boot')) +#require(File.join(File.dirname(__FILE__), 'config', 'boot')) +require(File.join(File.dirname(__FILE__), 'config', 'environment')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'rake/gempackagetask' @@ -11,12 +12,13 @@ require 'tasks/rails' require 'meta_project' require 'rake/contrib/rubyforgepublisher' +require 'meta_project/release/freshmeat' +require 'meta_project/release/raa' - desc "Deploy basic application directories" task :deploy => :environment do # public is missing dirs = %w{ app lib test config} onserver = "manu@vvv:/home/manu/develop/parlement/" @@ -25,11 +27,11 @@ end end PKG_NAME = "parlement" -PKG_VERSION = "0.1" +PKG_VERSION = PARLEMENT_VERSION PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" PKG_FILES = FileList[ '[A-Z]*', 'app/**/*', 'components/**/*', 'config/**/*', 'db/**/*', 'lib/**/*', 'public/**/*', 'script/**/*', 'test/**/*', 'vendor/**/*' @@ -37,11 +39,11 @@ spec = Gem::Specification.new do |s| ## Basic information. s.name = PKG_NAME s.version = PKG_VERSION - s.summary = "Secure Direct Democracy on a forum" + s.summary = "Trusted Direct Democracy on a forum" s.description = <<EOF This is a forum and mailing list project, which aims to be a complete Direct Democracy implementation where everybody can propose polls, vote on them, or delegate their voice to someone else. @@ -76,61 +78,106 @@ pkg.need_zip = true pkg.need_tar = true #pkg.package_files.include("*") end + # Support Tasks ------------------------------------------------------ desc "Look for TODO and FIXME tags in the code" task :todo do Pathname.new(File.dirname(__FILE__)).egrep(/#.*(FIXME|TODO|TBD|DEPRECATED)/) do |match| puts match end end -task :release => [:verify_env_vars, :release_files, :publish_doc, :publish_news, :tag] +#task :release => [:verify_env_vars, :release_files, :publish_doc, :publish_news, :tag] +task :release => [:verify_env_vars, :release_files, :publish_news] task :verify_env_vars do + if not ENV["RUBYFORGE_USER"] + print "rubyforge.org's user: " + ENV["RUBYFORGE_USER"] = STDIN.gets.chomp + end + + # This echos password to shell which is a bit sucky + if ENV["RUBYFORGE_PASSWORD"] + password = ENV["RUBYFORGE_PASSWORD"] + else + print "#{ENV['RUBYFORGE_USER']}@rubyforge.org's password: " + ENV["RUBYFORGE_PASSWORD"] = STDIN.gets.chomp + end + raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER'] raise "RUBYFORGE_PASSWORD environment variable not set!" unless ENV['RUBYFORGE_PASSWORD'] - puts ENV['RUBYFORGE_USER'] - puts ENV['RUBYFORGE_PASSWORD'] + + if not ENV["FRESHMEAT_USER"] + print "freshmeat user: " + ENV["FRESHMEAT_USER"] = STDIN.gets.chomp + end + + # This echos password to shell which is a bit sucky + if ENV["FRESHMEAT_PASSWORD"] + password = ENV["FRESHMEAT_PASSWORD"] + else + print "freshmeat's password: " + ENV["FRESHMEAT_PASSWORD"] = STDIN.gets.chomp + end + end task :publish_doc do - publisher = Rake::RubyForgePublisher.new('xforge', ENV['RUBYFORGE_USER']) + publisher = Rake::RubyForgePublisher.new(PKG_NAME, ENV['RUBYFORGE_USER']) publisher.upload end desc "Release files on RubyForge" task :release_files => [:gem] do - release_files = FileList[ "pkg/#{PKG_FILE_NAME}.gem" ] + release_files = FileList[ "pkg/#{PKG_FILE_NAME}.gem", + "pkg/#{PKG_FILE_NAME}.tgz", + "pkg/#{PKG_FILE_NAME}.zip" ] - Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new('xforge')) do |release| + Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |release| # Never hardcode user name and password in the Rakefile! release.user_name = ENV['RUBYFORGE_USER'] release.password = ENV['RUBYFORGE_PASSWORD'] release.files = release_files.to_a release.release_name = "#{PKG_NAME} #{PKG_VERSION}" # The rest of the options are defaults (among others, release_notes and release_changes, parsed from CHANGES) end end -desc "Publish news on RubyForge" + +desc "Publish news" task :publish_news => [:gem] do - release_files = FileList[ "pkg/#{PKG_FILE_NAME}.gem" ] + Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |news| + # Never hardcode user name and password in the Rakefile! + news.user_name = ENV['RUBYFORGE_USER'] + news.password = ENV['RUBYFORGE_PASSWORD'] + end - Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new('xforge')) do |news| + fm = DevTools::Freshmeat::FreshmeatService.new(ENV['FRESHMEAT_USER'], ENV['FRESHMEAT_PASSWORD']) + fm.get_project_list.each do |p| + puts p + branches = fm.get_branch_list( p.shortName ) + puts branches.inspect + release = fm.get_release( p.shortName, branches[0], p.version ) + puts release + end + puts fm.logout + + """ + Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::Fresh.new(PKG_NAME)) do |news| # Never hardcode user name and password in the Rakefile! news.user_name = ENV['RUBYFORGE_USER'] news.password = ENV['RUBYFORGE_PASSWORD'] end + """ end desc "Tag all the CVS files with the latest release number (REL=x.y.z)" task :tag do reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}" puts "Tagging CVS with [#{reltag}]" sh %{cvs tag #{reltag}} end -