bumpversion icon indicating copy to clipboard operation
bumpversion copied to clipboard

Allow wildcards in [bumpversion:file:...]

Open louisl opened this issue 10 years ago • 8 comments

Can I specify folders in .bumpversion.cfg?,

I'm trying to use this to update all the @version x.x.x php doc block tags in specific folders in my project.

louisl avatar Jul 17 '15 10:07 louisl

You mean as in

[bumpversion:file:path/to/source/*.php]

would expand and match

path/to/source/a_file.php
path/to/source/a_second_file.php
path/to/source/another_file.php
path/to/source/file_that_does_not_start_with_a.php

?

No, it doesn't work that way at the moment, you'd have to specify all the files individually in the configuration.

I like the idea though, pull requests welcome :)

peritus avatar Jul 17 '15 10:07 peritus

Yes, thats what I need.

I have the config working on all the unique files but it'll be back to the old find and replace on folders for now then :)

Thanks for the quick reply.

louisl avatar Jul 17 '15 10:07 louisl

@louisl

back to the old find and replace on folders for now then

You have folders that have version numbers in their names or am I misunderstanding this ?

peritus avatar Jul 17 '15 10:07 peritus

@peritus No not in the folders names, this is for a website so the version is in the header doc blocks of each php and js file and in a constants file as a variable. Also it's in bower.json, composer.json, package.json. So on a version bump I need to update a lot of places.

louisl avatar Jul 17 '15 11:07 louisl

I'm currently working on this, by first trying the builtin glob library, and if that fails (because glob doesn't expand everything that a shell can, eg curly brackets) then calls the shell via subprocess.check_output. What I have seems to be working. Currently reading through the unit tests and adding some tests for multiple files via globs. I should have a PR ready within a few days or so.

jackmaney avatar Oct 03 '17 17:10 jackmaney

Incidentally, do you mind if I refactor the 1864 line tests/test_cli.py module into some separate modules containing related tests?

~Also, do you mind if I cleanup tmpdir after each test that uses it (so I don't have to worry about which files already exist within it)?~ (Nevermind, just looked at the pytest docs and saw that tmpdir is unique per test function invocation...)

jackmaney avatar Oct 03 '17 17:10 jackmaney

@jackmaney you ever get a PR for this? Or is your work available in a fork/branch?

lorengordon avatar Apr 27 '18 10:04 lorengordon

This feature is strongly needed, because specifying all the files individually in the configuration is uncomfortable and time-consuming when working on large projects.

@jackmaney what is the state of your PR?

jqadev avatar Jan 21 '19 11:01 jqadev