colinta / StrangeCase

It's yet another static site generator. Have you seen jekyll? hyde? Yup. Like those.
http://colinta.com/projects/StrangeCase.html
Other
49 stars 7 forks source link

dont_remove config option doesn't appear to work #3

Closed rockymeza closed 12 years ago

rockymeza commented 12 years ago

I have a deploy_path of _site. I have files in _site/static that I want StrangeCase to ignore.

I tried several things:

dont_remove: ['static.*']
dont_remove: ['_site/static.*']
dont_remove: ['static/*'] # I realized you are using `fnmatch` and not regex as the documentation might suggest
dont_remove: ['_site/static/*']

The only one that works is this:

dont_remove: ['*_site/static/*']

However, StrangeCase still attempts to delete the directory, which results in a failure.

colinta commented 12 years ago

yeah, I'm using fnmatch everywhere is deliberate, but in your case fnmatch just doesn't match when you include paths unless you start with a *:

>>> fnmatch('rockymeza.com/_site/static/css/rockymeza.css', '*.css')
True
>>> fnmatch('rockymeza.com/_site/static/css/rockymeza.css', 'static/*.css')
False
>>> fnmatch('rockymeza.com/_site/static/css/rockymeza.css', '/static/*.css')
False
>>> fnmatch('/Users/colinta/Code/html/rockymeza.com/_site/static/css/rockymeza.css', '*/static/*.css')
True

But the bug was with removing non-empty folders, and that's been fixed with v3.1.1