Closed alx3dev closed 2 years ago
I am willing to test on Windows and Mac.
I look forward to your uploads.
Thank you, I will upload it in next hour or two.
Here are the executables. For testing purposes, a file named button.rb
will be created. If gem is not found on the system, will be installed. On close, button.rb
will be self-removed.
For production use, I would make it a little different - Installer that will:
Archive contain executables for:
button
button.app
button.exe
EDIT: Changed test file to button, because cpu
contain some linux-only functions
OK, I tested button.app in Mac x86_64 Catalina.
When I launch by double-clicking (and approving in System Prefernces -> Security & Privacy -> General -> Open Anyway), the app starts and closes right away.
I tried running form the terminal ./button.app
, and I got this output:
% ./button.app
<internal:/Users/andymaleh/.rvm/rubies/ruby-3.0.2/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- glimmer-dsl-libui (LoadError)
from <internal:/Users/andymaleh/.rvm/rubies/ruby-3.0.2/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from button.rb:3:in `<main>'
So, I installed glimmer-dsl-libui and reran ./button.app
, and it finally worked.
I tested button.exe in Windows 10 x86_64
It does not work, and gives me this message when run from the command prompt:
button.exe
panic: not supported by windows
goroutine 1 [running]:
main.exeR({0xda7b56, 0xc00002c000}, {0xdb034a, 0x175, 0xdaace9})
/home/alx/Alpha/rubygui/button.go:66 +0x4f
main.main()
/home/alx/Alpha/rubygui/button.go:76 +0xa8
I noticed it generated a button.rb file. I can run that file directly with ruby while having glimmer-dsl-libui installed.
I tested in Linux Ubuntu 21.10 x86_64.
Just like the Mac, if I just run the command, I get this message:
$ ./button
<internal:/home/oem/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- glimmer-dsl-libui (LoadError)
from <internal:/home/oem/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from button.rb:3:in `<main>'
Then, I installed glimmer-dsl-libui, and reran the button command, and it worked.
Ok, I see where the problem is. I will change a few things and upload files again.
I found some time to install virtual machines, and Windows .exe
work with ruby and glimmer installed. Old executables used syscall.Exec
which causes problem on Windows. I am writing new code to check for ruby and glimmer, and I will make a new repo with installer, once I am done (a day or two). I will also post a message with files here.
I've just made a new repository with go-lang code and executables. Repo is still private, until you test it, so I can add more functions. Linux executables written in go must be opened from terminal, but I don't care too much about executables for linux. It's more for Windows users.
@alx3dev I did receive the invitation and I accepted it. However, I just checked the repo now to see if there are new executables I could test, and suddenly the URL is not working or allowing me in anymore.
Because I made a gem that will be released under GPL license, so it's a public repo now.
I made a skeleton for gem-install process, now I am working on plugins for other stuff like git clone
if available, or net/http
download if there is nothing installed (gem or git). In some future updates, I plan to add GUI too, probably with some html
and JS
.
It's available at https://www.github.com/alx3dev/executable-ruby
It would be counter-intuitive (and negatively ironic) to add GUI in html and JS instead of using this as the perfect opportunity to eat your own dog food and build the GUI using executable-ruby and Glimmer DSL for LibUI. With all the desktop Ruby libraries I am providing, I am working very hard to end people's over-reliance on the overly complex and over-engineered web technologies of html/css/js when building local applications. I think the GUI definitely has to be desktop GUI to prove that your project works!
One more thing, it is quite inconvenient to require Rubyists to install golang. Furthermore, many Rubyists are anti-go-lang to begin with as it comes from the evil Google corporation, and prefer C or Crystal as alternatives. Could you either build a binary that would make your command work without installing golang (include a go static binary?), or otherwise rewrite your project with Crystal or C?
I know that, I also hate google corporation (that is a reason why I started with private project and invitation), but it's the only language where I am able to cross-compile without problems. I am not a C programmer (not so good), and I don't know how to cross-compile with Crystal. Building static binary is my first to-do, but for now the only thing coming to my mind is a docker container. I hope I will make static binary to work with this, hopefully with tiny-go.
Now about JS... I don't want to make GUI with JS when this library is here, I was thinking about GUI when ruby is not installed. But since I will add a ruby installation on the beginning of the process, there's actually no need for any html/js.
I think I read somewhere that go builds static binaries by default, so that is not the issue. What I actually really meant is to include golang itself as a static binary to avoid requiring Rubyists to install golang separately.
If it is too difficult/impractical at this time, what you offer is definitely better than nothing, so thank you for your effort and I look forward to your continued progress in it.
Yea I know, my English is not so perfect when I am in hurry. I was talking about building static binary that will allow us to build new binary, without golang installed.
If you have any idea how this could be done in C++ (instructions, not source-code), feel free to send me e-mail, or just open issue in the repo. I am looking forward for the best way to implement go builder without Golang installation, or to rewrite it in C++. Any opinion is highly appreciated!
You convinced me of using golang already, so I look forward to future progress in your current implementation, and I appreciate that someone is putting the effort in running CRuby code as a binary executable no matter the approach.
Hi Andy! Thank you for making this awesome Ruby library, first GUI app after
shoes
that I really like. I was thinking about rewriting shoes4, but that source code is a mess, and I don't have enough free time to work on that. Also, SWT wait-a-week-to-start is not what I want from simple app – and that's exactly when I use ruby for GUI – for simple apps. So, once again, thank you! Now let's go back on-topic…Packaging Ruby into
EXE
file is always needed, but not always easy. Windows users want to start an app with double-click, even if installation only require one simple command. At the end, cross-compilation is a pain-in-the-ass. I wrote Golang app that make executables for all three major platforms (install gem and start it), but someone should test it on Windows and Mac. If you are willing to try it, I am going to compile some of your examples, and upload it here. Executables require Ruby installed on the system, but I am looking forward to import windows ruby installer, to start if there's no ruby already installed.