-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added support for user defined git shorthand #278
Added support for user defined git shorthand #278
Conversation
Hmmm build seems to be failing on "Should extract tar and zip files from normal URL packages" |
Thanks @indieisaconcept, this makes sense. The travis fails sometimes, dunno why. It always passes in my local computer. Can you also update the README? |
I restarted the build and it passes now. Heroku is sometimes really slow and times out... |
Please could this use a better key than "shorthand"? Something like |
|
@satazor I'll update the pull request later today with a README update and a config key of "shorthand_hostname". |
I'm not sure about the |
Maybe we can allow a 'shorthand_expander': 'git://github.com/{{ organization }}/{{ package }}.git' What you guys think? |
@satazor he's not asking for being able to customize org and package, but rather the host. I also don't see the point, since all GitHub instances has the same format. |
In his case yes, but other users might want to be able to specify completely different ones. Let's say that I have my own git service, and want to make all expansions mapped to |
To throw in my 2 cents.., I'd want the ability to define the I'd go for the 'shorthand': 'git://organization.example.com/git/{{ organization }}/repos/{{ package }}.git' |
@satazor you should have started with your second comment. +1 from me. |
@mehcode thanks for the feedback, good to know you like the |
@sindresorhus you're right, I was being lazy heh |
I'm not sure this needs to be complicated yet, though. For now, not having a hard-coded remote URL is a good start and provides the same functionality that Component(1) does (using the Dealing with a completely different format might be useful at some point. But who is to say that everyone would always use the same "name/name" pattern? It's a bigger issue. And FWIW, |
It's in a configuration file. So the keys are describing what the values are configuring. So a key And we would only need to disambiguate if there was another configuration option related to the shorthand form in the bowerrc file.
Good point. We could perhaps define different sources based on input filters and output templates. Bower could be just a name and github could be defined as |
'shorthand_expander': 'git://github.com/{{ organization }}/{{ package }}.git'
'shorthand_expander': 'git://github.com/{{ endpoint }}.git'
'shorthand_expander': 'function (endpoint) { return "git://github.com/" + endpoint + ".git"; }' I don't think we should support the function as a string for now. Though we got a possible solution if someone ever requests it. |
If the general consensus is template expansion would be useful I'm happy to extend my pull request to incorporate this. Just need agreement on the key name. Quite like @mehcode's reasoning for using "shorthand" as the key though.
But "'shorthand_expander'" is very explicit to the user that some expansion will likely occur. Suitable documentation could alleviate user confusion whatever the key is. |
|
Ok just rebased my pull with the changes outlined above.
|
@satazor thanks for the feedback will pick these up after work tonight. |
@indieisaconcept sorry for being picky. |
@satazor np, I appreciate the need for coding standards and your right my example could be clearer. |
@satazor changes added as per feedback. |
Thanks @indieisaconcept ! |
happy to help |
HI...just wanted to comment here that I have a need to be able to change the URLs so that bower uses one of the other two styles of URL for github. IINM, there are three styles 👍 http : https://github.com/01org/webapps-scientific-calculator.git In my network environment, the 'git read-only' one does not work (or needs some extra work done that is outside my area of expertise) - I tend to use ssh for some reason, but http also works. So, to get bower to work, I figured I'd try to use one of the others, eg : "shorthand_resolver": "https://github.com/{{{ organization }}}/{{{ package }}}.git" I am hoping this will work, but unfortunately node installs the previous version bower so I have to find out how to install the latest version :/ (Any pointers welcome) |
1 - clone bower to a folder This should do it. |
thanks for the help...can you tell me if : "shorthand_resolver": "https://github.com/{{{ organization }}}/{{{ package }}}.git" is supposed to work? I can't get it to do anything at different to the previous behaviour :/ What file is it supposed to go in? I've tried .bowerrc in the project's root, and also in the bower.json file, but it still loads git://github.com/ urls :/ |
@davidmaxwaterman the shorthand resolver is an I think you want another thing, see: http://stackoverflow.com/questions/1722807/git-convert-git-urls-to-http-urls |
Rewriting the URL using the git setting worked. I'm still not clear why the expander is limited to end points specified on the command line, but I'm probably misunderstanding something. |
@davidmaxwaterman you may have run into something I did just now, which is that the From the code, having a semver will prevent it: Line 68 in 0440e69
What I've done in my case is to specify the spec like
which works fine. https:// prefixes should also work this way. |
ok, thanks...the git tip worked for me anyway - thanks :) |
As per /issues/276 here is a pull request to support overriding the shorthand used when resolving git urls.
.bowerrc
Once set rather that using "git://github.com/", "git://somehost.com/" is used as the shorthand.