Skip to content
This repository
Browse code

Added release management to Rakefile

git-svn-id: svn+ssh://rubyforge.org/var/svn/rake/trunk@346 5af023f1-ac1a-0410-98d6-829a145c37ef
  • Loading branch information...
commit da7cb40cb00aafb063109b787e37b63ceaa9273b 1 parent 2e87c16
authored March 25, 2005

Showing 1 changed file with 98 additions and 2 deletions. Show diff stats Hide diff stats

  1. 100  rake/Rakefile
100  rake/Rakefile
@@ -20,15 +20,25 @@ CLEAN.include('**/*.o')
20 20
 CLOBBER.include('doc/example/main', 'testdata')
21 21
 
22 22
 
  23
+def announce(msg='')
  24
+  STDERR.puts msg
  25
+end
23 26
 
24 27
 # Determine the current version of the software
25 28
 
26 29
 if `ruby -Ilib ./bin/rake --version` =~ /\S+$/
27  
-  PKG_VERSION = $&
  30
+  CURRENT_VERSION = $&
  31
+else
  32
+  CURRENT_VERSION = "0.0.0"
  33
+end
  34
+
  35
+if ENV['REL']
  36
+  PKG_VERSION = ENV['REL']
28 37
 else
29  
-  PKG_VERSION = "0.0.0"
  38
+  PKG_VERSION = CURRENT_VERSION
30 39
 end
31 40
 
  41
+
32 42
 SRC_RB = FileList['lib/**/*.rb']
33 43
 
34 44
 # The default task is run if rake is given no explicit arguments.
@@ -257,3 +267,89 @@ task :rubyfiles do
257 267
   puts Dir['**/*.rb'].reject { |fn| fn =~ /^pkg/ }
258 268
   puts Dir['bin/*'].reject { |fn| fn =~ /CVS|(~$)|(\.rb$)/ }
259 269
 end
  270
+
  271
+# --------------------------------------------------------------------
  272
+# Creating a release
  273
+
  274
+desc "Make a new release"
  275
+task :release => [
  276
+  :prerelease,
  277
+  :clobber,
  278
+  :testall,
  279
+  :update_version,
  280
+  :package,
  281
+  :tag] do
  282
+  
  283
+  announce 
  284
+  announce "**************************************************************"
  285
+  announce "* Release #{PKG_VERSION} Complete."
  286
+  announce "* Packages ready to upload."
  287
+  announce "**************************************************************"
  288
+  announce 
  289
+end
  290
+
  291
+# Validate that everything is ready to go for a release.
  292
+task :prerelease do
  293
+  announce 
  294
+  announce "**************************************************************"
  295
+  announce "* Making RubyGem Release #{PKG_VERSION}"
  296
+  announce "* (current version #{CURRENT_VERSION})"
  297
+  announce "**************************************************************"
  298
+  announce  
  299
+
  300
+  # Is a release number supplied?
  301
+  unless ENV['REL']
  302
+    fail "Usage: rake release REL=x.y.z [REUSE=tag_suffix]"
  303
+  end
  304
+
  305
+  # Is the release different than the current release.
  306
+  # (or is REUSE set?)
  307
+  if PKG_VERSION == CURRENT_VERSION && ! ENV['REUSE']
  308
+    fail "Current version is #{PKG_VERSION}, must specify REUSE=tag_suffix to reuse version"
  309
+  end
  310
+
  311
+  # Are all source files checked in?
  312
+  if ENV['RELTEST']
  313
+    announce "Release Task Testing, skipping checked-in file test"
  314
+  else
  315
+    announce "Checking for unchecked-in files..."
  316
+    data = `cvs -q update`
  317
+    unless data =~ /^$/
  318
+      fail "CVS update is not clean ... do you have unchecked-in files?"
  319
+    end
  320
+    announce "No outstanding checkins found ... OK"
  321
+  end
  322
+end
  323
+
  324
+task :update_version => [:prerelease] do
  325
+  if PKG_VERSION == CURRENT_VERSION
  326
+    announce "No version change ... skipping version update"
  327
+  else
  328
+    announce "Updating Rake version to #{PKG_VERSION}"
  329
+    open("lib/rubygems/rubygems_version.rb", "w") do |f|
  330
+      f.puts "# DO NOT EDIT"
  331
+      f.puts "# This file is auto-generated by build scripts."
  332
+      f.puts "# See:  rake update_version"
  333
+      f.puts "module Gem"
  334
+      f.puts "  RubyGemsVersion = '#{PKG_VERSION}'"
  335
+      f.puts "end"
  336
+    end
  337
+    if ENV['RELTEST']
  338
+      announce "Release Task Testing, skipping commiting of new version"
  339
+    else
  340
+      sh %{cvs commit -m "Updated to version #{PKG_VERSION}" lib/rubygems/rubygems_version.rb}
  341
+    end
  342
+  end
  343
+end
  344
+
  345
+task :tag => [:prerelease] do
  346
+  reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
  347
+  reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
  348
+  announce "Tagging CVS with [#{reltag}]"
  349
+  if ENV['RELTEST']
  350
+    announce "Release Task Testing, skipping CVS tagging"
  351
+  else
  352
+    sh %{cvs tag #{reltag}}
  353
+  end
  354
+end
  355
+

0 notes on commit da7cb40

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