How to include recipe inside the Libraries folder file

I’m writing an LWRP.

I’m in the situation that I’ve a file at libraries/ folder.

In this file, how can I include the recipe that installs some pkgs and gems.

include_recipe ‘foo’ doesnt seem to work.

How can I include that recipe in the libraries/bar.rb file?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com (http://nepalonrails.tumblr.com)
http://funsole.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

I don’t think you can but more seasoned Chefs here will be able to confirm or deny.

My understanding is that the libraries/ directory is there to hold Ruby code that will support your recipes, not the other way around.

You can include a recipe in another recipe via the include_recipe resource, though.

  • cassiano

On Friday, June 28, 2013 at 04:56, Sachin Sagar Rai wrote:

I'm writing an LWRP.

I'm in the situation that I've a file at libraries/ folder.

In this file, how can I include the recipe that installs some pkgs and gems.

include_recipe 'foo' doesnt seem to work.

How can I include that recipe in the libraries/bar.rb file?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com (http://nepalonrails.tumblr.com)
http://funsole.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

Library files are not meant for including other recipes. My normal pattern
is to have a default.rb recipe (or lib.rb) that I should be included by
default if I need to force other recipes to be included. If you are truly
crafty, ruby would allow you to mess around with recipes in libraries
(since it is all Ruby code), but it will probably be very hard and
unmaintainable.

Andrew

On Fri, Jun 28, 2013 at 8:38 AM, Cassiano Leal cassianoleal@gmail.comwrote:

I don’t think you can but more seasoned Chefs here will be able to
confirm or deny.

My understanding is that the libraries/ directory is there to hold Ruby
code that will support your recipes, not the other way around.

You can include a recipe in another recipe via the include_recipe
resource, though.

  • cassiano

On Friday, June 28, 2013 at 04:56, Sachin Sagar Rai wrote:

I'm writing an LWRP.

I'm in the situation that I've a file at libraries/ folder.

In this file, how can I include the recipe that installs some pkgs and
gems.

include_recipe 'foo' doesnt seem to work.

How can I include that recipe in the libraries/bar.rb file?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com http://nepalonrails.tumblr.com
http://funsole.com
Sent with Sparrow http://www.sparrowmailapp.com/?sig