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
Improve .couchappignore #204
Comments
It appears that in .couchappignore, the regex is matching from the head of the filename. A "^" is redundant (but implied). And, of course it's each element of the filename, e.g. "views/bob.txt" and "bob.txt" will both be matched by ".*\.txt". "\.txt" will not match either. |
@awgrover diff --git a/couchapp/localdoc.py b/couchapp/localdoc.py
index e095bf5..61a7d92 100644
--- a/couchapp/localdoc.py
+++ b/couchapp/localdoc.py
@@ -281,7 +281,7 @@ class LocalDoc(object):
def check_ignore(self, item):
for i in self.ignores:
- match = re.match(i, item)
+ match = re.search(i, item)
if match:
logger.debug("ignoring %s" % item)
return True |
New helper funcs with doc testing included: - LocalDoc._combine_path - LocalDoc._combine_dir Ref: #204
@BigBlueHat please checkout PR #243 ... and there are tons of test cases. |
Any plans for this? I'm hoping to add .couchappignore support to a simple little node.js helper and realizing the current format is pretty limited. What I might do with my app is simply match against the full (well, relative to the ddoc root) path. This would allow the user pretty much full control (e.g. choose whether to ^ anchor, patterns for subfolder combinations, etc.) and also without having to generate tons of combinatoric path parts like PR #243 does. Obviously not 100% compatible with the original (current) behavior here but I don't foresee much trouble with it in practice. I reviewed a few couchappignore files through github search and most were fairly simple. |
The changes in #243 got merged |
@iblis17 Thanks. What do you think of simplifying that to just pass the relative path? I did this in my putdoc helper which I mentioned above. It does just the push part for some simple couchapps. I think it is the most flexible. By passing the relative path to the regex (and using
So I hope the real couchapp tool might consider doing the same, e.g. just testing the whole relative path like "node_modules/.bin/some_install" once against a regex to exclude |
It looks like in #243 you now check against a lot of combinations instead of changing the anchoring behavior. I might be reading the code wrong but AFAICT, by the time it gets to "foo/bar/baz.json" it uses (anchored) When entering foo:
When entering bar:
When reaching baz.json:
I'd recommend switching to Enter foo:
Enter bar:
Reach baz.json:
Maybe we should pass directories as |
I don't get "only test one string at each level". Just want to get rid of input like "/..." only? Would you send a PR to clearify it, and at the sometime, do not need to change test cases, then we can check which test cases in master failed/might change. |
…path (instead of re.match and filename). related to couchapp#204
@iblis17 I submitted #246 to show what I'm talking about. I wasn't able to run tests locally, but hopefully you can take a look? This is similar to your original suggestion at #204 (comment) and I think it's going to work much better now that check_ignores is getting passed the |
People still get confused...
http://stackoverflow.com/questions/11334089/ignore-folders-in-couchappignore
The text was updated successfully, but these errors were encountered: