Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby GUI support on OSX Mavericks (Not Shoes or Ruby Motion) plus OSX app package support

This has been asked many times. Some of the answers are pretty old now. I have looked around everywhere for 2 things.This the last resort before I give up. Looking for:

  • Bindings that will enable GUI programming using Ruby (not Shoes) using Mavericks. I have found plenty bindings but with no activity for the past 3 or 4 years, with the exception of RubyMotion which seems very expensive while not taking advantage of Xcode features / does not have an IDE.

  • Way to package app for users as a regular OSX app so the user does not have to install anything by hand on OSX (if mutiplatform even better to target Windows too)

I have fallen in love with Ruby but without a means to tackle the above will be difficult to deploy for users, while I am not interested in Rails. Feels like Rails popularity has in effect killed Ruby by putting it into a niche when it could be so much more.

Any new news on either of these 2 fronts or everything is abandoned / dead ? Should I move on with Python / Objective-C ? (Which I like both but enjoy Ruby more)

like image 970
Will Avatar asked Oct 02 '22 07:10

Will


1 Answers

I succesfully compiled scripts with tk, green shoes and gosu as a GUI to an executable with ocra but only have experience doing so on windows. If you want an actual, cross platform GUI try the java swing framework with jruby, here an example. If you deploy a JAR or an executable nu further installations are needed. I suppose you use MRI ruby now, the step to jruby is not so difficult.

require 'java'

# With the 'require' above, we can now refer to things that are part of the
# standard Java platform via their full paths.
frame = javax.swing.JFrame.new("Window") # Creating a Java JFrame
label = javax.swing.JLabel.new("Hello")

# We can transparently call Java methods on Java objects, just as if they were defined in Ruby.
frame.getContentPane.add(label)  # Invoking the Java method 'getContentPane'.
frame.setDefaultCloseOperation(javax.swing.JFrame::EXIT_ON_CLOSE)
frame.pack
frame.setVisible(true)
like image 62
peter Avatar answered Oct 18 '22 16:10

peter