Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build failure with empty metadata URLs for gemspec #9

Closed
jchilders opened this issue Apr 30, 2022 · 4 comments Β· Fixed by #10
Closed

Fix build failure with empty metadata URLs for gemspec #9

jchilders opened this issue Apr 30, 2022 · 4 comments Β· Fixed by #10
Assignees
Labels

Comments

@jchilders
Copy link

Overview

When running gemsmith --build smithtmp --min the command fails with error when attempting to validate the generated .gemspec file.

~/temp via πŸ’Ž v3.1.2 ➜ gemsmith --build smithtmp --min
Rendering: smithtmp/lib/smithtmp.rb
... snip ...
/Users/jchilders/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/specification_policy.rb:478:in `error': metadata['bug_tracker_uri'] has invalid link: "" (Gem::InvalidSpecificationException)
... snip ...
from /Users/jchilders/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/jchilders/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/bundler/cli.rb:25:in `start'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/rubysmith-3.1.0/lib/rubysmith/extensions/bundler.rb:21:in `block in call'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/refinements-9.3.3/lib/refinements/pathnames.rb:37:in `block in change_dir'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/refinements-9.3.3/lib/refinements/pathnames.rb:37:in `chdir'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/refinements-9.3.3/lib/refinements/pathnames.rb:37:in `change_dir'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/rubysmith-3.1.0/lib/rubysmith/extensions/bundler.rb:21:in `call'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/rubysmith-3.1.0/lib/rubysmith/extensions/bundler.rb:13:in `call'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/gemsmith-18.1.0/lib/gemsmith/cli/actions/build.rb:47:in `block in call'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/gemsmith-18.1.0/lib/gemsmith/cli/actions/build.rb:47:in `each'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/gemsmith-18.1.0/lib/gemsmith/cli/actions/build.rb:47:in `call'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/gemsmith-18.1.0/lib/gemsmith/cli/shell.rb:36:in `perform'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/gemsmith-18.1.0/lib/gemsmith/cli/shell.rb:24:in `call'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/gems/gemsmith-18.1.0/exe/gemsmith:6:in `<top (required)>'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/bin/gemsmith:25:in `load'
from /Users/jchilders/.rvm/gems/ruby-3.1.2/bin/gemsmith:25:in `<main>'

Steps to Recreate

  1. gemsmith --build smithtmp

The above error gets thrown here, although the project is still created. Further steps:

  1. cd smithtmp
  2. gem build smithtmp.gemspec. This gives:
WARNING:  See https://guides.rubygems.org/specification-reference/ for help
ERROR:  While executing gem ... (Gem::InvalidSpecificationException)
  metadata['bug_tracker_uri'] has invalid link: ""

Environment

~/temp/smithtmp via πŸ’Ž v3.1.2 ➜ uname -a
Darwin jcmpb.attlocal.net 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
~/temp/smithtmp via πŸ’Ž v3.1.2 ➜ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
@bkuhlmann
Copy link
Owner

bkuhlmann commented Apr 30, 2022

Hey James. πŸ‘‹ Thanks, this is an oversight on my part as I never added specs that would show this failing when no metadata was configured for Gemsmith. I've been assuming there would always be data. I'll work on a patch that will fix this. In the meantime -- as a workaround -- could you create a $HOME/.config/gemsmith/configuration.yml file with this configuration (bare minimum):

:project:
  :url:
    :funding: https://github.com/sponsors/jchilders
    :home: https://github.com/jchilders/%project_name%
    :issues: https://github.com/jchilders/%project_name%/issues
    :source: https://github.com/jchilders/%project_name%
    :versions: https://github.com/jchilders/%project_name%/tags

Then delete your current smithtmp directory and run gemsmith --build smithtmp again. That should allow you to proceed while I work on a patch.

@bkuhlmann bkuhlmann added the Bug label Apr 30, 2022
@bkuhlmann bkuhlmann self-assigned this Apr 30, 2022
@bkuhlmann bkuhlmann changed the title Build command fails when validating generated gemspec Fix build validating gemspec with empty metadata URLs Apr 30, 2022
@bkuhlmann bkuhlmann changed the title Fix build validating gemspec with empty metadata URLs Fix build failure with empty metadata URLs for gemspec Apr 30, 2022
@bkuhlmann
Copy link
Owner

ℹ️ I'll push out a patch release later today which incorporates this fix.

@jchilders
Copy link
Author

Thank you, @bkuhlmann!

@bkuhlmann
Copy link
Owner

bkuhlmann commented May 1, 2022

Yeah, you bet. Thanks for reporting because that was a good find as I wasn't able to detect that use case sooner since I always have a global configuration defined.

By the way, Version 18.1.1 is live. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants