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

Allow to check non-markdown sources #17

Closed
matthiasbeyer opened this issue Sep 23, 2017 · 3 comments
Closed

Allow to check non-markdown sources #17

matthiasbeyer opened this issue Sep 23, 2017 · 3 comments

Comments

@matthiasbeyer
Copy link

Hi,

just found your crate from your post and I love it!

This is a feature request: In my project, I have some files which are not markdown, but contain version numbers. Mainly the pandoc documentation header file. Therefor it would be awesome if there would be a possibility to also check plain text files.

I know, for most uses this is not what one wants, but for this specific use case it is of great importance... and I'd bet it is easy to implement!

@matthiasbeyer
Copy link
Author

matthiasbeyer commented Sep 23, 2017

Maybe another note how I think this should work (just my 2ct):

I guess the best idea would be to check the file for the version pattern (as in <number><dot><number><dot><number><whatever>) and reject all strings that do not match the current version. Because parsing is not possible. And checking whether the version string is there does not make sense here, as we would need to check for its absence, of course. 😄

@mgeisler
Copy link
Owner

Hi Matthias, thanks for the feedback!

I would definitely like to support this! I've been thinking about adding a more free form check. Perhaps it could be something where you specify a regular expression with a placeholder?

The API might be as simple as a path and a regexp that selects the line you're interested in:

assert_version_updated!("my-pandoc-header.md", "version: $VERSION");

where $VERSION would be required to match the crate version number. I'm not sure $VERSION is the best syntax, especially since $ is a special character in regexps :-)

@matthiasbeyer
Copy link
Author

Well, you wouldn't even need to add the version in the string. Because you can aggregate that inside the macro, as you already do with the existing ones. Only a pattern would suffice I guess.

mgeisler added a commit that referenced this issue Nov 20, 2018
The new assert_contains_regex macro makes it easy to check that the
current version number is mentioned in a given file.

Fixes #17.
mgeisler added a commit that referenced this issue Nov 21, 2018
The new assert_contains_regex macro makes it easy to check that the
current version number is mentioned in a given file.

Fixes #17.
mgeisler added a commit that referenced this issue Nov 21, 2018
The new assert_contains_regex macro makes it easy to check that the
current version number is mentioned in a given file.

Fixes #17.
mgeisler added a commit that referenced this issue Nov 22, 2018
The new assert_contains_regex macro makes it easy to check that the
current version number is mentioned in a given file.

Fixes #17.
mgeisler added a commit that referenced this issue Nov 22, 2018
The new assert_contains_regex macro makes it easy to check that the
current version number is mentioned in a given file.

Fixes #17.
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

No branches or pull requests

2 participants