ocra
ocra copied to clipboard
Scripts using __END__ and DATA cannot be packed
When Ruby loads the script, DATA is not defined.
puts DATA.read
__END__
Hello, World!
C:\>ocra data.rb
=== Loading script to check dependencies
./data.rb:1: uninitialized constant DATA (NameError)
This is especially frustrating when trying to use DATA to lock the file for the "single instance only" trick. Any progress on this, or any simple change I could make to OCRA to cause it to overlook this?
You can avoid using DATA during compilation by checking for Ocra:
exit if defined?(Ocra)
DATA can't work with the way Ocra currently runs the script to check dependencies. It's possible it could be worked around by invoking a separate Ruby instance to check dependencies, but I haven't looked into it.