Running command line scripts from Rails

Hi

I have an application that makes use of some tools that are provided on
the installed system. (statistical model compilation).

How should I do this gracefully w/ Rails.

In the past (Java equivalent) I have relied on either an API being
provided OR scraping the results of System.exec (I guess the Ruby
equivalent is Runtime.exec)… not sure how to do this in Rails though.

Thanks for any help.

There are two ways I know of. To run a simple command like ls -l:

system ‘ls -l’

%x{ls -l}

There are subtle differences between the two, but see which works for
you.

On Jul 23, 11:00 am, Jean N. [email protected]

Brian A. wrote:

There are two ways I know of. To run a simple command like ls -l:

system ‘ls -l’

%x{ls -l}

There are subtle differences between the two, but see which works for
you.

On Jul 23, 11:00�am, Jean N. [email protected]

Thanks I’ll do some reading on it this weekend and post some results.

Appreciate the reply.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs