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

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)

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)

RubyMotion is the best alternative. But if don't want to spend the money you should be able to use macruby.
Here are some resources
http://blog.phusion.nl/2010/03/12/creating-our-very-first-mac-application-with-ruby-how-exciting/
I must say that using macruby for a big project might not be a good idea. You should expect stuff breaking and few support. As of 2015, the [MacRuby page on GitHub][3] says that the project is in an indefinite hiatus due to the changes made by Apple in the Objective C garbage collection support that MacRuby depends on. They suggest using RubyMotion.
RubyMotion seems to be really good for what you want but for development the lack of a IDE is really a huge downside. Also from my experience rubymotion only comes handy if you already know the cocoa framework really well.
So my recommendation is for you to test rubymotion if you can. They give your money back in the first 30 days if you only want to try it out. So if you have the money give it a try.
If you are new to osx development and only want to develop for osx I think you should go with objective-c. The language is not that bad and you will get the best development environment available for it for free.

Related

Is it possible to create native graphical user interfaces in Ruby?

I am considering using Ruby for a project, but I'm a complete beginner, so don't know what is, or is not, possible with Ruby 2.0.
I have looked at wxRuby, but it hasn't been updated since 2009, so I take it that means it is not compatible with RUby 2.0.
Is there another option for creating native GUIs, or are these not done in the Ruby land?
Thanks.
It's certainly possible to create GUIs with Ruby, but it doesn't appear to be widely done. Off the top of my head I can think of the following projects that might help you:
rwx - project was created as a successor to wxRuby
RubyMotion for iOS, Android and OS X
Yes, it's certainly possible to create GUIs with Ruby. You can see my full list of Ruby GUI libraries here.
However, desktop Ruby GUI apps aren't widely developed because the Ruby community is heavily weighted toward web application developers, and they are much more likely to build a web application than a desktop application. Ruby is the language of hip tech startups, and conventional user interfaces don't suit their aesthetic.
Also, it's very difficult to build native-looking cross-platform GUI apps, so web applications tend to be more acceptable to end users.

Creating Ruby applications for Windows

I want to develop a Windows application. Honestly I care little about cross-platforms for now (but still would be good)
I want to use Ruby, since it has quite a simple syntax and is so.. well, simple and easy to learn.
My application is like a "game level creator", where you can design your own level and then run it with another application which is a "game level player" by reading the project file created by the creator app. You get the idea.
Now, I got a new PC and is completely clean. Absolutely no trace of my old Ruby experiments and fails.
First of all, I will need to choose a GUI platform for my Ruby application! Can you recommend me one? I have heard of Shoes and Tk, but want to know what you think.
Have you considered IronRuby? It's an implementation of Ruby that runs on the .Net platform, which means you have access to all of the standard Windows Forms libraries, if you decide to run in Windows. http://ironruby.net/
According to david4dev, it also runs well on Mono, which makes it great for cross-platform compatibility, as the Mono platform runs on Mac OSX and Linux, as well as Windows.
Jorg W Mittag says that using the WPF (Windows Presentation Framework) is an even better option for creating GUI's since Mono has a very strong implementation of the WPF. The WPF was created to be platform agnostic and is better suited for cross-platform development over WinForms, since WinForms is tightly coupled with the Windows OS.
I recommend using Shoes out of the 2. Shoes is a nice simple way to build small applications using Ruby. The reason why Shoes is better than TK for your application is that it makes it very simple to create graphics.
Shoes is well suited to small apps and it will be quite hard to create a game creator using it.
You are probably better off using an SDL based game framework such as Rubygame . This works on Linux, Windows and OSX.
For the simple, typical editing most GUI kit will do just fine. However, for the more complicated (and especially the level creation/editing) you're mostly gonna end up using a lot of self-made rendering in DirectX/OpenGL.
I don't know a lot about Ruby though, but I'd consider GUI kits Or frameworks with that aspect in mind.
Just thought I'd share my 2 cents :)

Rich and widely used Ruby GUI framework for Windows?

I read about wxRuby and Shoes but never used them. I want to learn ruby by developing a real-world serious Windows application. Among the available frameworks, which one is widely used and acceptable, rich in libraries and comes bundled with .exe builder?
There aren't a great deal of sensible choices for client/desktop applications in Ruby right now, however I believe one of your best options is to take advantage of mature JVM libraries via JRuby.
The Redcar text editor is written in Ruby and runs on the JVM, and you can view the source on Github here https://github.com/danlucraft/redcar
There is also a development company called Atomic Object that made a neat Ruby desktop app using JRuby with a fairly sophisticated GUI and you can view that here.
I've been thinking about the exact same problem as you and keeping and eye on my the options, these last few months :-)
I've also been using JRuby on the server-side and it's solid and reliable.
Finally, if it's Windows-only as you say, then you could consider using a .NET GUI Framework like WPF and build it using IronRuby, however IronRuby is not yet as mature as JRuby, so you could be exposing yourself to some risk there in terms of compatibility, bugs and performance (and for the record, I like IronRuby!).
However, the potential issues of using IronRuby might be balanced out by the gains you'd make using a GUI framework that's designed and optimised for Windows and is nicer than Swing. WPF is about as rich as it gets for GUI frameworks on Windows.
There are bindings for Qt on GitHub. I believe it's a fork from the Korundum bindings from KDE. However, I haven't tried it on Windows yet.
You might consider using RubyTk. Tk is a toolkit that works with many languages including ruby. For more information see tkdocs.com
disclaimer: I have no idea how widely used it is, though Tk in general is used in many places for both commercial, internal and open source projects.
http://en.wikibooks.org/wiki/Ruby_Programming/GUI_Toolkit_Modules will help
In terms of popularity, in 2008 shooes was most popular, but that has probably dropped.
http://www.pressure.to/ruby_gui_survey/
Since RubyInstaller project bundles now complete modern Tk distribution and bindings eliminating Windows installation woes- Tk seems the way to go.
With RubyGems I believe it is now possible to install GTK+ for this. So says this in Gems. This is a widely used framework, both in open source and industry. It is used in GIMP and, I think, presents a good windows system that is close to native and easily useable.

