Something what I expected and didn't wanted to happen; HAPPENED!
If you use ocra gem you definitely understand what I'm saying but if you
don't I'll explain.
Ocra is a gem that is used to compile a ruby script into executables
(.exe)
The very bad thing is that whenever you try to ocra your script into an
exe it checks dependencies i.e runs the code and until it comes to the
last line of the code and ends it won't stop, literally, you need to go
to the last line of the code to successfully turn it into an exe file.
The problem is I'm using a loop in my code and I don't see ocra getting
to the end of my code.
loop = 1
while loop < 100 #do this
loop = loop + 1
end
Now I wouldn't want to press enter a 100 times so my code can turn into
exe so is there any possible way to avoid this?
You might be having a conflict with Kernel#loop method...
···
On Sat, Mar 1, 2014 at 11:29 AM, cynic limbu <lists@ruby-forum.com> wrote:
Something what I expected and didn't wanted to happen; HAPPENED!
If you use ocra gem you definitely understand what I'm saying but if you
don't I'll explain.
Ocra is a gem that is used to compile a ruby script into executables
(.exe)
The very bad thing is that whenever you try to ocra your script into an
exe it checks dependencies i.e runs the code and until it comes to the
last line of the code and ends it won't stop, literally, you need to go
to the last line of the code to successfully turn it into an exe file.
The problem is I'm using a loop in my code and I don't see ocra getting
to the end of my code.
loop = 1
while loop < 100 #do this
loop = loop + 1
end
Now I wouldn't want to press enter a 100 times so my code can turn into
exe so is there any possible way to avoid this?
If there are any gems or non-standard libraries which need to be
explicitly used in order for Ocra to pick them up, you just extend that
section of code to use them before calling "exit", which quits your
script and hands control back to Ocra.
Something like this would work to pick up the files for Watir:
if defined?(Ocra)
Watir::Browser.new.close
exit
end
Just remember that exe files are flagged as potentially dangerous, so
you have to consider the security implications.
Ocra picks up most of the gems and source files anyway, but sometimes
you might have a section of a gem which isn't required until you use it
within the code.
If it works fine with the first example then you don't need to worry
about it.
If your exe fails because it's missing components, then you might need
the second example.
Logically speaking, whenever you ocra your script it runs the script
until ocra gets to the end of it, I also tried your suggestion, it
didn't solved my problem, I'm still stuck.
If there are any gems or non-standard libraries which need to be
explicitly used in order for Ocra to pick them up, you just extend that
section of code to use them before calling "exit", which quits your
script and hands control back to Ocra.
Something like this would work to pick up the files for Watir:
I'm not sure if I totally understood what you meant by that.
I use multiple gems for my programs
do you mean something like this?
if defined?(Ocra)
require 'example'
require 'otherexample'
require 'moreexample'
end
If there are any gems or non-standard libraries which need to be
explicitly used in order for Ocra to pick them up, you just extend that
section of code to use them before calling "exit", which quits your
script and hands control back to Ocra.
Something like this would work to pick up the files for Watir:
I'm not sure if I totally understood what you meant by that.
I use multiple gems for my programs
do you mean something like this?
if defined?(Ocra)
require 'example'
require 'otherexample'
require 'moreexample'
exit
end