Hoe::Package

Package plugin for hoe.

Tasks Provided:

install_gem

Install the package as a gem.

prerelease

Hook for pre-release actions like sanity checks.

postrelease

Hook for post-release actions like release announcements.

release

Package and upload the release.

Attributes

need_tar[RW]

Optional: Should package create a tarball? [default: true]

need_zip[RW]

Optional: Should package create a zipfile? [default: false]

Public Instance Methods

define_package_tasks() click to toggle source

Define tasks for plugin.

    # File lib/hoe/package.rb, line 41
41:   def define_package_tasks
42:     prerelease_version
43: 
44:     Gem::PackageTask.new spec do |pkg|
45:       pkg.need_tar = @need_tar
46:       pkg.need_zip = @need_zip
47:     end
48: 
49:     desc 'Install the package as a gem. (opt. NOSUDO=1)'
50:     task :install_gem => [:clean, :package, :check_extra_deps] do
51:       install_gem Dir['pkg/*.gem'].first
52:     end
53: 
54:     desc 'Package and upload; Requires VERSION=x.y.z (optional PRE=a.1)'
55:     task :release => [:prerelease, :release_to, :postrelease]
56: 
57:     # no doco, invisible hook
58:     task :prerelease do
59:       abort "Fix your version before you release" if spec.version =~ /borked/
60:     end
61: 
62:     # no doco, invisible hook
63:     task :release_to
64: 
65:     # no doco, invisible hook
66:     task :postrelease
67: 
68:     desc "Sanity checks for release"
69:     task :release_sanity do
70:       v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
71: 
72:       pre = ENV['PRERELEASE'] || ENV['PRE']
73:       v += ".#{pre}" if pre
74: 
75:       abort "Versions don't match #{v} vs #{version}" if v != version
76:     end
77:   end
initialize_package() click to toggle source

Initialize variables for plugin.

    # File lib/hoe/package.rb, line 33
33:   def initialize_package
34:     self.need_tar ||= false
35:     self.need_zip ||= false
36:   end
install_gem(name, version = nil, rdoc=true) click to toggle source

Install the named gem.

     # File lib/hoe/package.rb, line 90
 90:   def install_gem name, version = nil, rdoc=true
 91:     should_not_sudo = Hoe::WINDOZE || ENV["NOSUDO"] || File.writable?(Gem.dir)
 92:     null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'
 93: 
 94:     gem_cmd = Gem.default_exec_format % 'gem'
 95:     sudo    = 'sudo '                  unless should_not_sudo
 96:     local   = '--local'                unless version
 97:     version = "--version '#{version}'" if     version
 98: 
 99:     cmd  = "#{sudo}#{gem_cmd} install #{local} #{name} #{version}"
100:     cmd += " --no-rdoc --no-ri" unless rdoc
101:     cmd += " #{null_dev}" unless Rake.application.options.trace
102: 
103:     puts cmd if Rake.application.options.trace
104:     system cmd
105:   end
pkg_path() click to toggle source

Returns the path used for packaging. Convenience method for those that need to write a package hook.

    # File lib/hoe/package.rb, line 83
83:   def pkg_path
84:     "pkg/#{spec.full_name}"
85:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.