diff options
-rw-r--r-- | History.rdoc (renamed from History.txt) | 0 | ||||
-rw-r--r-- | Manifest.txt | 5 | ||||
-rw-r--r-- | README.rdoc (renamed from README.txt) | 0 | ||||
-rw-r--r-- | Rakefile | 9 | ||||
-rw-r--r-- | lib/hoe/rdoc.rb | 13 | ||||
-rw-r--r-- | test/test_hoe.rb | 70 | ||||
-rw-r--r-- | test/test_hoe_publish.rb | 7 |
7 files changed, 43 insertions, 61 deletions
diff --git a/History.txt b/History.rdoc index 11d12ef..11d12ef 100644 --- a/History.txt +++ b/History.rdoc diff --git a/Manifest.txt b/Manifest.txt index 1ae9334..69c5654 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -1,8 +1,8 @@ .autotest -History.txt +History.rdoc Hoe.pdf Manifest.txt -README.txt +README.rdoc Rakefile bin/sow lib/hoe.rb @@ -21,6 +21,7 @@ lib/hoe/publish.rb lib/hoe/racc.rb lib/hoe/rake.rb lib/hoe/rcov.rb +lib/hoe/rdoc.rb lib/hoe/signing.rb lib/hoe/test.rb template/.autotest.erb @@ -5,6 +5,7 @@ require './lib/hoe.rb' Hoe.plugin :seattlerb Hoe.plugin :isolate +Hoe.plugin :rdoc Hoe.spec "hoe" do developer "Ryan Davis", "ryand-ruby@zenspider.com" @@ -39,11 +40,9 @@ task :known_plugins do end end -[:redocs, :docs].each do |t| - task t do - cp "Hoe.pdf", "doc" - sh "chmod ug+w doc/Hoe.pdf" - end +task :docs do + cp "Hoe.pdf", "doc" + sh "chmod ug+w doc/Hoe.pdf" end # vim: syntax=ruby diff --git a/lib/hoe/rdoc.rb b/lib/hoe/rdoc.rb new file mode 100644 index 0000000..9d91310 --- /dev/null +++ b/lib/hoe/rdoc.rb @@ -0,0 +1,13 @@ +## +# RDoc plugin for hoe. Switches default text files to rdoc. + +module Hoe::Rdoc + def initialize_rdoc + self.readme_file = self.readme_file.sub(/\.txt$/, ".rdoc") + self.history_file = self.history_file.sub(/\.txt$/, ".rdoc") + end + + def define_rdoc_tasks + # do nothing + end +end diff --git a/test/test_hoe.rb b/test/test_hoe.rb index dac9f5f..0ca0d1e 100644 --- a/test/test_hoe.rb +++ b/test/test_hoe.rb @@ -11,10 +11,14 @@ end $rakefile = nil # shuts up a warning in rdoctask.rb class TestHoe < Minitest::Test - def hoe - @hoe ||= Hoe.spec("blah") do - developer 'author', 'email' - license 'MIT' + def hoe(*skips, &b) + @hoe ||= Hoe.spec "blah" do + developer "author", "email" + license "MIT" unless skips.include? :skip_license + self.version = "1.0" unless skips.include? :skip_version + self.readme_file = "README.rdoc" unless skips.include? :skip_files + self.history_file = "History.rdoc" unless skips.include? :skip_files + self.instance_eval(&b) if b end end @@ -151,12 +155,6 @@ class TestHoe < Minitest::Test open 'README.rdoc', 'w' do |io| io.puts '= blah' end open 'History.rdoc', 'w' do |io| io.puts '=== 1.0' end - hoe = Hoe.spec 'blah' do - self.version = '1.0' - developer 'nobody', 'nobody@example' - license 'MIT' - end - assert_equal 'History.rdoc', hoe.history_file assert_equal 'README.rdoc', hoe.readme_file assert_equal %w[FAQ.rdoc History.rdoc README.rdoc], @@ -178,13 +176,7 @@ class TestHoe < Minitest::Test open 'README.ja.rdoc', 'w' do |io| io.puts '= blah' end open 'History.rdoc', 'w' do |io| io.puts '=== 1.0' end - hoe = Hoe.spec 'blah' do - self.version = '1.0' - developer 'nobody', 'nobody@example' - license 'MIT' - end - - assert_equal 'README.ja.rdoc', hoe.readme_file + assert_equal 'README.ja.rdoc', hoe(:skip_files).readme_file end end end @@ -237,10 +229,9 @@ class TestHoe < Minitest::Test def test_possibly_better t = Gem::Specification::TODAY - hoe = Hoe.spec("blah") do + + hoe = self.hoe do self.version = '1.2.3' - developer 'author', 'email' - license 'MIT' end files = File.read("Manifest.txt").split(/\n/) + [".gemtest"] @@ -258,7 +249,7 @@ class TestHoe < Minitest::Test assert_equal urls, hoe.urls - text_files = files.grep(/txt$/).reject { |f| f =~ /template/ } + text_files = files.grep(/(txt|rdoc)$/).reject { |f| f =~ /template/ } assert_equal 'blah', spec.name assert_equal '1.2.3', spec.version.to_s @@ -272,7 +263,7 @@ class TestHoe < Minitest::Test assert_equal text_files, spec.extra_rdoc_files assert_equal files.sort, spec.files.sort assert_equal urls["home"], spec.homepage - assert_equal ['--main', 'README.txt'], spec.rdoc_options + assert_equal ['--main', 'README.rdoc'], spec.rdoc_options assert_equal ['lib'], spec.require_paths assert_equal Gem::RubyGemsVersion, spec.rubygems_version assert_match(/^Hoe.*Rakefiles$/, spec.summary) @@ -292,12 +283,7 @@ class TestHoe < Minitest::Test def test_no_license out, err = capture_io do - hoe = Hoe.spec("blah") do - self.version = '1.2.3' - developer 'author', 'email' - end - - assert_equal ["MIT"], hoe.spec.licenses + assert_equal ["MIT"], self.hoe(:skip_license).spec.licenses end assert_equal "", out @@ -305,21 +291,13 @@ class TestHoe < Minitest::Test end def test_license - hoe = Hoe.spec("blah") do - self.version = '1.2.3' - developer 'author', 'email' - license 'MIT' - end - - spec = hoe.spec + spec = self.hoe.spec assert_equal %w(MIT), spec.licenses end def test_multiple_calls_to_license - hoe = Hoe.spec("blah") do - self.version = '1.2.3' - developer 'author', 'email' + hoe = self.hoe :skip_license do license 'MIT' license 'GPL-2' end @@ -330,9 +308,7 @@ class TestHoe < Minitest::Test end def test_setting_licenses - hoe = Hoe.spec("blah") do - self.version = '1.2.3' - developer 'author', 'email' + hoe = self.hoe :skip_license do self.licenses = ['MIT', 'GPL-2'] end @@ -352,11 +328,6 @@ class TestHoe < Minitest::Test end def test_read_manifest - hoe = Hoe.spec 'blah' do - developer 'author', 'email' - license 'MIT' - end - expected = File.read_utf('Manifest.txt').split assert_equal expected, hoe.read_manifest @@ -374,11 +345,7 @@ class TestHoe < Minitest::Test end def test_nosudo - hoe = Hoe.spec("blah") do - self.version = '1.2.3' - developer 'author', 'email' - license 'MIT' - + hoe = self.hoe do def system cmd cmd end @@ -433,5 +400,4 @@ class TestHoe < Minitest::Test File.delete overrides_rcfile if File.exist?( overrides_rcfile ) ENV['HOME'] = home end - end diff --git a/test/test_hoe_publish.rb b/test/test_hoe_publish.rb index ee81edd..1d243aa 100644 --- a/test/test_hoe_publish.rb +++ b/test/test_hoe_publish.rb @@ -12,15 +12,18 @@ class TestHoePublish < Minitest::Test end end + make_my_diffs_pretty! + def test_make_rdoc_cmd expected = %W[ #{Gem.bin_wrapper "rdoc"} --title blah-1.0\ Documentation -o doc - --main README.txt + --main README.rdoc lib - History.txt Manifest.txt README.txt + History.rdoc Manifest.txt README.rdoc ] + assert_equal expected, @hoe.make_rdoc_cmd end end |