Should complex lwrps like ark be factored out into separate gems?


#1

As my ark LWRP becomes increasingly complex, I start to wonder whether
I should factor it out into a separate ruby gem. What would be the
pros and cons of this approach? An aspiring rubyist wants to know.


#2

I don’t see anything in the current code base that would need a gem unless you plan to extract the ruby only (not chef specific) code for reuse.

Jeffrey Hulten
Principal Consultant at Automated Labs, LLC
jeffh@automatedlabs.com 206-853-5216
Skype: jeffhulten

On Oct 27, 2012, at 8:59 AM, Bryan Berry wrote:

As my ark LWRP becomes increasingly complex, I start to wonder whether
I should factor it out into a separate ruby gem. What would be the
pros and cons of this approach? An aspiring rubyist wants to know.

https://github.com/bryanwb/chef-ark


#3

I think lwrps and gems have pretty different use cases. You do have a
substantial amount of code in private functions that could be broken out
into a gem, but much of it is still tightly coupled with Chef. The real
question is would the benefits of having a general Ruby library (via a
gem) be enough to merit the work of decoupling your code from Chef and
refactoring the lwrp to use a gem.

Paul Mooring
Systems Engineer and Customer Advocate

-----Original Message-----
From: Bryan Berry bryan.berry@gmail.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Saturday, October 27, 2012 8:59 AM
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] should complex lwrps like ark be factored out into
separate gems?

As my ark LWRP becomes increasingly complex, I start to wonder whether
I should factor it out into a separate ruby gem. What would be the
pros and cons of this approach? An aspiring rubyist wants to know.

https://github.com/bryanwb/chef-ark


#4

Paul I am generally inclined to agree w/ you, however I recently
contributed to the collectd-dsl gem
https://github.com/pyr/collectd-dsl which defines a lovely dsl for
collectd configuration files. Ark could be useful to people trying to
automate the download-unpack-configure-make-install dance outside of
chef. I also wonder if the separation from chef could make it more
modular and easier to test. However, I am just speculating there.

On Sat, Oct 27, 2012 at 7:37 PM, Paul Mooring paul@opscode.com wrote:

I think lwrps and gems have pretty different use cases. You do have a
substantial amount of code in private functions that could be broken out
into a gem, but much of it is still tightly coupled with Chef. The real
question is would the benefits of having a general Ruby library (via a
gem) be enough to merit the work of decoupling your code from Chef and
refactoring the lwrp to use a gem.

Paul Mooring
Systems Engineer and Customer Advocate

www.opscode.com

-----Original Message-----
From: Bryan Berry bryan.berry@gmail.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Saturday, October 27, 2012 8:59 AM
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] should complex lwrps like ark be factored out into
separate gems?

As my ark LWRP becomes increasingly complex, I start to wonder whether
I should factor it out into a separate ruby gem. What would be the
pros and cons of this approach? An aspiring rubyist wants to know.

https://github.com/bryanwb/chef-ark