Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

vlc-nightly: update url do #9707

Merged
merged 1 commit into from
Oct 8, 2020
Merged

vlc-nightly: update url do #9707

merged 1 commit into from
Oct 8, 2020

Conversation

miccal
Copy link
Member

@miccal miccal commented Oct 4, 2020

After making all changes to a cask, verify:

Closes #9700

I have set this up to download the nightly builds of VLC version 4:

https://artifacts.videolan.org/vlc/nightly-macos/

Nightly builds of version 3 are located at:

https://artifacts.videolan.org/vlc-3.0/nightly-macos/

which would change the base_url.

@miccal miccal added the awaiting maintainer feedback Issue needs response from a maintainer. label Oct 4, 2020
base_url = "https://artifacts.videolan.org/vlc/nightly-macos/"
folder = URI(base_url).open.read.scan(/(\d+-\d+)/).flatten.first
updated_url = "#{base_url}#{folder}/"
file = URI.join(updated_url).open.read.scan(/href="([^"]+.dmg)"/).flatten.first
Copy link
Member

Choose a reason for hiding this comment

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

Why URI.join if there is only a single string argument?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because without it I get the error:

Error: Download failed on Cask 'vlc-nightly' with message: undefined method `call' for URI:Module

file = URI(base_url).open.read.scan(/href="([^"]+.dmg)"/).flatten.first
"#{base_url}#{file}"
base_url = "https://artifacts.videolan.org/vlc/nightly-macos/"
folder = URI(base_url).open.read.scan(/(\d+-\d+)/).flatten.first
Copy link
Member

Choose a reason for hiding this comment

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

I think we do this for other casks as well, but there’s no point to using scan if we’re going to use the first result. match does it fine.

Suggested change
folder = URI(base_url).open.read.scan(/(\d+-\d+)/).flatten.first
folder = URI(base_url).open.read.match(/(\d+-\d+)/).to_s

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

Same thing can be done below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also done.

Copy link
Member

Choose a reason for hiding this comment

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

Or just .read[/(\d+-\d+)/, 1].

Copy link
Member Author

Choose a reason for hiding this comment

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

Or just .read[/(\d+-\d+)/, 1].

That is better -- makes it clear that it is the first match in the list. Thanks @reitermarkus.

Copy link
Member

Choose a reason for hiding this comment

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

Or just .read[/(\d+-\d+)/, 1]

What’s the , 1 for?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or just .read[/(\d+-\d+)/, 1]

What’s the , 1 for?

First match.

Copy link
Member

@vitorgalvao vitorgalvao Oct 5, 2020

Choose a reason for hiding this comment

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

First match.

It’s always the first match, there’s only one capture being made. For the 1 to be meaningful, there would need to be more than one set of parenthesis (or any code outside of them). Which we can also remove, because we don’t need a capture group in this case: URI(base_url).read[/\d+-\d+/]

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point -- updated.

@miccal miccal removed the awaiting maintainer feedback Issue needs response from a maintainer. label Oct 8, 2020
@miccal
Copy link
Member Author

miccal commented Oct 8, 2020

Thank you @reitermarkus.

@miccal miccal merged commit 882d4c8 into Homebrew:master Oct 8, 2020
@miccal miccal deleted the vlc-nightly branch October 8, 2020 21:14
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vlc-nightly doesn't get updated due to new repository structure
4 participants