Rakefile in rubygems-update-0.8.6 vs Rakefile in rubygems-update-0.8.8
- old
+ new
@@ -5,13 +5,27 @@
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/rdoctask'
+def announce(msg='')
+ STDERR.puts msg
+end
+
PKG_NAME = 'rubygems'
-PKG_VERSION = `ruby -Ilib bin/gem environment packageversion`.chomp
+def package_version
+ `ruby -Ilib bin/gem environment packageversion`.chomp
+end
+if ENV['REL']
+ PKG_VERSION = ENV['REL']
+ CURRENT_VERSION = package_version
+else
+ PKG_VERSION = package_version
+ CURRENT_VERSION = PKG_VERSION
+end
+
CLEAN.include("COMMENTS")
CLOBBER.include(
"test/data/one/one-*0.0.1.gem",
"test/temp",
'test/data/gemhome',
@@ -66,14 +80,10 @@
end
# --------------------------------------------------------------------
# Creating a release
-def announce(msg='')
- STDERR.puts msg
-end
-
desc "Make a new release"
task :release => [
:prerelease,
:clobber,
:alltests,
@@ -81,33 +91,33 @@
:package,
:tag] do
announce
announce "**************************************************************"
- announce "* Release #{ENV['REL']} Complete."
+ announce "* Release #{PKG_VERSION} Complete."
announce "* Packages ready to upload."
announce "**************************************************************"
announce
end
# Validate that everything is ready to go for a release.
task :prerelease do
announce
announce "**************************************************************"
- announce "* Making RubyGem Release #{ENV['REL']}"
- announce "* (current version #{PKG_VERSION})"
+ announce "* Making RubyGem Release #{PKG_VERSION}"
+ announce "* (current version #{CURRENT_VERSION})"
announce "**************************************************************"
announce
# Is a release number supplied?
unless ENV['REL']
fail "Usage: rake release REL=x.y.z [REUSE=tag_suffix]"
end
# Is the release different than the current release.
# (or is REUSE set?)
- if PKG_VERSION == ENV['REL'] && ! ENV['REUSE']
+ if PKG_VERSION == CURRENT_VERSION && ! ENV['REUSE']
fail "Current version is #{PKG_VERSION}, must specify REUSE=tag_suffix to reuse version"
end
# Are all source files checked in?
if ENV['RELTEST']
@@ -121,31 +131,39 @@
announce "No outstanding checkins found ... OK"
end
end
task :update_version => [:prerelease] do
- if PKG_VERSION == ENV['REL']
+ if PKG_VERSION == CURRENT_VERSION
announce "No version change ... skipping version update"
else
- announce "Updating RubyGem version to #{ENV['REL']}"
+ announce "Updating RubyGem version to #{PKG_VERSION}"
open("lib/rubygems/rubygems_version.rb", "w") do |f|
f.puts "# DO NOT EDIT"
f.puts "# This file is auto-generated by build scripts."
f.puts "# See: rake update_version"
f.puts "module Gem"
- f.puts " RubyGemsVersion = '#{ENV['REL']}'"
+ f.puts " RubyGemsVersion = '#{PKG_VERSION}'"
f.puts "end"
end
- sh %{cvs commit -m "Updated to version #{ENV['REL']}" lib/rubygems/rubygems_version.rb}
+ if ENV['RELTEST']
+ announce "Release Task Testing, skipping commiting of new version"
+ else
+ sh %{cvs commit -m "Updated to version #{PKG_VERSION}" lib/rubygems/rubygems_version.rb}
+ end
end
end
task :tag => [:prerelease] do
- reltag = "REL_#{ENV['REL'].gsub(/\./, '_')}"
+ reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
announce "Tagging CVS with [#{reltag}]"
- sh %{cvs tag #{reltag}}
+ if ENV['RELTEST']
+ announce "Release Task Testing, skipping CVS tagging"
+ else
+ sh %{cvs tag #{reltag}}
+ end
end
# --------------------------------------------------------------------
# Create a task to build the RDOC documentation tree.
@@ -212,11 +230,11 @@
p.need_tar = true
p.need_zip = true
p.package_files = PKG_FILES
end
-spec = Gem::Specification.new do |s|
+Spec = Gem::Specification.new do |s|
s.name = PKG_NAME + "-update"
s.version = PKG_VERSION
s.summary = "RubyGems Update GEM"
s.description = %{RubyGems is a package management framework for Ruby. This Gem
is a update for the base RubyGems software. You must have a base
@@ -230,10 +248,16 @@
s.rubyforge_project = "rubygems"
s.bindir = "bin" # Use these for applications.
s.executables = ["update_rubygems"]
end
-Rake::GemPackageTask.new(spec) do |p| end
+Rake::GemPackageTask.new(Spec) do |p| end
+
+desc "Build the Gem spec file for the rubygems-update package"
+task :gemspec => "pkg/rubygems-update.gemspec"
+file "pkg/rubygems-update.gemspec" => ["pkg", "Rakefile"] do |t|
+ open(t.name, "w") do |f| f.puts Spec.to_yaml end
+end
# Install RubyGems
desc "Install RubyGems"
task :install do