Shelling out from an action with ``?


#1

I’m trying to shell out (with the `` method, to call wget) from within
an action. It looks something like this:

def prepare_project
@project = Project.find_by_id(params[:id])
logger.info(“Exporting project…”)
wget blah blah
zip blah blah
flash[:notice] = “Exported project successfully.”
redirect_to :action => ‘export_project’, :id => @project.id
end

The app hits this method and does indeed end up on export_project,
rendering that view… but it never seems to do the wget or zip stuff,
or even log! Can anyone please point me toward a solution?


#2

For starters, instead of using wget why not use Net::HTTP? It can do
the same thing, though maybe with a bit more work on your end.

As far as zipping goes, well, does anyone else know of a usable ruby-zip
library and can point out docs or a tutorial?