lib/hoe.rb in hoe-1.1.6 vs lib/hoe.rb in hoe-1.1.7
- old
+ new
@@ -5,10 +5,11 @@
require 'rake/contrib/sshpublisher'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'
require 'rbconfig'
+require 'rubyforge'
##
# hoe - a tool to help rake
#
# Hoe is a simple rake/rubygems helper for project Rakefiles. It
@@ -20,20 +21,20 @@
# === Basics
#
# Use this as a minimal starting point:
#
# require 'hoe'
-#
+#
# Hoe.new("project_name", '1.0.0') do |p|
# p.rubyforge_name = "rf_project"
# # add other details here
# end
#
# # add other tasks here
#
# === Tasks Provided:
-#
+#
# * announce - Generate email announcement file and post to rubyforge.
# * audit - Run ZenTest against the package
# * check_manifest - Verify the manifest
# * clean - Clean up all the extras
# * debug_gem - Show information about the gem.
@@ -87,11 +88,11 @@
# * PREFIX - Used to specify a custom install location (for rake install).
# * RUBY_DEBUG - Used to add extra flags to RUBY_FLAGS.
# * RUBY_FLAGS - Used to specify flags to ruby [has smart default].
class Hoe
- VERSION = '1.1.6'
+ VERSION = '1.1.7'
rubyprefix = Config::CONFIG['prefix']
sitelibdir = Config::CONFIG['sitelibdir']
PREFIX = ENV['PREFIX'] || rubyprefix
@@ -126,19 +127,28 @@
self.extra_deps = []
self.spec_extras = {}
self.need_tar = true
self.need_zip = false
+ yield self if block_given?
+
+ hoe_deps = {
+ 'rake' => ">= #{RAKEVERSION}",
+ 'rubyforge' => ">= #{::RubyForge::VERSION}",
+ }
+
+ self.extra_deps = Array(extra_deps) # just in case user used = instead of <<
+ self.extra_deps = [extra_deps] unless
+ extra_deps.empty? or Array === extra_deps.first
if name == 'hoe' then
- extra_deps << ['rake']
- extra_deps << ['rubyforge', '>= 0.3.1']
+ hoe_deps.each do |pkg, version|
+ extra_deps << [pkg, version]
+ end
else
- extra_deps << ['hoe', ">= #{VERSION}"]
+ extra_deps << ['hoe', ">= #{VERSION}"] unless hoe_deps.has_key? name
end
- yield self if block_given?
-
define_tasks
end
def define_tasks
desc 'Run the default tasks'
@@ -257,11 +267,10 @@
desc 'Package and upload the release to rubyforge.'
task :release => [:clean, :package] do |t|
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
abort "Versions don't match #{v} vs #{version}" if v != version
- require 'rubyforge'
pkg = "pkg/#{name}-#{version}"
if $DEBUG then
puts "release_id = rf.add_release #{rubyforge_name.inspect}, #{name.inspect}, #{version.inspect}, \"#{pkg}.tgz\""
puts "rf.add_file #{rubyforge_name.inspect}, #{name.inspect}, release_id, \"#{pkg}.gem\""
@@ -269,11 +278,11 @@
rf = RubyForge.new
puts "Logging in"
rf.login
- c = rf.config
+ c = rf.userconfig
c["release_notes"] = description if description
c["release_changes"] = changes if changes
c["preformatted"] = true
files = [(@need_tar ? "#{pkg}.tgz" : nil),
@@ -306,27 +315,15 @@
sh %q{ rdoc --ri -o ri . }
end
desc 'Publish RDoc to RubyForge'
task :publish_docs => [:clean, :docs] do
- config = YAML.load(File.read(File.expand_path("~/.rubyforge/config.yml")))
- user = "#{config["username"]}@rubyforge.org"
- project = "/var/www/gforge-projects/#{rubyforge_name}"
- project += "/#{name}" if rubyforge_name != name
+ config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
+ host = "#{config["username"]}@rubyforge.org"
+ remote_dir = "/var/www/gforge-projects/#{rubyforge_name}/#{name}"
local_dir = 'doc'
- pub = Rake::SshDirPublisher.new user, project, local_dir
- if rubyforge_name != name then
- def pub.upload
- begin
- super
- rescue
- # project directory probably doesn't exist, transfer as a whole
- sh %{scp -qr #{local_dir} #{host}:#{remote_dir}}
- end
- end
- end
- pub.upload
+ sh %{rsync -av --delete #{local_dir}/ #{host}:#{remote_dir}}
end
############################################################
# Misc/Maintenance:
@@ -382,10 +379,10 @@
f = "Manifest.tmp"
require 'find'
files = []
Find.find '.' do |path|
next unless File.file? path
- next if path =~ /svn|tmp$/
+ next if path =~ /\.svn|tmp$|CVS/
files << path[2..-1]
end
files = files.sort.join "\n"
File.open f, 'w' do |fp| fp.puts files end
system "diff -du Manifest.txt #{f}"