rubycommand-line-argumentsocra

Can't generate ruby exe using ocra due to ARGV[0]


Running the command ocra script.rb --no-autoload --no-enc --add-all-core gives me the error initialize: can't convert nil into String (TypeError) for the following line:

doc = Nokogiri::XML(File.open(ARGV[0]))

Whats going on here? I want to build the executable to be able to take any argument and use that file as the xml configuration.


Solution

  • Just add this above that line:

    exit if defined? Ocra
    # skip anything below this line when we're building the exe
    

    Unless there's a require or otherwise loaded dependency below that line you should be fine.