Can Ruby be used to develop simple Windows applications?

I've been developing Windows based applications for a long time and most of my present clients still desire a desktop or client/server Windows application. Is it possible to use Ruby for such applications as opposed to its primary purpose of being a Web-programming language?
Ruby is not primarily a web programming language even though Ruby on Rails is certainly suited for web development. Ruby is a general purpose scripting language.
The FXRuby and WxRuby frameworks are the most fully featured GUI frameworks for Ruby. You can write the apps in Ruby and then generate a Windows executable. The frameworks are cross-platform, so you could also run the apps written in these on other platforms, like Linux or Mac OS X.
There are also a few other less popular approaches like QtRuby and Shoes, and you can even use IronRuby (a CLR Ruby implementation) to write a .Net application.
Ruby is a general purpose object oriented scripting language. Ruby on Rails is a web application framework. Ruby predates Rails by about ten years. Don't confuse the two.
Yes, you can. Ruby is a full scripting language. You might want to start with the Ruby language homepage to see the capabilities and libraries that are available.
However, just because you can doesn't mean that you should. Before jumping in and using Ruby for a project, see if Ruby can give you things that other languages can't or if there are any disadvantages to using Ruby.
I know this thread is old, but for future reference to anyone who's looking into options for using Ruby for a GUI app, don't use QtRuby. I had developed a project for school in about a week, fully functional and pretty, only to find out that I could not release it. There was simply no way to package and distribute the application without having your users simulate your exact environment (install all the gem dependencies, build Qt development libraries etc). I tried using:
Crate: supposedly cross-platform, but I found only 1 usage example that's written in 2008 out of ~2 hours of googling, and the example basically covers a very specific subset of applications (some ssl/https authentication gem or w/e...)
Ocra: this looks like a candidate, but it's windows-only and didn't meet my requirements, as I had to target the three primary platforms
tar2rubyscript + rubyscript2exe: I had spent most of my time trying to get this to work because I've come across many who claimed that this is the way to go for distributing GUI apps built in ruby (albeit using other toolkits, Tk/GTK/wxRuby) but it didn't work either; I was endlessly faced with a cryptic error that basically breaks Qt::UiLoader functionality, in other words, you can't load .ui sheets you create with QtDesigner so...
Yes I'm angry and frustrated honestly, because I don't see the point of creating software that you just can't release for anyone to use. Now I'm left with a deadline coming up in a week, and I just hope I make it in time porting the app to C++.
So my answer is, don't use QtRuby. At least for now.
On a mac, you can use the Ruby Cocoa lib to create (what appear to be) native applications. If you want something more cross platform then you might consider a wrapper like shoes or qt.
The Qt toolkit seems the most popular way to do it. The website is http://www.darshancomputing.com/qt4-qtruby-tutorial/
I'm currently writing a little app in a wrapper called Shoes. This seems to make it as simple as pie to create windowed apps in ruby. http://shoes.heroku.com/ is the website.
At the moment Shoes looks suitable only for small personal apps. I say this because it's author recently went AWOL and it's not clear whether it will be developed further. I'm using it to write a game log parser to generate statistics from a flight sim. It's ticking along nicely.
Ruby can be used for developing GUI applications, whether Windows specific or cross-platform.
For Windows targetted you should look at the work going on with IronRuby since they have good integration with the .NET framework overall and with Silverlight, in the event you want to do apps that can bridge web and desktop. At this point IronRuby can be used to develop for Windows Presentation Foundation (WPF) or WinForms.
For cross-platform you have Ruby bindings for QT, FOX and others.
You should look at IronRuby - WPF and windows forms are both supported:

Is Netbeans equally awesome for Ruby development on the Mac?

I realize most Ruby development on the Mac uses Textmate but I love Netbeans in the Windows environment and am wondering whether it's equally awesome on the Mac - even if it's swimming against the stream a little bit, would Netbeans pose any issues as a Ruby IDE on the Mac?
It won't pose any issues, but it doesn't really give you many benefits over using another editor - they are all practically the same, it's just the workflow and small bits of functionality that change. I guess it's down to personal preference - if you feel comfortable with Netbeans then it's fine for you to use it. However, TextMate is very popular because it does give a good level of built-in support for Ruby and Rails, it's a lot faster than Netbeans, and feels much more like a native app (which of course it is).
Ultimately it's up to you and what you want to get out of your editor/IDE.
I've used Netbeans extensively on Mac and PC. For the Mac, it's essentially identical -- one subtlety is the interplay between ctrl and cmd (apple key). On the Mac, as for other Mac apps, cmd often performs the same role as ctrl on the PC, and ctrl is the same as right-click, for instance, cmd-clicking on method names / class names / render fragment names jumps to that file (if it can find it) and all the other Rails goodness that comes with 6.5+.
Netbeans + growl + autotest = awesomeness.
I also own Textmate but never been convinced.
I am another that is not convinced by Textmate or "that it is a lot more than that". For me it constantly broke and filled my code with logging messages. I think Textmate is living on glory days of when it was the best rails editor you could get. For me Netbeans is much better as a rails development environment unless you are of the hardcore, never use a mouse persuasion. All the cool snippet features ( which was Textmate's big deal ) have been replicated in Netbeans. It is slower, but not that slow, and good coding is not a race.
AND
Netbeans is free!!

Resources