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.
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’).
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)
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?
Yes it works great, thanks a lot Rey!