gemspec only works with HTTPS checkouts
dmolesUC opened this issue · 1 comments
dmolesUC commented
Steps to reproduce:
-
Clone
typesafe_enum
with SSH:$ git clone git@github.com:dmolesUC3/typesafe_enum.git
-
cd
to the new clone and try to build the gem:$ cd typesafe_enum $ gem build typesafe_enum.gemspec
Expected:
- gem builds.
Actual:
-
Build fails with bad URI error.
Invalid gemspec in [typesafe_enum.gemspec]: bad URI(is not URI?): git@github.com:dmolesUC3/typesafe_enum.git ERROR: Error loading gemspec. Aborting.
The culprit code is here in the .gemspec
:
origin_uri = URI(`git config --get remote.origin.url`.chomp)
spec.homepage = URI::HTTP.build(host: origin_uri.host, path: origin_uri.path.chomp('.git')).to_s
If we don't want to hard-code the URLs, we need to be actually clever here, not just half-clever, and convert git@github.com
URIs to https
.