WIP DSL: add :glob
key to expand fileglobs
#5043
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a very rough/quick implementation, and is intended mostly for discussion,
as this is the DSL proposal in #4688 which has no associated PR.
Problems here include:
This was implemented alongside
:target
inartifact/symlinked.rb
, which alsocontains installation logic for artifacts. A smarter implementation would improve
separation of concerns by moving the logic for interpreting both
:glob
and:target
keys into
dsl.rb
(or some class called fromdsl.rb
)Only artifact sources such as
link
can be expanded. Similar functionality wouldalso be useful (for example) in
uninstall :files
.This interface seems clunky. It might be cleaner to have an
expand
method inthe DSL for wrapping filenames:
The
expand
method would actually call a constructor, because the action of expansionmust be deferred until install-time. However, I think Expander.new('*') is needlessly
verbose for Cask authors, and not necessarily more self-documenting.
expand
interface might also help address problem 2 above.References: Homebrew/homebrew-cask-versions#293 (comment)