-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
livecheck migration: add brew livecheck
developer command
#8180
Conversation
Also, I'm unfamiliar with how the |
That's exactly what you should do. |
Thanks! Just had a look at the |
I wonder if you could add people who contributed to the files that you add in this PR as co-authors: I think this is the right thing to do with such repo-to-repo migrations. You could do it file-by-file (that'll result in as many commits as there are files -- probably a lot) or once for the single commit. |
👍🏼 Totally agree. Maybe it's fine to add everyone as co-authors to the single commit, I think that keeps things cleaner in the PR. However, if you and the others think the attributions should be more fine-grained, I'll do just that. |
I don't have a preference -- this is just a way to acknowledge people's contributions on GitHub. Let's do it in a single commit for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass! Just to warn you there will likely be a lot of waves of review on this as the existing code is a bit non-idiomatic. I'd also like to see unit tests for all files except Library/Homebrew/dev-cmd/livecheck.rb
(which should have tests like Library/Homebrew/test/dev-cmd/linkage_spec.rb
).
The latest commit includes some refactoring done based on your suggestions @MikeMcQuaid. I've added a How do you think we should approach tests for the strategies and livecheck 'core' code? |
Quite a lot of livecheck involves network requests and I agree that this can make testing more difficult. How do you feel about stubbing network requests, @MikeMcQuaid? It seems like we could use something like the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've given this a quick review but not comprehensive. I've tried to make more general comments where I've seen patterns repeat (that may ease search/replace). Given it's 1000 lines of code I wonder whether it's worth splitting up into separate chunks that can go through and be reviewed in separate PRs more easily? I challenge anyone to do a comprehensive review of 1000 lines of code 😭 😂
Could maybe have separate PRs for:
- the dev-cmd and tests
- the
Library/Homebrew/livecheck/livecheck.rb
file and tests - the strategies and tests
Looks good so far, though, I just think there will be a fair bit of bashing to get this code a bit more idiomatic.
I think ideally split out the methods based on whether they require a network connection or not. Those that do can have
For strategies I'd imagine it'd be a matter of being a bit like the versions tests; pass in some expected correct and incorrect URLs and ensure the strategy gets the expected results.
We've previously avoided this stubbing because, in my experience, your tests then become tests of the stubbing library more than tests of the actual code. To be clear: I don't expect 100% coverage here and if we can sufficiently extract network logic: that code can have very minimal (and in some cases, no) testing and save the more extensive tests for local logic. |
With the latest push, this PR will only deal with:
I will be creating PRs for the migration of the |
brew livecheck
developer command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of tiny nits but this is looking really good so far 👏🏻
The following changes have been made in the latest commit:
|
Looks good! Happy for this to merge when CI is 💚. Great work @nandahkrishna! |
Agreed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a branch in my local Homebrew/brew repository, merged #8254 and this PR into it (rebasing each on the current main branch beforehand), and did some integration testing to make sure that everything works as expected.
It was necessary to add the require "formula"
change that I mentioned earlier but after that everything worked properly. I tested all the command line flags in various combinations as well as the presence/absence of a watchlist file. I did a full run across the homebrew-core formulae and compared it to a previous run using the homebrew-livecheck version of brew livecheck
and there weren't any unexpected changes.
After the previously-requested change is integrated, I don't see any notable issues preventing this PR from moving forward after #8254 is wrapped up and merged. This will need to be rebased afterward but that should be it unless we run into issues on CI.
Incorporating the suggestion and rebasing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. We probably want to ensure we delete the existing https://github.com/homebrew/homebrew-livecheck command and library code when we merge this and archive that repository. It'd also be worth adding to DEPRECATED_OFFICIAL_TAPS
in Library/Homebrew/official_taps.rb
in this PR, too!
Added this 👍🏼 Will rebase and push after #8544 is merged. |
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com> Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com> Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com> Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com> Co-authored-by: Issy Long <me@issyl0.co.uk> Co-authored-by: Mike McQuaid <mike@mikemcquaid.com> Co-authored-by: Seeker <meaningseeking@protonmail.com>
@nandahkrishna Could you open a PR for this, too? I'll merge it when this is merged. |
Sure Mike 👍🏼 Edit: PR Homebrew/homebrew-livecheck#1339 has been created to remove files from the Tap. |
Thanks again @nandahkrishna! |
brew style
with your changes locally?brew tests
with your changes locally?This PR integrates
livecheck
into Homebrew/brew as a developer command. It was almost just a copy-paste of files, but there were some style changes and a couple of minor differences as outlined by @samford. I've also brought over the command completions and placed them in the appropriate files (works onzsh
, should also work onbash
andfish
based on my previous trials).I tested this locally by also incorporating the changes in #8156 (without which we will get an
undefined method strategy
error), and it works as intended (I also untapped homebrew/livecheck).Things to discuss:
I will also be working on the RuboCops/audits in parallel. Looking forward to your reviews!