middleman/middleman — pull request #1328 by dg-vrnetze (2014-07-21 09:25:05+00:00)
Title: Use generate_file instead of a monkey patched create_file (middleman CLI)

Hi there,

at `middleman-core/lib/middleman-core/cli/build.rb` you monkey patch `::Thor::Actions::CreateFile` for `middleman` and all its extensions, but you use this functionality only in `build.rb`.

Would you mind to merge my pull request? It creates a new method `generate_file` which uses `GenerateFile`-class which is a child of `CreateFile` but overwrites `on_conflict_behavior`. Therefor it does not modify the default behaviour of thor.

This way every extension which provides its own cli-commands to `middleman` can rely on the default behaviour of `thor` or use the `generate_file`-method with the modified behaviour of `middleman`. Otherwise one needs to monkey patch `::Thor::Actions::CreateFile` for every single `middleman`-cli-command which wants/needs the default `thor`-behaviour.

For now I did not write any tests because there is no change in behaviour. Any feedback would be welcome. :-)

Cheers,
dg