dsifford / yarn-completion

Bash completion for Yarn
MIT License
277 stars 25 forks source link

Add to homebrew #13

Closed benswinburne closed 6 years ago

benswinburne commented 6 years ago

It'd be nice to be able to install this using homebrew if possible.

dsifford commented 6 years ago

I'll look into it when I get some extra time

benswinburne commented 6 years ago

Nice one, thanks very much!

On 3 March 2018 at 15:39, Derek Sifford notifications@github.com wrote:

I'll look into it when I get some extra time

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dsifford/yarn-completion/issues/13#issuecomment-370178094, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJykcxJptlMJUETHG13Uf9n56ZT_fvaks5tav-agaJpZM4SbCEf .

dsifford commented 6 years ago

Doesn't appear like adding support for this would be allowed per the homebrew guidelines.

@benswinburne If you'd really like to see this land in homebrew, perhaps consider reaching out to the maintainers of the yarn formula and see if they can add it as an optional dependency.

kachkaev commented 6 years ago

@dsifford which particular rule in the guidelines do you find difficult to adhere? There are quite a few similar automcompletion formulae in homebrew already:

screen shot 2018-03-08 at 18 28 39
dsifford commented 6 years ago

The rule stating that new formulae must have an accompanying website

dsifford commented 6 years ago

@kachkaev I'll check out those formulae when I get some time. Technically, if I'm reading the guidelines correctly, those shouldn't be allowed to exist. But if they're letting those slide, I suppose they'd have to let this one slide too...

kachkaev commented 6 years ago

👍

I'm quite sure they will accept your brew formulae @dsifford! Yarn is a very popular tool these days and your repo seems to be pretty much the only yarn autocompletion that exists! I wish you be the first who claims yarn-completion package name in Homebrew!

jasonkarns commented 6 years ago

https://github.com/Homebrew/homebrew-core/pull/28645

jasonkarns commented 6 years ago

Sooo... issue...

In order to accepted into homebrew, the formula is supposed to have a non trivial test. I'm using the same test as for other completion scripts currently in homebrew (rails, vagrant), which sources the completion script, runs complete -p yarn, and verifies the output is as expected.

Wrinkle: the homebrew tests are run on travis CI using macOS which uses the 3.2 version of bash.

I realize that 3.2 support is already out of the question, but would it be possible to at least make sourcing on 3.2 succeed so the brew tests can pass?

dsifford commented 6 years ago

Sure. Start a PR and I'd be happy to merge if everything works and checks out.

jasonkarns commented 6 years ago

PR here: https://github.com/dsifford/yarn-completion/pull/18

jasonkarns commented 6 years ago

Thanks for merging #18. I believe all we need is a new release (brew formulae need to point to specific versions) and we can get this into homebrew!

dsifford commented 6 years ago

Sure, I'll do that in a bit.

Does homebrew have any notion of dependencies between formulae? If possible, to avoid the headache, could we make the package dependent on bash 4?

jasonkarns commented 6 years ago

Having that discussion now on the brew PR. If we declare bash as a dep (which would imply the v4 bash from homebrew itself), it would actually install bash as part of installing yarn-completion. Which would be a bad experience. (Installing yarn-completion and getting an entirely new shell?)

Perhaps it can be noted as a recommended dep? Unsure, still investigating (and checking other completion scripts in homebrew.)

dsifford commented 6 years ago

Sounds good. Keep us posted.

Just pushed a release: https://github.com/dsifford/yarn-completion/releases/tag/v0.7.4

dsifford commented 6 years ago

Apparently a kind samaritan already went and tackled this back in August.

https://github.com/Homebrew/homebrew-core/blob/master/Formula/yarn-completion.rb

Closing this as resolved. Thanks @DomT4! 🎉

jasonkarns commented 6 years ago

yep! i opened https://github.com/Homebrew/homebrew-core/pull/28645 and it was merged beginning of August.

homebrew PR was noted here: https://github.com/dsifford/yarn-completion/issues/13#issuecomment-394520474

dsifford commented 6 years ago

@jasonkarns is this set to track off of github releases or does someone need to manually go in and update? If the latter, I'll try and make a mental note to do that.

jasonkarns commented 6 years ago

Needs to be manually updated via a PR similar to: https://github.com/Homebrew/homebrew-core/commit/4f418e6d91664f07ec992a6e35206ab08870b6f7

However, homebrew has a command that can automate the PR creation process: brew bump-formula-pr

I actually have an npm package that wraps this command for use as a postversion npm hook: https://github.com/jasonkarns/brew-publish

Example use: https://github.com/nodenv/nodenv/blob/18489d7bf319fde4edc942cce7f3b1caf1b12214/package.json#L31-L36

With it set up this way, npm version <major|minor|patch> does the npm version bumping, then npm invokes the postversion script which is set as "npm run publish:github && npm run publish:brew". publish:github script being: "git push --follow-tags && script/release-github" and the publish:brew script invokes my module: "brew-publish $npm_package_name v$npm_package_version"

jasonkarns commented 6 years ago

I can open a PR to set up a similar release process here if you like.

dsifford commented 6 years ago

Sounds lovely. Thanks :+1:

dsifford commented 5 years ago

Just pushed a release @jasonkarns --- what do I do now?

jasonkarns commented 5 years ago

Well, short story (because I haven't gotten the scripts PR open for you yet)...

HOMEBREW_DEVELOPER=true brew bump-formula-pr --url="https://github.com/dsifford/yarn-completion/archive/v0.9.0.tar.gz" --sha256="$(curl -fsSL "https://github.com/dsifford/yarn-completion/archive/v0.9.0.tar.gz" | shasum -a 256 -b | awk '{print $1}')" yarn-completion

That should make the branch in your brew git repo, create a homebrew fork for you (if you don't already have one), push the branch to your fork, and open a PR to bump the formula version.

You can also add a --dry-run flag to the brew command if you want to see what it'll do.

dsifford commented 5 years ago

All set https://github.com/Homebrew/homebrew-core/pull/32637

Thanks