[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Execute a file on read?

eddieroger

11/3/2006 7:20:00 PM

I am toying around with the concept of dynamic configuration files for
Asterisk (http://www.as...), and I was wondering if its possible
to have a dynamic file that's executed on read. Basicly, when executed,
the script would output a file that Asterisk is happy with, and
preferably the file could have the extension ".conf", but inside would
be Ruby code. Is this possible, or am I pipe dreaming? Thanks.

Eddie

2 Answers

Max Afonov

11/3/2006 7:34:00 PM

0

You want Unix fifos (man mkfifo) coupled with a Ruby program that opens
the fifo for writing and dumps config file contents to any 'client'.

eddieroger wrote:
> I am toying around with the concept of dynamic configuration files for
> Asterisk (http://www.as...), and I was wondering if its possible
> to have a dynamic file that's executed on read. Basicly, when executed,
> the script would output a file that Asterisk is happy with, and
> preferably the file could have the extension ".conf", but inside would
> be Ruby code. Is this possible, or am I pipe dreaming? Thanks.
>
> Eddie
>
>
>
>

************************
MLB.com: Where Baseball is Always On



Austin Ziegler

11/3/2006 8:26:00 PM

0

On 11/3/06, eddieroger <eddieroger@gmail.com> wrote:
> I am toying around with the concept of dynamic configuration files for
> Asterisk (http://www.as...), and I was wondering if its possible
> to have a dynamic file that's executed on read. Basicly, when executed,
> the script would output a file that Asterisk is happy with, and
> preferably the file could have the extension ".conf", but inside would
> be Ruby code. Is this possible, or am I pipe dreaming? Thanks.

Something like:

File.open("foo.conf", "wb") do |cf|
cf.puts <<-EOS
puts "Hello, Ruby."
EOS
end
load "foo.conf"

?

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca