Allow user to override raw github sources
glyh opened this issue · 5 comments
As title, access to raw.githubusercontent.com is an issue for Chinese users, and when running bundle exec tapioca init
, I got the following:
$ bundle exec tapioca init
identical sorbet/config
identical sorbet/tapioca/config.yml
identical sorbet/tapioca/require.rb
force bin/tapioca
Retrieving index from central repository...
Can't fetch file `index.json` from https://raw.githubusercontent.com/Shopify/rbi-central/main (Failed to open TCP connection to raw.githubusercontent.com:443 (Connection refused - connect(2) for "raw.githubusercontent.com" port 443))
Tapioca can't access the annotations at https://raw.githubusercontent.com/Shopify/rbi-central/main.
Are you trying to access a private repository?
If so, please specify your Github credentials in your ~/.netrc file or by specifying the --auth option.
See https://github.com/Shopify/tapioca#using-a-netrc-file for more details.
Can't fetch annotations without sources (no index fetched)
Okay I figure it out:
bundle exec tapioca configure
bundle exec tapioca annotations --sources https://raw.kkgithub.com/Shopify/rbi-central/main
bundle exec tapioca gem
I think we'd better have a way to configure the raw sources from the init command, the above fix seems hacky.
Looks like there's just no way I can get it work as I don't have srb exectuable. Having a system proxy also won't make it work, as I still get the SSL error from the proxy. No clue.
Hey @glyh
This isn't something we have capacity to tackle at the moment, but this looks like a really good "first issue" for community contribution, if that's something you'd be interested in.
Some thoughts:
-
We wouldn't want to add configuration flags to
tapioca init
. After all, users are just getting started with Tapioca, we'd be making a bad first impression if we require them to dive into man pages right from square 1. -
It sounds reasonable to me that
tapioca init
should try to fetch annotations from the default source, but not "give up completely" if it can't connect. -
Instead, it'd be nice if it just said something along the lines of:
$ bundle exec tapioca init identical sorbet/config identical sorbet/tapioca/config.yml identical sorbet/tapioca/require.rb force bin/tapioca Retrieving index from central repository... Can't fetch file `index.json` from https://raw.githubusercontent.com/Shopify/rbi-central/main (Failed to open TCP connection to raw.githubusercontent.com:443 (Connection refused - connect(2) for "raw.githubusercontent.com" port 443)) Tapioca can't access the annotations at https://raw.githubusercontent.com/Shopify/rbi-central/main. Here are some things you can try: 1. Check that your internet connection is online. 2. Are trying to access a private repository? If so, please specify your Github credentials in your ~/.netrc file or by specifying the --auth option. 3. Is GitHub available in your region? If not, you'll need to use an alternative source for RBI annotations. You can rerun this with: bundle exec tapioca annotations --sources https://example.com/your/source/here <... continue on with the rest of the init command>
I already said the hack I gave above won't fix this issue.