Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocra not building standalone executables from ruby scripts even when provided the gems path as argument #180

Open
vivekwebm2020 opened this issue Jan 20, 2022 · 1 comment

Comments

@vivekwebm2020
Copy link

vivekwebm2020 commented Jan 20, 2022

As I stated in the Question title, I have installed Ruby 3.0 version in Windows 10 64Bit OS and I have coded this program for Password generation and copying the generated password to clipboard(PasswordGenerator.rb):

require 'clipboard'
CHARS = ('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a + ('!'..'?').to_a
def GeneratePassword(length=16)
    return CHARS.sort_by{rand}.join[0...length.to_i]
end
Clipboard.copy (GeneratePassword 15)

And I have also installed all the necessary gems that could be needed as dependencies and even sub-dependencies with these:

gem install ocra
gem install --install-dir ./gems thor ftools nokogiri rubygems clipboard

But the second command above installed all the dependencies inside (dir of PasswordGenerator.rb)/gems/gems directory instead of (dir of PasswordGenerator.rb)/gems/ folder, but I ignored that as maybe gem install --install-dir sucked once due to glitch.

But now as I try to build standalone executable from PasswordGenerator.rb with ocra in the same directory it gives me this error. I want a permanent solution of this issue with understanding of why and how ocra wasn't able to add the gems even when specified in the build command the extra paths like ocra PasswordGenerator.rb ./gems/gems and threw this error:

path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:693:in `block (3 levels) in find_gem_files': undefined method `relative_path_from' for nil:NilClass (NoMethodError)
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:693:in `select'
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:693:in `block (2 levels) in find_gem_files'
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:685:in `each'
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:685:in `block in find_gem_files'
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:627:in `each'
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:627:in `find_gem_files'
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:755:in `build_exe'
        from path/to/ruby/gems/3.0.0/gems/ocra-1.3.11/bin/ocra:1231:in `block in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@vivekwebm2020 and others