-
Notifications
You must be signed in to change notification settings - Fork 5
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
Named pattern in Gupfile #2
Comments
I like the idea, certainly. I'm worried about syntax though. I want to keep the gupfile syntax to a minimum. I'm wondering if gupfiles will also want regex syntax, in which case we could perhaps combine the two (while giving even more control about what gets matched). Since there's no good reason to start a path with
It's much less readable, but it is a well-established syntax (and also handles the case of more specific wildcards than * and **). I've already wanted support for matching restricted patterns like It's kind of a pain if you just want to capture some part of the path and don't want to convert the rest of your pattern to a regex, but at the same time I don't want to invent non-trivial rules about what needs escaping in the existing (plain) path syntax. WDYT, is forcing regexes reasonable for this use case? |
I think we need two modes something "stupid simple" for the normal cases and these named capture for the hard cases. The most simple case would be %(var) or just % for a special default variable. They should just capture as much as * as it is the default sane behavior. |
But I don't think named capture is sufficient - I thing regexp mode is needed as well (e.g match step1.html, step2.html and step3.html but not steps.html). So the question is: do we add a third mode to deal with named capture groups, or just roll it into the regexp mode? |
Yes what I meant is: I think we need the full regexp mode. However since it is going to be ugly for the common cases I suggest adding % and %(var) as part of the default "globbing" mode. |
ugh, damn - sorry about the noise, I got the issue number wrong. The above commit fixes #4, not this issue. |
+1 for simplified globbing syntax for the most common cases. But I'm also worried about the extra syntax clutter... Please come up with an ingeniously intuitive, light yet sufficiently general approach which can handle all the cases! ;) |
I'm thinking there should be a per-line pattern mode flag. It doesn't matter if it's a bit wordy, since you shouldn't need to write them that often. Something like: builder.sh: I also like Thoughts? |
I'll need to actually start using gup first to have a feeling for that... :) |
Concretly I would like to name parts of the patterns in the Gupfile these variables should then be accessible through build script, using environment variables for instance.
Here is a mockup example:
If one builds foo/bar.html, in build-html one has access to
GUP_base=foo/bar
.If one builds foo/bar.tar.gz, in build-archive one has access to
GUP_dir=foo
,GUP_base=bar
, andGUP_ext=tar.gz
.What do you think?
The text was updated successfully, but these errors were encountered: