本文簡要介紹ruby語言中 Gem::PackageTask類
的用法。
基於 Gem::Specification
創建一個包。此任務可以生成 Gem 包以及 zip 文件和 tar/gzipped 包。
除了 Rake::PackageTask 生成的 Rake 目標之外, Gem::PackageTask
還將生成以下任務:
- “
package_dir
/name
-version
.gem” -
使用給定的名稱和版本創建一個RubyGems 包。
使用 Gem::Specification
的示例:
require 'rubygems'
require 'rubygems/package_task'
spec = Gem::Specification.new do |s|
s.summary = "Ruby based make-like utility."
s.name = 'rake'
s.version = PKG_VERSION
s.requirements << 'none'
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
Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
相關用法
- Ruby Pathname.<=>用法及代碼示例
- Ruby Pathname.children用法及代碼示例
- Ruby Pathname.descend用法及代碼示例
- Ruby Pathname.getwd用法及代碼示例
- Ruby Pathname.ascend用法及代碼示例
- Ruby Pathname.pwd用法及代碼示例
- Ruby Pathname.+用法及代碼示例
- Ruby Pathname.sub_ext用法及代碼示例
- Ruby Parser類用法及代碼示例
- Ruby Pathname.glob用法及代碼示例
- Ruby Pathname.entries用法及代碼示例
- Ruby Pathname.join用法及代碼示例
- Ruby Pathname.sub用法及代碼示例
- Ruby Pathname類用法及代碼示例
- Ruby Pathname.each_filename用法及代碼示例
- Ruby Pathname.absolute?用法及代碼示例
- Ruby Pathname.relative?用法及代碼示例
- Ruby Pathname.each_child用法及代碼示例
- Ruby Parser.use_markup用法及代碼示例
- Ruby PrettyPrint.current_group用法及代碼示例
- Ruby Process.groups用法及代碼示例
- Ruby Process.wait2用法及代碼示例
- Ruby Process.getpgrp用法及代碼示例
- Ruby Proc.eql?用法及代碼示例
- Ruby PTY.open用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 PackageTask類。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。