Problem with the build task in an extension

I’d like call the build task within an extension. Currently I do this like:

builder = ::Middleman::Cli::Build.new
builder.build

My problem is that this seems to run build with instrument set to true. With middleman 3.0.x this causes an error (as does middleman build --instrument). With middleman 3.1.x there is no error but instrument is still set to true.

To work around this I do this instead:

builder = ::Middleman::Cli::Build.new(args=[], options={:instrument=>false})
builder.build

This seems to say to me that I’m doing something wrong. How should I call the build task within an extension?

Thanks.

-Tom

We’re refactoring this for the next major release, in fact, it’s already in Git, but we’re a long way from releasing (6-12 months): https://github.com/middleman/middleman/pull/919

For now, you’re stuck “hacking” Thor like you’re doing.

OK. Will do. Thanks.