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

**URL:** <https://discourse.chef.io/t/should-complex-lwrps-like-ark-be-factored-out-into-separate-gems/3237>\
**Category:** Chef Infra (archive)\
**Created:** [October 27, 2012, 3:59pm UTC](https://discourse.chef.io/t/should-complex-lwrps-like-ark-be-factored-out-into-separate-gems/3237 "2012-10-27T15:59:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [October 27, 2012, 3:59pm UTC](https://discourse.chef.io/t/should-complex-lwrps-like-ark-be-factored-out-into-separate-gems/3237/1 "2012-10-27T15:59:54Z")

</div>

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.

> **[bryanwb/chef-ark](https://github.com/bryanwb/chef-ark)**
>
> An archive unpacker and installer. Contribute to bryanwb/chef-ark development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Jeffrey\_Hulten1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeffrey_hulten1/32/585_2.png) [@Jeffrey\_Hulten1](https://discourse.chef.io/u/Jeffrey_Hulten1)\
**Post date:** [October 27, 2012, 5:23pm UTC](https://discourse.chef.io/t/should-complex-lwrps-like-ark-be-factored-out-into-separate-gems/3237/2 "2012-10-27T17:23:09Z")

</div>

## 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](mailto: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.
> 
> [GitHub - bryanwb/chef-ark: An archive unpacker and installer](https://github.com/bryanwb/chef-ark)

---

<div class="post-metadata">

**Author:** ![Paul\_Mooring](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/paul_mooring/32/475_2.png) [@Paul\_Mooring](https://discourse.chef.io/u/Paul_Mooring)\
**Post date:** [October 27, 2012, 5:37pm UTC](https://discourse.chef.io/t/should-complex-lwrps-like-ark-be-factored-out-into-separate-gems/3237/3 "2012-10-27T17:37:29Z")

</div>

## 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

> **[DevOps Automation & Infrastructure Management Software | Chef](https://www.chef.io/)**
>
> Chef helps enterprises automate DevOps and infrastructure management. Simplify operations with ClickOps and Policy-as-Code while scaling securely across clouds.

-----Original Message-----  
From: Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)  
Reply-To: "[chef@lists.opscode.com](mailto:chef@lists.opscode.com)" [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Date: Saturday, October 27, 2012 8:59 AM  
To: "[chef@lists.opscode.com](mailto:chef@lists.opscode.com)" [chef@lists.opscode.com](mailto: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.
> 
> [GitHub - bryanwb/chef-ark: An archive unpacker and installer](https://github.com/bryanwb/chef-ark)

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [October 27, 2012, 8:05pm UTC](https://discourse.chef.io/t/should-complex-lwrps-like-ark-be-factored-out-into-separate-gems/3237/4 "2012-10-27T20:05:28Z")

</div>

Paul I am generally inclined to agree w/ you, however I recently  
contributed to the collectd-dsl gem  
[https://github.com/pyr/collectd-dsl](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](mailto: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](http://www.opscode.com)
> 
> -----Original Message-----  
> From: Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)  
> Reply-To: "[chef@lists.opscode.com](mailto:chef@lists.opscode.com)" [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Date: Saturday, October 27, 2012 8:59 AM  
> To: "[chef@lists.opscode.com](mailto:chef@lists.opscode.com)" [chef@lists.opscode.com](mailto: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.
> > 
> > [GitHub - bryanwb/chef-ark: An archive unpacker and installer](https://github.com/bryanwb/chef-ark)
