summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hoe.rb17
-rw-r--r--test/test_hoe.rb34
2 files changed, 18 insertions, 33 deletions
diff --git a/lib/hoe.rb b/lib/hoe.rb
index 853e7c3..5e82975 100644
--- a/lib/hoe.rb
+++ b/lib/hoe.rb
@@ -544,14 +544,7 @@ class Hoe
s.version = version if version
s.summary = summary
s.email = email
- s.homepage = case urls
- when Hash then
- urls["home"] || urls.values.first
- when Array then
- urls.first
- else
- warn "** Unknown urls format: #{urls.inspect}"
- end
+ s.homepage = urls["home"] || urls.values.first
s.description = description
s.files = manifest
s.executables = s.files.grep(/^bin/) { |f| File.basename(f) }
@@ -559,8 +552,8 @@ class Hoe
s.require_paths = dirs unless dirs.empty?
s.rdoc_options = ["--main", readme_file]
s.post_install_message = post_install_message
- s.metadata = urls.select { |name, _| URLS_TO_META_MAP.key? name }.map { |name, link|
- [URLS_TO_META_MAP[name], link]
+ s.metadata = (urls.keys & URLS_TO_META_MAP.keys).map { |name|
+ [URLS_TO_META_MAP[name], urls[name]]
}.to_h
missing "Manifest.txt" if s.files.empty?
@@ -734,7 +727,9 @@ class Hoe
if lines.first =~ /::/ then
Hash[lines.map { |line| line.split(/\s*::\s*/) }]
else
- lines
+ warn "DEPRECATED: Please switch readme to hash format for urls."
+ warn " Only defining 'home' url."
+ { "home" => lines.first }
end
end
diff --git a/test/test_hoe.rb b/test/test_hoe.rb
index 229f39a..8afeccb 100644
--- a/test/test_hoe.rb
+++ b/test/test_hoe.rb
@@ -146,14 +146,9 @@ class TestHoe < Minitest::Test
def test_initialize_intuit
Dir.mktmpdir do |path|
Dir.chdir path do
- open "Manifest.txt", "w" do |io| # sorted
- io.puts "FAQ.rdoc"
- io.puts "History.rdoc"
- io.puts "README.rdoc"
- end
-
- open "README.rdoc", "w" do |io| io.puts "= blah" end
- open "History.rdoc", "w" do |io| io.puts "=== 1.0" end
+ File.write "Manifest.txt", "FAQ.rdoc\nHistory.rdoc\nREADME.rdoc\n"
+ File.write "README.rdoc", "= blah\n\nhome :: http://blah/"
+ File.write "History.rdoc", "=== 1.0"
assert_equal "History.rdoc", hoe.history_file
assert_equal "README.rdoc", hoe.readme_file
@@ -166,15 +161,10 @@ class TestHoe < Minitest::Test
def test_initialize_intuit_ambiguous
Dir.mktmpdir do |path|
Dir.chdir path do
- open "Manifest.txt", "w" do |io|
- io.puts "History.rdoc" # sorted
- io.puts "README.ja.rdoc"
- io.puts "README.rdoc"
- end
-
- open "README.rdoc", "w" do |io| io.puts "= blah" end
- open "README.ja.rdoc", "w" do |io| io.puts "= blah" end
- open "History.rdoc", "w" do |io| io.puts "=== 1.0" end
+ File.write "Manifest.txt", "History.rdoc\nREADME.ja.rdoc\nREADME.rdoc\n"
+ File.write "README.rdoc", "= blah\n\nhome :: http://blah/"
+ File.write "README.ja.rdoc", "= blah\n\nhome :: http://blah/"
+ File.write "History.rdoc", "=== 1.0"
assert_equal "README.ja.rdoc", hoe(:skip_files).readme_file
end
@@ -201,12 +191,12 @@ class TestHoe < Minitest::Test
"* http://docs.seattlerb.org/hoe/Hoe.pdf",
"* http://github.com/jbarnette/hoe-plugin-examples"].join "\n"
- exp = ["https://github.com/seattlerb/hoe",
- "http://docs.seattlerb.org/hoe/",
- "http://docs.seattlerb.org/hoe/Hoe.pdf",
- "http://github.com/jbarnette/hoe-plugin-examples"]
+ exp = { "home" => "https://github.com/seattlerb/hoe" }
+ err = /DEPRECATED: Please switch readme to hash format/
- assert_equal exp, hoe.parse_urls(ary)
+ assert_output "", err do
+ assert_equal exp, hoe.parse_urls(ary)
+ end
end
def test_parse_urls_hash