dmolesUC/typesafe_enum

gemspec only works with HTTPS checkouts

dmolesUC opened this issue · 1 comments

Steps to reproduce:

  1. Clone typesafe_enum with SSH:

    $ git clone git@github.com:dmolesUC3/typesafe_enum.git
    
  2. 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.

Fixed in 748b969.