From 95eb9a21fe572fe9e9dc622d7098548b88dcf041 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Tue, 17 May 2022 15:00:16 -0800 Subject: + Add bindir and homepage accessor methods. (dsisnero) + Use bindir to determine executables. (dsisnero) + Don't auto-intuit values if they're already set. (dsisnero) [git-p4: depot-paths = "//src/hoe/dev/": change = 13384] --- lib/hoe.rb | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/hoe.rb b/lib/hoe.rb index 02880e2..69ad90d 100644 --- a/lib/hoe.rb +++ b/lib/hoe.rb @@ -222,6 +222,18 @@ class Hoe attr_accessor :group_name + ## + # Optional: The name of the executables directory. [default: bin] + + attr_accessor :bindir + + ## + # Optional: The homepage of the project. Auto-populates to the home key + # of the urls read from the README.txt + # + + attr_accessor :homepage + ## # The Gem::Specification. @@ -525,17 +537,18 @@ class Hoe s.version = version if version s.summary = summary s.email = email - s.homepage = urls["home"] || urls.values.first + s.homepage = 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.bindir = bindir || "bin" + s.executables = s.files.grep(/^#{s.bindir}/) { |f| File.basename(f) } 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 + }.to_h if urls missing "Manifest.txt" if s.files.empty? @@ -810,7 +823,9 @@ class Hoe def post_initialize activate_plugin_deps - intuit_values File.read_utf readme_file if readme_file + unless skip_intuit_values? + intuit_values File.read_utf readme_file if readme_file + end validate_fields define_spec load_plugin_tasks @@ -896,6 +911,10 @@ class Hoe end end + def skip_intuit_values? + %w[summary description homepage].all? { |field| send field } + end + ## # Loads ~/.hoerc, merges it with a .hoerc in the current pwd (if # any) and yields the configuration and its path -- cgit v1.2.1