[chef-dev] Re: Re: Re: Re: Re: CHEF-3762: LWRP DSL for subclassing needed?


Chronological Thread 
  • From: Jay Feldblum < >
  • To: " Dev" < >
  • Subject: [chef-dev] Re: Re: Re: Re: Re: CHEF-3762: LWRP DSL for subclassing needed?
  • Date: Mon, 28 Jan 2013 18:57:07 -0500

I mean the Chef project moving the helpers into a built-in mixin.

If Chef::Resource::LWRPBase had a simple implementation:

    class Chef::Resource::LWRPBase < Chef::Resource
      # the stuff related to load-from-file

      include Chef::Resource::LightweightMixin
    end

With all of the complexity being moved into the module Chef::Resource::LightweightMixin, then anything else could include these methods as well, including subclasses of existing built-in resources.

Likewise, providers.

Cheers,
Jay

On Mon, Jan 28, 2013 at 6:48 PM, Noah Kantrowitz < " target="_blank"> > wrote:

On Jan 28, 2013, at 3:45 PM, Jay Feldblum wrote:

> One option for the helpers is to move the helpers into a mixin which is included by in the lightweight base classes, and which may be included explicitly in any non-lightweight resource or provider class.
>

This is exactly the approach the application cookbook has used, but it gets very verbose and ungainly, and leads to related code being all over the place. It also doesn't address built-in classes in Chef unless those are moved out into modules as well.

--Noah





Archive powered by MHonArc 2.6.16.

§