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

Use JSON API for chromedriver versions #3

Merged
merged 4 commits into from
Sep 27, 2023
Merged

Conversation

sax
Copy link
Contributor

@sax sax commented Aug 22, 2023

This is a brute-force attempt to solve #2.

I'm not sure if you want to accept it as-is, because of the implicit dependency on jq. Also, it appears as if the new JSON endpoint only starts including chromedriver as of version 115.0.5763.0, which works for my needs but doesn't seem ideal.

Also note that the zip files listed in this endpoint have all of their contents internally listed at chromedriver-${platform}/*, rather than at bin/*.

At the very least, hopefully this is helpful to you as a starting point.

@schinckel
Copy link
Owner

I'm not sure we can rely on jq being installed.

@schinckel
Copy link
Owner

Actually, maybe if we state that jq is a dependency, then that should be okay.

Also, I'm seeing 113.0.5672.0 in the JSON file, so I'm okay with that.

@sax
Copy link
Contributor Author

sax commented Aug 22, 2023

Oh, yeah. I wonder if it should try to filter only to versions where there are chromedriver download URLs available. Right now all the versions are listed, but only versions 115.0.5763.0 or later include chromedriver. Earlier than that and they might only contain download URLs for chrome.

@schinckel
Copy link
Owner

Hmm. Unlikely that requiring jq is going to wash; if I try to move this to asdf-community they'll likely object to it requiring something that is asdf-installable itself.

@sax
Copy link
Contributor Author

sax commented Aug 23, 2023

Yeah that makes sense. I wish Darwin shipped with something like jq, it would make a lot of things easier including this.

I thought your usage of IFS in the original implementation was incredibly clever, but I just don't see how it could be used for JSON parsing.

Listing versions could use grep and/or awk. Finding download urls, though... maybe sed to replace braces, and grep with negative lookaheads to find specific patterns without jumping ahead to the next version?

@schinckel
Copy link
Owner

I'm almost certain I'm not that clever...pretty sure I pinched that idea from someone else...

@sax
Copy link
Contributor Author

sax commented Aug 24, 2023

Hmmm. What would you think about the version/url parser using Ruby? While there is an asdf plugin for managing Ruby versions, an old version ships with Darwin:

 /usr/bin/ruby --version
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin22]

It wouldn't necessarily be available on Linux, however.

README.md Outdated Show resolved Hide resolved
@schinckel schinckel merged commit 8ce131a into schinckel:main Sep 27, 2023
3 of 4 checks passed
@schinckel
Copy link
Owner

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants