#!/usr/bin/env ruby # Passenger note: this file is copied from Rake 0.8.1. The task names # have been changed. # Define a package task library to aid in the definition of GEM # packages. require 'rubygems' require 'rake' require 'build/packagetask' require 'rubygems/user_interaction' if /^2\./ =~ RUBY_VERSION require 'rubygems/package' else require 'rubygems/builder' end module Rake # Create a package based upon a Gem spec. Gem packages, as well as # zip files and tar/gzipped packages can be produced by this task. # # In addition to the Rake targets generated by PackageTask, a # GemPackageTask will also generate the following tasks: # # ["package_dir/name-version.gem"] # Create a Ruby GEM package with the given name and version. # # Example using a Ruby GEM spec: # # require 'rubygems' # # spec = Gem::Specification.new do |s| # s.platform = Gem::Platform::RUBY # s.summary = "Ruby based make-like utility." # s.name = 'rake' # s.version = PKG_VERSION # s.requirements << 'none' # s.require_path = 'lib' # s.autorequire = 'rake' # s.files = PKG_FILES # s.description = < ['package:gem'] desc "Build the gem file #{gem_file}" task 'package:gem' => ["#{package_dir}/#{gem_file}"] file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do when_writing("Creating GEM") { if /^2\./ =~ RUBY_VERSION Gem::Package.build(gem_spec) else Gem::Builder.new(gem_spec).build end verbose(true) { mv gem_file, "#{package_dir}/#{gem_file}" } } end end def gem_file if @gem_spec.platform == Gem::Platform::RUBY "#{package_name}.gem" else "#{package_name}-#{@gem_spec.platform}.gem" end end end end