Forum: Ruby on Rails executing a generator on the browser

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D128e08caeb0d93e8d8175ed33c3b750?d=identicon&s=25 bbtosurf (Guest)
on 2009-02-10 01:02
(Received via mailing list)
Hi

I currently have a generator which creates a directory of files. I
want clients on my app to be able to execute that generator and save
those files in their personal folder on the server. The thing is that
I have always executed this generator via terminal and it always
creates the series of files on the current path on the terminal where
I executed the command. How can a user execute this generator on the
browser and the files be created in his personal folder.

thanx
F736df208b5652ff5522c6c3063abb86?d=identicon&s=25 Rey9999 (Guest)
on 2009-02-10 14:11
(Received via mailing list)
I'm not sure of what you're asking, but if this 'generator' is an
application residing on the server running your web application, you
can call it using the ruby command system('executable_name').

regards,
rey9999
D128e08caeb0d93e8d8175ed33c3b750?d=identicon&s=25 bbtosurf (Guest)
on 2009-02-10 15:49
(Received via mailing list)
Hello Rey and thanks for your answer. This generator belongs to a gem.
So the idea is that when a user is browing my website and click on a
specific button this generator should be executed and directory of
files is created on his personal folder on the server (this folder is
created when a user signs up)

Thanks,

ElĂ­as
F736df208b5652ff5522c6c3063abb86?d=identicon&s=25 Rey9999 (Guest)
on 2009-02-10 17:59
(Received via mailing list)
My advice stands.
You'll need to call the generator using system
e.g.: system(script/generate blah blah parameters here)
selecting a target directory could be another story, if this generator
does not accept a target as a parameter. how about moving the
generated files after you've run the command?

Regards,
Rey9999
A1247f73598357f06388e863c41aa624?d=identicon&s=25 Elias Orozco (elioncho)
on 2009-02-10 18:12
(Received via mailing list)
Yes it works great, thanks a lot Rey!
This topic is locked and can not be replied to.