How do you pass arguments from within a rake task and execute a command-line application from Ruby/Rails?
Specifically I’m trying to use pdftk (I can’t find a comparable gem) to split some PDFs into individual pages. Args I’d like to pass are within < > below:
$ pdftk <filename.pdf> burst output <filename_%04d.pdf>
In the ruby code for your rake task:
You could also do:
system()just returns true or false. backticks or%x()returns whatever output the system call generates. Usually backticks are preferred, but if you don’t care, then you could usesystem(). I always use backticks because it’s more concise.More info here: http://rubyquicktips.com/post/5862861056/execute-shell-commands