Re: [Puppet Users] require custom ruby code in custom function

2012-03-06 Thread Dominik Zyla
On Monday, 5 March 2012 at 11:37, flex wrote:
 hi, all:
 
 i want to require my own ruby class in a custom function, now i put the ruby 
 file in the same directory with custom function, and require it in the 
 function file like this:
 
 require File.join([File.expand_path(File.dirname(__FILE__)), 'test.rb'])
 
 but i think this is too ugly, is there any other way?
 
 -- 
 System Administrator, Focus on System Management and Basic Development
 -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To post to this group, send email to puppet-users@googlegroups.com 
 (mailto:puppet-users@googlegroups.com).
 To unsubscribe from this group, send email to 
 puppet-users+unsubscr...@googlegroups.com 
 (mailto:puppet-users+unsubscr...@googlegroups.com).
 For more options, visit this group at 
 http://groups.google.com/group/puppet-users?hl=en.

Hi,

I'm doing something like this in my scripts (not exactly puppet custom 
modules/facts but it will do the trick):

$LOAD_PATH  File.expand_path(File.dirname(__FILE__) + '/../lib')

then you can use `require test' construction.

Best,
-- 
Dominik Zyla



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] require custom ruby code in custom function

2012-03-05 Thread flex
hi, all:

i want to require my own ruby class in a custom function, now i put the
ruby file in the same directory with custom function, and require it in the
function file like this:

require File.join([File.expand_path(File.dirname(__FILE__)), 'test.rb'])

but i think this is too ugly,  is there any other way?

-- 
System Administrator, Focus on System Management and Basic Development

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.