Rails: How can I use system zip on Heroku to make a docx from an xml template?

前端 未结 1 435
心在旅途
心在旅途 2021-01-22 10:33

I have this working locally, storing the template files in #{Rails.root}/tmp, using system \"cd tmp/template; zip -r ../#{@filename} *\" to zip up the

1条回答
  •  不思量自难忘°
    2021-01-22 11:11

    Can't you just a create directory within #{Rails.root}/tmp called, say, #{Process.pid}_docx/something_nice/? Copy (or symlink) what you need into:

    #{Rails.root}/tmp/#{Process.pid}_docx/something_nice/
    

    Then

    system "cd #{Rails.root}/tmp/#{Process.pid}_docx/; zip -r x.zip something_nice"
    

    And then you have:

    #{Rails.root}/tmp/#{Process.pid}_docx/x.zip
    

    With a nice pretty internal structure that doesn't include your PID.

    0 讨论(0)
提交回复
热议问题