AkechiShiro AkechiShiro - 1 year ago 122
Ruby Question

Building a ruby script with Ocra for cross platform uses but i get the 'relative_path_form' with a stacktrace

I'm trying to build a .exe to execute my script on Windows without any ruby installation.
I'm using Ocra for that but i have a stack trace.

Also note that there are two files that runs the whole sc and that I use currently RVM and I didn't do any sudo gem install since I use RVM.

Gems used in the first file :

require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'colorize'
require 'colorized_string'

Gems used in the second file :

require 'libnotify'
require './firstfile'
require 'os'
require 'twilio-ruby'

Here is what Ocra gives me:

>ocra --output test.exe firstfile.rb secondfile.rb
/home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:41:in `relative_path_from': undefined method `path' for "/home/xxxx/.rvm/gems/ruby-head@global":String (NoMethodError)
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:779:in `block in build_exe'
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:762:in `each'
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:762:in `build_exe'
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:1177:in `block in <top (required)>'

Here is more info about my rvm and my ruby version it's the exact output of 'rvm info'

uname: "Linux xxxx 4.7.1-1-ARCH #1 SMP PREEMPT Wed Aug 17 08:13:35 CEST 2016 x86_64 GNU/Linux"
system: "arch/libc-2.24/x86_64"
bash: "/usr/bin/bash => GNU bash, version 4.3.46(1)-release (x86_64-unknown-linux-gnu)"
zsh: " => not installed"

version: "rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "1 day 23 hours 44 minutes 51 seconds ago"
path: "/home/xxxx/.rvm"

interpreter: "ruby"
version: "2.4.0dev"
date: "2016-05-20"
platform: "x86_64-linux"
patchlevel: "2016-05-20 trunk 55077"
full_version: "ruby 2.4.0dev (2016-05-20 trunk 55077) [x86_64-linux]"

gem: "/home/xxxx/.rvm/gems/ruby-head"
ruby: "not set"

ruby: "/home/xxxx/.rvm/rubies/ruby-head/bin/ruby"
irb: "/home/xxxx/.rvm/rubies/ruby-head/bin/irb"
gem: "/home/xxxx/.rvm/rubies/ruby-head/bin/gem"
rake: "/home/xxxx/.rvm/gems/ruby-head/bin/rake"

PATH: "/home/xxxx/.rvm/gems/ruby-head/bin:/home/xxxx/.rvm/gems/ruby-head@global/bin:/home/xxxx/.rvm/rubies/ruby-head/bin:/home/xxxx/.rvm/bin:/usr/bin"
GEM_HOME: "/home/xxxx/.rvm/gems/ruby-head"
GEM_PATH: "/home/xxxx/.rvm/gems/ruby-head:/home/xxxx/.rvm/gems/ruby-head@global"
gemset: ""

My script parse an HTML page and also has to create a file inside the folder it is, write/read to this file and also Libnotify has to set a this i don't know how to exactly explain it but it's some kind of path :

Libnotify.icon_dirs << '/home/' + ENV['USER'] + '/Downloads/NotificationIcons/'

So maybe one of those is what Ocra means by relative path but I'm not sure a 100% that's why I'd like to understand what 'relative path' explicitly means and also why do I have this stack trace with this error.

PS: The 'xxxx' are just here for privacy !

Thanks for any help in advance I'm currently stuck in packaging my project to cross-platforms for now I'm just trying to get it on Windows.

If you need anymore information just ask for it, also be gentle if I made any mistakes as this is my first question asked on Stack Overflow.

Answer Source

Ocra doesn't work on Linux currently.

Doing a google search for

ocra undefined method `path'

Linked here, an issues page on the Ocra github which shows many people have had the same problem. This in turns links here, where the project maintainer says that Ocra does not work on Linux, though it may be worth a shot with Wine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download