From 842b1e5096824bbe6aa3851d73d54cf23bc6b43f Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Sun, 20 Oct 2019 00:19:23 -0800 Subject: + Added support for gemspec metadata. (viraptor) [git-p4: depot-paths = "//src/hoe/dev/": change = 12348] --- lib/hoe.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib') diff --git a/lib/hoe.rb b/lib/hoe.rb index f399e7c..853e7c3 100644 --- a/lib/hoe.rb +++ b/lib/hoe.rb @@ -111,6 +111,18 @@ class Hoe RUBY_FLAGS = ENV["RUBY_FLAGS"] || default_ruby_flags + ## + # Map from the commonly used url names to gemspec's metadata keys + # See https://guides.rubygems.org/specification-reference/#metadata + + URLS_TO_META_MAP = { + "bugs" => "bug_tracker_uri", + "clog" => "changelog_uri", + "doco" => "documentation_uri", + "home" => "homepage_uri", + "code" => "source_code_uri", + } + ## # Default configuration values for .hoerc. Plugins should populate # this on load. @@ -547,6 +559,9 @@ 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] + }.to_h missing "Manifest.txt" if s.files.empty? -- cgit v1.2.1