turboladen/tailor

Tries to check non-ruby files

Closed this issue · 7 comments

When I give tailor a directory, it tries to check .erb and .md files in my Chef cookbooks. Shouldn't it only catch .rb files?

I had debated on this for a bit, and decided to err on the side of less restriction in the case that you might have Ruby files with a different (or no) extension. If you use a glob, does that work?

$ tailor my_dir/**/*.rb

...and if so, is that satisfactory?

If it's a directory that you plan on checking often, you could tailor --create-config, and edit the .tailor file to use your glob.

Updated README to be a bit clearer about this. d0ff4ce

That doesn't get varying levels of directories.

For example, if I do ./**/*.rb I get only stuff one level down, but if I do */**/*.rb I DON'T get stuff one level down (or 3 levels). I end up needing to do find . -name \*.rb | xargs tailor. How about a glob in the config that just applies to filename, but you still look recursively?

Hmm... sounds like my globbing is off everywhere.

I'm not 100% sure what you mean by your question... do you want to be able to do:

Tailor.config |config|
  config.file_set 'lib'
end

...and get all files under lib/?

Added to 1.0.1 to fix globbing.

Oh, you want '**' to do 'infinite recursion'? I think that's a zshism, it's not in bash glob.

I was proposing, as an alternative, something like:

Tailor.config |config|
  config.file_glob '*.rb'
end

And then I could do 'tailor cookbooks' and it would do what it normally does (all files, recursively), except only matching filenames that are *.rb.

Yeah, I'd thought that ** meant infinite recursion... I'd picked it up from using Dir.glob('lib/**/*.rb'), for example, but it seems I'd gotten terms/uses confused.

I like the #file_glob idea--less overloading of the 'file set' term, and more explicit as to the functionality it provides. Great idea.