Feature Requests: Browse | Submit New | Admin
My ruby scripts usually need parameters, like database name or path to the data to be processed. With ocra there is no possibility to pass them to my program, so I have to code default parameters that fit my sample environment. Would be nice to call ocra with additional parameters for my script, i.e.: ocra <Ocra-switches> MyScript.rb <MyScript-switches> or ocra MyScript.rb <Ocra-switches> -- <MyScript-switches>
Add A Comment:
Date: 2010-09-02 17:54 Sender: Lars Christensen Closing; Resolved in OCRA 1.2.0.
Date: 2010-08-21 22:08 Sender: Lars Christensen Implemented on github now, by popular request :-)
Date: 2010-06-10 14:41 Sender: Lars Christensen I don't think this is quite so simple, for a number of reasons. Currently, additional arguments after the script.rb name are assumed to be names of additional files to be packaged (e.g. assets). '--' has a different meaning for typical shell programs: To prevent the invoked program from interpreting following arguments as program options. I don't like making it mean something else for ocra. Should the arguments be passed both when building the executable, and when running the executable? Users will also expect to be able to pass arguments to executables built with OCRA -- and that is the current behaviour. E.g. myscript.exe --opt=val would be the same as: ruby myscript.rb --opt=val I don't see a robust way to handled this, if arguments are also provided when building the executable with OCRA. For example, which arguments should be passed first? The user's or the arguments set when building? I recommend making an alternative script: myloader.rb: raise "Unsupported arguments" unless ARGV.empty? ARGV.replace(["--opt=val"]) load File.join(File.dirname($0),"realscript.rb") And then running: ocra myloader.rb realscript.rb
Date: 2010-04-28 09:11 Sender: Stephan Kämper I second this suggestion. My workaround for now: Query user for corresponding information (in my case mostly file names). This works, but is rather cumbersome. Processing parameters would be greatly appreciated.