Commit graph

19 commits

Author SHA1 Message Date
Andy Feller
20062233c8 Separate logic for checking updates
During discussion in cli/cli#9934, we can to the conclusion that the logic around checking for core GitHub CLI updates would diverge from GitHub CLI
extension updates over time.  To that end, this commit splits that logic into a separate function with a new environment variable.
2025-01-10 14:16:46 -05:00
Andy Feller
6bbd70353b Comment exported functions 2025-01-09 09:09:42 -05:00
Andy Feller
bfc63a14cc Implement remaining PR feedback
After merging in upstream changes regarding local extensions, this commit addresses remaining PR feedback while also bringing the newly merged tests into alignment with other changes.
2024-12-13 23:09:18 -05:00
Andy Feller
c12e3694e8 Implement partial feedback before trunk update 2024-12-13 22:52:03 -05:00
Andy Feller
10f62b1c37 Expand update tests for local extensions 2024-12-08 21:06:01 -05:00
Andy Feller
a79e086bd4 Test whether extension update should be checked 2024-12-08 20:43:51 -05:00
Andrew Feller
a55f50b115 Remove Extension.FullName() from interface
- this was something I did in the original implementation of this improved extension update notification logic
- discovering other parts of the extension manager code that were working with non-prefixed extension names motivated a different approach
- the extension manager code that requires the extension be prefixed has been enhanced to use the centralized ensurePrefixed() logic, making the need for this on the extension unnecessary
2024-12-08 20:01:26 -05:00
Andrew Feller
97630fe73c Enhance extension manager and tests
- extension manager has been made responsible for extension update directory information
- extension manager has been enhanced to ensure that previously left extension update metadata is deleted before installing an extension
- extension manager has been enhanced to ensure that extension update metadata is deleted when extension is being removed
- refactored extension command tests for manager change, ensuring previous and expected states along with returned release info
- refactored extension manager tests for ensuring previous extension update entries are removed before installing extension
- created extension manager test for installing local extension
- centralized logic for checking and ensuring extension name is "gh-" prefixed
2024-12-08 19:40:24 -05:00
Andrew Feller
6bd01d52dd Initial extension update check testing
First pass at implementing basic test around extension state checking behavior, wanting to discus with team about level of testing to perform and whether this is really the right place.
2024-12-01 18:20:55 -05:00
Andy Feller
0d3f7cae4e Bring extension update check in line with gh check
This commit is a bit of refactoring to bring the extension update checking logic up to par with what is done with `gh` including creation of state file per extension and listening to env vars for disabling version checking.

This work is not complete as it does not address necessary test changes.
2024-11-17 16:10:58 -05:00
Mislav Marohnić
626c639df5
Disallow update checker delaying the gh process (#6978)
This ensures that checking for newer versions of gh happens in the background of the main operation that the user requested, and that when that operation is completed, the gh process should immediately exit without being delayed by the update checker goroutine.
2023-02-07 19:52:53 +00:00
Sam Coe
074ed50b8a
Integrate go-gh API package (#5614) 2022-06-23 04:05:31 +01:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Sam Coe
1d7ffc2013
Add support for LocalAppData and .local/state/ fallback 2021-06-01 15:50:10 -04:00
Mislav Marohnić
feb4acc2c0 Suggest brew upgrade gh when new version detected
When the update notifier is enabled and a new version was detected, show
a Homebrew upgrade notice if:
- the release was at least 24 hours ago; and
- the current `gh` binary is under the Homebrew prefix.
2021-02-08 13:57:08 +01:00
Mislav Marohnić
82d19b73d6 Update notifier: avoid false positives when gh is built from source
When gh was built from source, the version number will look something
like this since it's taken from `git describe`:

    v1.4.0-34-g{SHA}

When compared as semver against `v1.4.0`, the latter version is falsely
reported as newer. This is because the output of `git describe` wasn't
meant to be interpreted as semver.

The solution is to translate the `git describe` string to faux-semver so
it can be safely compared with the version reported from the server.

Fixes this case:

    A new release of gh is available: v1.4.0-41-g2f9e4cb1 → v1.4.0
    https://github.com/cli/cli/releases/tag/v1.4.0
2021-01-20 16:13:50 +01:00
Cristian Dominguez
ce151420f3 Migrate legacy tests 2021-01-11 21:07:19 -03:00
Mislav Marohnić
2843ffff23 Classify the update package as internal 2020-12-15 16:09:08 +01:00