larsch / ocra

One-Click Ruby Application Builder
http://ocra.rubyforge.org/
833 stars 83 forks source link

"No implicit conversion of nil into string" #72

Open moverware opened 10 years ago

moverware commented 10 years ago

I receive this error simply when i type in Ocra into Cygwin

/cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/gems/ocra-1.3.1/bin/ocra:18:in `quote': no implicit conversion of nil into String (TypeError)
        from /cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/gems/ocra-1.3.1/bin/ocra:18:in `<class:Pathname>'
        from /cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/gems/ocra-1.3.1/bin/ocra:8:in `<module:Ocra>'
        from /cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/gems/ocra-1.3.1/bin/ocra:4:in `<top (required)>'
        from /cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/bin/ocra:23:in `load'
        from /cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/bin/ocra:23:in `<main>'
        from /cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
        from /cygdrive/c/Users/mover96/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'

any ideas?

deanpcmad commented 10 years ago

I'm getting this as well on Xubuntu 14.04. Ruby 2.0.0-p481

› be ocra --help    
/home/dean/Projects/brm/install-ruby/vendor/bundle/gems/ocra-1.3.2/bin/ocra:18:in `quote': no implicit conversion of nil into String (TypeError)
    from /home/dean/Projects/brm/install-ruby/vendor/bundle/gems/ocra-1.3.2/bin/ocra:18:in `<class:Pathname>'
    from /home/dean/Projects/brm/install-ruby/vendor/bundle/gems/ocra-1.3.2/bin/ocra:8:in `<module:Ocra>'
    from /home/dean/Projects/brm/install-ruby/vendor/bundle/gems/ocra-1.3.2/bin/ocra:4:in `<top (required)>'
    from /home/dean/Projects/brm/install-ruby/vendor/bundle/bin/ocra:23:in `load'
    from /home/dean/Projects/brm/install-ruby/vendor/bundle/bin/ocra:23:in `<main>'
tralston commented 10 years ago

I get the same error as @mover96. My script is very simple:

puts "Starting program..."
x = 5
puts x
x *= 4
puts x
grauddi commented 9 years ago

I also am receiving this error

jesse1983 commented 9 years ago

I also am receiving this error. OSX 10.10.1 RVM 1.26.9 Ruby 2.2.0

jgleesawn commented 9 years ago

This problem is coming about due to File::ALT_SEPARATOR having a value of nil. This seems to be the case on cygwin/msys2 systems despite them being in windows. http://computer-programming-forum.com/39-ruby/7216d1ae1310e408.htm There is the simple hacky fix to just stick a check in, but then you're circumventing the replacement that is supposed to happen. Which would not update any stored paths/filenames for calling purposes outside of a cygwin/msys environment? Another possibility is to set an alt_separator variable and use that instead of using the system's constant value. If the program is being run from inside msys/cygwin, I don't know if the separator translation would affect how msys/cygwin treat/deal with files.

This is just supposed to fill out some information as to why its happening and some possible directions someone could look in to deal with it. I think other issues will arise after these simple changes and it may take some effort to get it working in cygwin/msys.

@jesse1983 and @deanperry in Problems and Bug Reporting it does say Windows Support only

larsch commented 9 years ago

Only the Ruby from rubyinstaller.org are tested, and only native windows builds of Ruby is known to work. I have not made any effort to get Ocra working with any other platform than the rubyinstaller.org installers, so I don't even know if it is feasible.

jgleesawn commented 9 years ago

@larsch My latest update, if it doesn't break anything from the rubyinstaller side, allows a full run through/creation of a .exe under msys2. At least with the project I've been working with. Given, this .exe gives an Application error(0xc0000013) if run from an explorer folder, and has pathing issues for non-system requires when run from the terminal in msys2.

I'm not saying you should accept the pull request, but its there if anyone else uses msys2 and has some good ideas for how to fix these pathing issues.

P.S. I would assume this holds for cygwin as well.

tille commented 9 years ago

I don't think it's a cygwin issue since I'm getting the same error under ubuntu 14.04, with a helloWorld file. touch ocraTest.rb && 'puts hello word' >> ocraTest.rb && ocra ocraTest.rb

jgleesawn commented 9 years ago

@tille cygwin/msys2 do not register as windows in ruby, so they don't have the File::ALT_SEPARATOR constant defined out of the box. This is also the case with Unix/Linux/OSX. I believe File::ALT_SEPARATOR is only defined in Windows because Windows uses the reverse slash as a path separator.

This combined with ocra only having support for Windows made me reference it as an issue in cygwin/msys2 being linux-like environments that run on windows.

edit: "No implicit conversion of nil into string" fix is in the repo's code but may not necessarily build an executable that runs when built from a non-windows platform. It may have to do with my usage of gems in non-typical locations. Could be due to some other implicit nature of the build environment. Could be I grabbed the exe stub from a different version because I couldn't get it to compile. I'm not really sure. Sorry for such an off-topic edit.

ashes999 commented 9 years ago

@jgleesawn to be explicit, you can only run Ocra on Windows, right? I, like @tille, developed my script on Ubuntu and expected it to build a Windows EXE. I see how that doesn't make sense.

tille commented 9 years ago

@ashes999 well there is an option to build over linux using ruby wrappers however seems doesn't work https://github.com/Spooner/releasy/issues/57

ziggyjosh16 commented 6 years ago

image

Running ruby 2.4.1p111 [x64mingw32] on Windows 7

also this fails:

image