lib/hoe.rb in hoe-3.18.1 vs lib/hoe.rb in hoe-3.19.0
- old
+ new
@@ -89,11 +89,11 @@
class Hoe
include Rake::DSL if defined?(Rake::DSL)
# duh
- VERSION = "3.18.1"
+ VERSION = "3.19.0"
@@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package,
:publish, :gemcutter, :signing, :test]
@bad_plugins = []
@@ -110,10 +110,22 @@
# Used to specify flags to ruby [has smart default].
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.
DEFAULT_CONFIG = {
"exclude" => /\/tmp\/|CVS|\.svn|\.git|TAGS|extconf.h|\.bundle$|\.o$|\.log$/,
@@ -242,28 +254,10 @@
# Optional: An array of test file patterns [default: test/**/test_*.rb]
attr_accessor :test_globs
##
- # Deprecated: Optional: The url(s) of the project. (can be array).
- # Auto-populates to a list of urls read from the beginning of
- # README.txt.
- #
-
- def url
- warn "NOTE: Hoe#url is deprecated, use urls. It will be removed on or after 2012-06-01."
- warn "Used from #{caller.first}"
- @url
- end
-
- def url=o # :nodoc:
- warn "NOTE: Hoe#url= is deprecated, use urls=. It will be removed on or after 2012-06-01."
- warn "Used from #{caller.first}"
- @url=o
- end
-
- ##
# Optional: The urls of the project. This can be an array or
# (preferably) a hash. Auto-populates to the urls read from the
# beginning of README.txt.
#
# See parse_urls for more details
@@ -530,25 +524,21 @@
s.name = name
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) }
s.bindir = "bin"
s.require_paths = dirs unless dirs.empty?
s.rdoc_options = ["--main", readme_file]
s.post_install_message = post_install_message
+ 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?
case author
when Array
@@ -717,10 +707,13 @@
lines = text.gsub(/^\* /, "").delete("<>").split(/\n/).grep(/\S+/)
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."
+ warn " This will be removed on or after 2020-10-28."
+ { "home" => lines.first }
end
end
##
# Load activated plugins by calling their define tasks method.