I’m very new to rails and I have a script that I run from the console like this
$ ruby axml2xml.rb ExamPaper.apk
Now, how do I call this script from within my controller method and pass the same parameter as ExamPaper.apk?
I tried require 'axml2xml.rb' but got some error pointing to this line of code Zip::ZipFile.foreach(ARGV[0]) do |f|. So basically, how do I make something like axml2xml.rb 'ExamPaper.apk' in my controller?
You have at least 3 options:
exec(command)%x{ command }system(command)They have different behaviors, so make sure to read this quicktip and/or the answer of this question to learn more about these commands.
In your case, the backticks or
%xcommand is probably the best option.