Package plugin for hoe.
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. |
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 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 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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.