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:
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 = <<EOF Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax. EOF end Rake::GemPackageTask.new(spec) do |pkg| pkg.need_zip = true pkg.need_tar = true end
Create a GEM Package task library. Automatically define the gem if a block is given. If no block is supplied, then define needs to be called to define the task.
# File lib/rake/gempackagetask.rb, line 56 def initialize(gem_spec) init(gem_spec) yield self if block_given? define if block_given? end
Create the Rake tasks and actions specified by this GemPackageTask. (define is automatically called if a block is given to new).
# File lib/rake/gempackagetask.rb, line 73 def define super task :package => [:gem] desc "Build the gem file #{gem_file}" task :gem => ["#{package_dir}/#{gem_file}"] file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do when_writing("Creating GEM") { Gem::Builder.new(gem_spec).build verbose(true) { mv gem_file, "#{package_dir}/#{gem_file}" } } end end
Generated with the Darkfish Rdoc Generator 2.