summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hoe.rb2
-rw-r--r--lib/hoe/publish.rb20
-rw-r--r--lib/hoe/rcov.rb8
-rw-r--r--test/test_hoe_publish.rb26
4 files changed, 24 insertions, 32 deletions
diff --git a/lib/hoe.rb b/lib/hoe.rb
index b084724..0db79ea 100644
--- a/lib/hoe.rb
+++ b/lib/hoe.rb
@@ -823,5 +823,5 @@ class File
end
def Gem.bin_wrapper name # HACK
- File.join Gem.dir, "bin", Gem.default_exec_format % name
+ File.join Gem.bindir, Gem.default_exec_format % name
end unless Gem.respond_to? :bin_wrapper
diff --git a/lib/hoe/publish.rb b/lib/hoe/publish.rb
index 7abea77..397e673 100644
--- a/lib/hoe/publish.rb
+++ b/lib/hoe/publish.rb
@@ -96,21 +96,19 @@ module Hoe::Publish
self.rsync_args ||= '-av --delete'
end
- def make_rdoc_cmd extra_args = nil
+ def make_rdoc_cmd(*extra_args)
title = "#{name}-#{version} Documentation"
title = "#{rubyforge_name}'s #{title}" if rubyforge_name != name
- rdoc = Gem.bin_path "rdoc", "rdoc"
+ rdoc = Gem.bin_wrapper "rdoc"
- cmd = %W[#{rdoc}
- --title #{title}
- -o #{local_rdoc_dir}
- ] +
+ %W[#{rdoc}
+ --title #{title}
+ -o #{local_rdoc_dir}
+ ] +
spec.rdoc_options +
- Array(extra_args) +
+ extra_args +
spec.require_paths +
spec.extra_rdoc_files
-
- cmd
end
##
@@ -124,12 +122,12 @@ module Hoe::Publish
desc "Generate rdoc"
task :docs => [:clobber_docs, :isolate] do
- ruby(*make_rdoc_cmd)
+ sh(*make_rdoc_cmd)
end
desc "Generate rdoc coverage report"
task :dcov => :isolate do
- ruby make_rdoc_cmd '-C'
+ sh(*make_rdoc_cmd('-C'))
end
desc "Remove RDoc files"
diff --git a/lib/hoe/rcov.rb b/lib/hoe/rcov.rb
index 607414e..8fe9c37 100644
--- a/lib/hoe/rcov.rb
+++ b/lib/hoe/rcov.rb
@@ -18,7 +18,7 @@ module Hoe::RCov
task :isolate # ensure it exists
task :rcov => :isolate do
- ruby make_rcov_cmd
+ sh(*make_rcov_cmd)
end
task :clobber_rcov do
@@ -42,7 +42,7 @@ module Hoe::RCov
end
end
- def make_rcov_cmd extra_args = nil
+ def make_rcov_cmd
rcov = Gem.bin_wrapper "rcov"
tests = test_globs.sort.map { |g| Dir.glob(g) }.flatten.map(&:inspect)
@@ -55,10 +55,10 @@ module Hoe::RCov
-x tmp/isolate
--sort coverage
--sort-reverse
- -o "coverage"
+ -o coverage
] + tests
- cmd.join " "
+ cmd
end
end
diff --git a/test/test_hoe_publish.rb b/test/test_hoe_publish.rb
index c180870..b85858f 100644
--- a/test/test_hoe_publish.rb
+++ b/test/test_hoe_publish.rb
@@ -1,31 +1,25 @@
+require 'rubygems'
require 'minitest/autorun'
require 'hoe'
-Hoe.load_plugins # make sure Hoe::Test is loaded
-
class TestHoePublish < MiniTest::Unit::TestCase
def setup
- Rake.application.clear
-
@hoe = Hoe.spec 'blah' do
self.version = '1.0'
+
developer 'author', ''
end
-
- @hoe.extend Hoe::Publish
end
def test_make_rdoc_cmd
- expected = []
- expected << Gem.bin_path('rdoc', 'rdoc')
- expected << '--title' << 'blah-1.0 Documentation'
- expected.concat %w[-o doc]
- expected.concat %w[--main README.txt]
- expected << 'lib'
- expected.concat %w[History.txt Manifest.txt README.txt]
-
+ expected = %W[
+ #{Gem.bin_wrapper "rdoc"}
+ --title blah-1.0\ Documentation
+ -o doc
+ --main README.txt
+ lib
+ History.txt Manifest.txt README.txt
+ ]
assert_equal expected, @hoe.make_rdoc_cmd
end
-
end
-