Rakefile in rscm-0.3.0 vs Rakefile in rscm-0.3.1

- old
+ new

@@ -4,30 +4,31 @@ require 'rake/rdoctask' require 'rake/packagetask' require 'rake/gempackagetask' require 'rake/contrib/sshpublisher' require 'rake/contrib/rubyforgepublisher' -require 'xforge' +require 'meta_project' PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' PKG_NAME = 'rscm' -PKG_VERSION = '0.3.0' + PKG_BUILD +PKG_VERSION = '0.3.1' + PKG_BUILD PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" desc "Default Task" -task :default => [ :all ] -task :all => [:ant, :gem] +task :default => [:gem] +#task :gem => [:test] +task :test => [:starteam] # Run the unit tests # To run a specific test: rake test TEST=path/to/test fl = FileList.new('test/**/*_test.rb') fl.exclude('test/**/mooky*.rb') -#fl.exclude('test/**/monotone*.rb') # Incomplete/unsupported for now - reactivate when more complete! +fl.exclude('test/**/monotone*.rb') # Incomplete/unsupported for now - reactivate when more complete! fl.exclude('test/**/clearcase*.rb') # Incomplete/unsupported for now - reactivate when more complete! fl.exclude('test/**/darcs*.rb') # Incomplete/unsupported for now - reactivate when more complete! -#fl.exclude('test/**/perforce*.rb') # Incomplete/unsupported for now - reactivate when more complete! -#fl.exclude('test/**/p4client*.rb') # Incomplete/unsupported for now - reactivate when more complete! +fl.exclude('test/**/perforce*.rb') # Incomplete/unsupported for now - reactivate when more complete! +fl.exclude('test/**/p4client*.rb') # Incomplete/unsupported for now - reactivate when more complete! fl.exclude('test/**/starteam*.rb') # Too bloody hard to test without a StarTeam server license! Tested ad-hoc. Rake::TestTask.new { |t| t.libs << "test" t.test_files = fl t.verbose = true @@ -35,18 +36,18 @@ rd = Rake::RDocTask.new { |rdoc| rdoc.title = 'RSCM - Ruby Source Control Management API' rdoc.options << '--line-numbers' << '--inline-source' rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('CHANGELOG') + rdoc.rdoc_files.include('CHANGES') rdoc.rdoc_files.include('lib/**/*.rb') rdoc.rdoc_files.include('docs/**/*.rd') } -task :ant do |t| +task :starteam do |t| if(!ENV['RSCM_STARTEAM']) - puts "WARNING - NOT BUILDING STARTEAM SUPPORT SINCE 'RSCM_STARTEAM' IS NOT DEFINED." + puts "WARNING - NOT BUILDING STARTEAM SUPPORT SINCE 'RSCM_STARTEAM' IS NOT DEFINED. It should point to the StarTeam SDK directory" else ant = RUBY_PLATFORM == "i386-mswin32" ? "ant.bat" : system("which ant.sh") ? "ant.sh" : "ant" IO.popen("#{ant} -f ext/java/build.xml clean jar") do |io| io.each_line do |line| puts line @@ -108,25 +109,45 @@ pkg.need_zip = true pkg.need_tar = true end end -task :release => [:publish_doc, :publish_files] +task :release => [:verify_env_vars, :release_files, :publish_doc, :publish_news] -task :publish_files => [:gem] do +task :verify_env_vars do + raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER'] + raise "RUBYFORGE_PASSWORD environment variable not set!" unless ENV['RUBYFORGE_PASSWORD'] +end + +desc "Release files on RubyForge" +task :release_files => [:gem] do release_files = FileList[ - "pkg/#{PKG_FILE_NAME}.gem", - "CHANGES" + "pkg/#{PKG_FILE_NAME}.gem" ] - Rake::XForge::Release.new(PKG_NAME) do |xf| - # Never hardcode user name and password in the Rakefile! - xf.user_name = ENV['RUBYFORGE_USER'] - xf.password = ENV['RUBYFORGE_PASSWORD'] - xf.files = release_files.to_a - xf.release_name = "XForge #{PKG_VERSION}" - end + 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_FILE_NAME + # The rest of the options are defaults (among others, release_notes and release_changes, parsed from CHANGES) + end end task :publish_doc => [:rdoc] do - publisher = Rake::RubyForgePublisher.new('rscm', 'aslak_hellesoy') + publisher = Rake::RubyForgePublisher.new(PKG_NAME, ENV['RUBYFORGE_USER']) + publisher.upload +end + +desc "Publish news on RubyForge" +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 end