Skip to content
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

Fix reading HOMEBREW_LIVECHECK_WATCHLIST file #8561

Merged
merged 3 commits into from
Sep 1, 2020
Merged

Fix reading HOMEBREW_LIVECHECK_WATCHLIST file #8561

merged 3 commits into from
Sep 1, 2020

Conversation

josh
Copy link
Contributor

@josh josh commented Sep 1, 2020

When setting a HOMEBREW_LIVECHECK_WATCHLIST environment variable, livecheck attempts to perform an IO read on a String when it probably expected a Pathname.

$ HOMEBREW_LIVECHECK_WATCHLIST="my_brew_livecheck_watchlist"  brew livecheck
Error: undefined method `read' for "my_brew_livecheck_watchlist":String
/usr/local/Homebrew/Library/Homebrew/dev-cmd/livecheck.rb:61:in `livecheck'
/usr/local/Homebrew/Library/Homebrew/brew.rb:113:in `<main>'

Looks like this may have been lost in the shuffle of moving livecheck into core.

https://github.com/Homebrew/homebrew-livecheck/blob/6b4a6e342a1a39c0179a1704cf5497cbe9054d8d/cmd/livecheck.rb#L99-L101

(BTW livecheck is ✨)


CC: @MikeMcQuaid

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks @josh, good to see you and hope you're well! ❤️

Copy link
Member

@samford samford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me. Thanks!

Copy link
Member

@nandahkrishna nandahkrishna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not able to add a suggestion in a line without changes, but we have:

WATCHLIST_PATH = (
    ENV["HOMEBREW_LIVECHECK_WATCHLIST"] ||
    Pathname.new(Dir.home)/".brew_livecheck_watchlist"
  ).freeze

Might be good to change it to:

WATCHLIST_PATH = (
    ENV["HOMEBREW_LIVECHECK_WATCHLIST"] ||
    "#{Dir.home}/.brew_livecheck_watchlist"
  ).freeze

Along with your current change, that is. What do you think @samford?

@josh
Copy link
Contributor Author

josh commented Sep 1, 2020

@nandahkrishna 👍🏻 that seems like good idea. That way WATCHLIST_PATH is always of type String rather than String | Pathname.

@samford
Copy link
Member

samford commented Sep 1, 2020

Good catch, Nanda. I agree that using a uniform type for HOMEBREW_LIVECHECK_WATCHLIST is a good idea.

I believe at one point I made that change while working on something else in livecheck but evidently I didn't commit it. It's probably buried somewhere in the 60+ stashes that I need to work through in my old homebrew-livecheck tap.

Copy link
Member

@nandahkrishna nandahkrishna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @josh!

@nandahkrishna nandahkrishna merged commit cbc3448 into Homebrew:master Sep 1, 2020
@josh josh deleted the fix-livecheck-watchlist-read branch September 1, 2020 19:16
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 14, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants