diff options
author | Ryan Davis <ryand@zenspider.com> | 2020-02-11 10:38:27 -0800 |
---|---|---|
committer | Ryan Davis <ryand@zenspider.com> | 2020-02-11 10:38:27 -0800 |
commit | 3fdc40930e7c41d611577c76b75db5e44b1a4c59 (patch) | |
tree | 87c0e13516108af3cbca8852484e651faec8633d | |
parent | 14461497e6f18ae419f54301529b108090468e2d (diff) | |
download | hoe-3fdc40930e7c41d611577c76b75db5e44b1a4c59.tar.gz |
- Avoid calling parse_urls if URL metadata are already set. (flavorjones)
[git-p4: depot-paths = "//src/hoe/dev/": change = 12551]
-rw-r--r-- | lib/hoe.rb | 3 | ||||
-rw-r--r-- | test/test_hoe.rb | 37 |
2 files changed, 38 insertions, 2 deletions
@@ -672,9 +672,8 @@ class Hoe unless readme.empty? then desc = readme.values_at(*description_sections).join("\n\n") summ = desc.split(/\.\s+/).first(summary_sentences).join(". ") - urls = parse_urls(readme.values.first) - self.urls ||= urls + self.urls ||= parse_urls(readme.values.first) self.description ||= desc self.summary ||= summ else diff --git a/test/test_hoe.rb b/test/test_hoe.rb index a39d479..c8d8d3a 100644 --- a/test/test_hoe.rb +++ b/test/test_hoe.rb @@ -1,3 +1,4 @@ +# coding: utf-8 require "minitest/autorun" require "hoe" require "tempfile" @@ -260,6 +261,42 @@ class TestHoe < Minitest::Test assert_equal urls, h.urls end + def test_intuit_values_should_be_silent_if_urls_are_already_set + h = nil + nokogiri_readme = <<~EOM + ## Links + + * https://nokogiri.org + * [Installation Help](https://nokogiri.org/tutorials/installing_nokogiri.html) + * [Tutorials](https://nokogiri.org/tutorials/toc.html) + * [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet) + * [GitHub](https://github.com/sparklemotion/nokogiri) + * [Mailing List](https://groups.google.com/group/nokogiri-talk) + * [Chat/Gitter](https://gitter.im/sparklemotion/nokogiri) + + EOM + + exp = { + "home" => "https://nokogiri.org", + "bugs" => "https://github.com/sparklemotion/nokogiri/issues", + "doco" => "https://nokogiri.org/rdoc/index.html", + "clog" => "https://nokogiri.org/CHANGELOG.html", + "code" => "https://github.com/sparklemotion/nokogiri", + } + + assert_silent do + h = Hoe.spec "blah" do + developer "author", "email" + license "MIT" + + self.urls = exp + self.intuit_values nokogiri_readme + end + end + + assert_equal exp, h.urls + end + def test_metadata hash = [ "home :: https://github.com/seattlerb/hoe", |