Create a Windows desktop application in Ruby and distribute an executable file (.exe)!

From the conclusion

As of March 2018, if you want to write a desktop application for Windows in Ruby, create an executable file (.exe) and distribute it, this is the option to adopt!

procedure

Ruby-Install GNOME2. The GNOME library for Windows is also installed automatically.

gem install gtk2 -r

Install OCRA, a tool to create Windows executables from Ruby scripts.

gem install ocra -r

Create an executable file from a desktop application written in Ruby / GNOME2 using OCRA.

ocra desctopapplication.rb --no-autoload --add-all-core

The generated executable file desctopapplication.exe was 75MB.

Library comparison to create Windows desktop application (GUI application) with Ruby

name Activity status Support environment merit Demerit
Ruby-GNOME2 Active Windows, Linux, Mac Stable and informative Maintenance only. Function development is GNOME3
Ruby-GNOME3 Active Windows, Linux, Mac Actively under development There is little information, even where there is a lack of functionality
FXRuby Active Windows, Linux, Mac You can write Ruby-like code Does not support Japanese input (display is possible)
Shoes Active JRuby Can be written with simple and Ruby-like code Requires JRuby. Become pure Ruby in the future?
Qt
wxRuby No renewal for 7 years Windows, Linux, Mac - -
gem install gtk2 -r -p http://lv2west-proxy.nwdept:8080

result

Fetching: pkg-config-1.2.9.gem (100%)
Successfully installed pkg-config-1.2.9
Fetching: native-package-installer-1.0.6.gem (100%)
Successfully installed native-package-installer-1.0.6
Fetching: cairo-1.15.11-x86-mingw32.gem (100%)
Successfully installed cairo-1.15.11-x86-mingw32
Fetching: glib2-3.2.1-x86-mingw32.gem (100%)
Successfully installed glib2-3.2.1-x86-mingw32
Fetching: atk-3.2.1-x86-mingw32.gem (100%)
Successfully installed atk-3.2.1-x86-mingw32
Fetching: cairo-gobject-3.2.1-x86-mingw32.gem (100%)
Successfully installed cairo-gobject-3.2.1-x86-mingw32
Fetching: gobject-introspection-3.2.1-x86-mingw32.gem (100%)
Successfully installed gobject-introspection-3.2.1-x86-mingw32
Fetching: pango-3.2.1-x86-mingw32.gem (100%)
Successfully installed pango-3.2.1-x86-mingw32
Fetching: gio2-3.2.1-x86-mingw32.gem (100%)
Successfully installed gio2-3.2.1-x86-mingw32
Fetching: gdk_pixbuf2-3.2.1-x86-mingw32.gem (100%)
Successfully installed gdk_pixbuf2-3.2.1-x86-mingw32
Fetching: gtk2-3.2.1-x86-mingw32.gem (100%)
Successfully installed gtk2-3.2.1-x86-mingw32
Parsing documentation for pkg-config-1.2.9
Installing ri documentation for pkg-config-1.2.9
Parsing documentation for native-package-installer-1.0.6
Installing ri documentation for native-package-installer-1.0.6
Parsing documentation for cairo-1.15.11-x86-mingw32
Installing ri documentation for cairo-1.15.11-x86-mingw32
Parsing documentation for glib2-3.2.1-x86-mingw32
Installing ri documentation for glib2-3.2.1-x86-mingw32
Parsing documentation for atk-3.2.1-x86-mingw32
Installing ri documentation for atk-3.2.1-x86-mingw32
Parsing documentation for cairo-gobject-3.2.1-x86-mingw32
Installing ri documentation for cairo-gobject-3.2.1-x86-mingw32
Parsing documentation for gobject-introspection-3.2.1-x86-mingw32
Installing ri documentation for gobject-introspection-3.2.1-x86-mingw32
Parsing documentation for pango-3.2.1-x86-mingw32
Installing ri documentation for pango-3.2.1-x86-mingw32
Parsing documentation for gio2-3.2.1-x86-mingw32
Installing ri documentation for gio2-3.2.1-x86-mingw32
Parsing documentation for gdk_pixbuf2-3.2.1-x86-mingw32
Installing ri documentation for gdk_pixbuf2-3.2.1-x86-mingw32
Parsing documentation for gtk2-3.2.1-x86-mingw32
Installing ri documentation for gtk2-3.2.1-x86-mingw32
Done installing documentation for pkg-config, native-package-installer, cairo, glib2, atk, cairo-gobject, gobject-introspection, pango, gio2, gdk_pixbuf2, gtk2 after 21 seconds
11 gems installed

ocra sample.rb C:\Ruby193\lib\tcltk\ --no-autoload --add-all-core

FXRuby

Fxruby.org, which should have been the official website, is dead, but I don't care because there are so many activities on github. Substitute with README.

The latest version is 1.6.39, released on December 25, 2017.

Click here for API manual

I can't input Japanese. Unofficial patch needs to be well received. It seems. http://magazine.rubyist.net/?0001-RubyGUI#l8

Shoes ... for JRuby

FXRuby ... alive The official website http://www.fxruby.org/ is dead and The trunk has been left unattended for 6 years, but the latest version of 1.6 is fairly active, so it's okay. Latest glue === 1.6.39 / 2017-12-26 Fix FXGLVisual.supported and .supported? Add support for RubyInstaller-2.5

Ruby/Tk Ruby-GNOME2 QTRuby ... Recently suspicious Ruby / FLTK ... Development stopped from that time wxRuby ... No updates since 7 years ago

limelight ... No updates since 6 years ago

Use FXRuby

Installation

gem install fxruby -r -p http://lv2west-proxy.nwdept:8080

result

Fetching: fxruby-1.6.39-x86-mingw32.gem (100%)
Successfully installed fxruby-1.6.39-x86-mingw32
Parsing documentation for fxruby-1.6.39-x86-mingw32
Installing ri documentation for fxruby-1.6.39-x86-mingw32
Done installing documentation for fxruby after 38 seconds
1 gem installed

reference

https://code.i-harness.com/ja/q/3fb29 https://code.i-harness.com/ja/q/1c32d https://qiita.com/drumath2237/items/16ab7247f30000cb7583

Recommended Posts

Create a Windows desktop application in Ruby and distribute an executable file (.exe)!
I want to create a Parquet file even in Ruby
Install Rails in the development environment and create a new application
A bat file that uses Java in windows
Create a native extension of Ruby in Rust
Create a Java Servlet and JSP WAR file to deploy to Apache Tomcat 9 in Gradle
[Introduction] Try to create a Ruby on Rails application
[Programming complete] ยง5 Create a review management app in Ruby
Create a JAVA WEB application and try OMC APM
[Rails] Create an application
Create a jar file that can be executed in Gradle
How to change a string in an array to a number in Ruby
Create a MySQL container for application testing in Ansible AWX
Get attributes and values from an XML file in Java
I tried to create an API to get data from a spreadsheet in Ruby (with service account)