October 3, 2022

Windows -- Ruby (or python?)

My application is currently written in Ruby. It requires gtk3 and sqlite3. In theory, if I could install ruby along with those requirements I could run it as is. I am skeptical about being able to do that on windows, but we are going to give it a try.

There are other hidden requirements. It uses image-magick, and a new version would use ghostscript, but both of those are readily available for windows.

I swear I once installed ruby on my windows machine, but typing "ruby" yields nothing useful. So, let us try to install it again.

From here I get the rubyinstaller+devkiit-3.1.2-1 (64 bit), which is a 112 M exe file.

I run the exe file, accept the license and it will install to C:\Ruby31-x64. It is also installing something called MSYS2, which must be some kind of microsoft compatibility framework. It will "associate" .rb and .rbw files with Ruby. It seems to be installing millions of files.

As an aside, on my Fedora 35 system, "ruby --version" shows me that version 3.0.4 is installed. When I do the same thing with this new ruby install on windows, it shows me version 3.1.2. This is something new. A newer version of anything running on windows versus linux.

A file with ".rb" will run in a command window so you get to see the output. A file with ".rbw" will run without the command window

Test fly ruby

First let's try some simple code without diving into package requirements. I create "easy.rb" with a one line puts statement, then type "easy.rb" on the command line and to my surprise it just runs.

Now let's add some require statements. Asking for gtk3 gives an error. Asking for sqlite3 also gives an error.

I just try "gem", and gem is there! So:

gem install gtk3
This takes quite a long long time. The key thing is simply patience. It does finish. And after it does running the script with the line to require gtk3 runs without error, so all there is left to do is to test fly gtk3 on windows.

And it works. A simple GUI with a quit button works fine. The only odd thing I have noticed is that a puts adds a trailing newline on windows when it did not do so on linux.

Sqlite3

I anticipate this will require first installing sqlite3 (which I want to do anyway to be sure to get the sqlite3 "cli" tool), then installing the ruby package and doing whatever is required to get them talking with one another.

XXX XXX

gem install sqlite3

Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org