rake icon indicating copy to clipboard operation
rake copied to clipboard

New dsl method: lazy(&block)

Open lionelperrin opened this issue 5 years ago • 3 comments

Make possible to lazy define tasks in a namespace. The tasks are loaded only on lookup.

Lazy definitions can be executed on purpose when using the option --load-lazy-definitions so that rake --tasks --load-lazy-definitions list all tasks including the one defined in a lazy way.

Example of lazy definitions:

namespace 'a' do
  lazy { task 't' }
end

or

namespace 'a' do
  lazy { load 'namespace_a.rake' }
end

lionelperrin avatar Feb 18 '20 08:02 lionelperrin

This is awesome! I am in need of something like this, and would love to see this merged and released if possible.

TSMMark avatar Jun 09 '20 01:06 TSMMark

I'm surprised this doesn't have more traction... Everyone enjoys longer load times because they're loading extra code they don't need all the time I suppose?

Any words from maintainers what it would take to get this merged? Thanks!

TSMMark avatar May 05 '23 15:05 TSMMark