ZH version is available. Content is displayed in original English for accuracy.
I recently published some new work to Hokusai Pocket, which is a cross-platform binary made on top of raylib and MRuby that runs GUIs from ruby scripts.
License?
MIT!
How does it work?
The binary is available on the GitHub releases page: https://github.com/skinnyjames/hokusai-pocket/releases/tag/0...
You can download the binary on x86 Windows, OSX, or Linux, and run your GUI application with
hokusai-pocket run:target="<your_hokusai_app.rb>"
For a little bit of a hello world, I started a photoshop clone
https://github.com/skinnyjames/hokusai_demo_paint
Also a little game
https://github.com/skinnyjames/pocket-squares
Docs / Help?
The docs are in progress, but the old docs for the CRuby version express some of the basic ideas around the project. https://hokusai.skinnyjames.net/docs/intro
(I'm also available to answer questions in between slinging pizza)
Deps?
Hokusai pocket currently uses
* libuv for offloading cpu intensive tasks to a worker pool to prevent blocking the UI thread, and I plan to integrate some libuv networking as well.
* raylib for backend graphics / I've also built with SDL on arm64 to run applications on my pinephone
* NativeFileDialog for the lovely integration into filesystem.
* MRuby for running or embedding the scripts
* tree-sitter for the custom template grammar (Although templates can be built with ruby)
Anyway, I hope you get a chance to try it. If you make something cool AND have docker installed, you can also publish your work as single binary
`hokusai-pocket publish:target=<your cool program.rb>`
Would love feedback, apps, and help with documentation and more build targets.
urs truly,
@ ᴗ @

Discussion (7 Comments)Read Original on HackerNews
I mean, I can follow ops intent to a general degree, it sounds interesting, but ..
Thanks for trying to meet me halfway. I hope I can bridge the gap.
The repository is the codebase for a GUI toolkit. It runs ruby scripts that make use of a custom templating language (like html), and a super class that provides similar component technology you'd likely find in vue or react. (Hokusai::Block).
When the ruby script is run from the binary built from the codebase (hokusai-pocket), it spawns a window with your application. There are releases for x86 linux, windows, and osx - and also arm64 linux. You just write your application, and run it with `hokusai-pocket run:target=app.rb`
The hokusai-pocket binary also include a command for publishing your application as a standalone binary for different platforms, but I'm currently working on that.
So all in all, it is a gui toolkit + runner that you can download for x86 linux, windows, and osx to dynamically run desktop applications.
I mentioned cutting its teeth on a photoshop clone. Here's a screenshot: https://file.skinnyjames.net/demo.gif
The motivation came from building desktop applications and working with awesome but cumbersome GUI toolkits like Nuklear.
I built a graphics backend-agnostic GUI library in CRuby called Hokusai, but Hokusai uses FFI, isn't portable, and is hard to distribute. (Need a Ruby interpreter on the target)
I ported the library to MRuby, developed some build tools, and now have a portable binary for different platforms that can run a dynamic desktop application/game that is written in Ruby.
You can try it yourself by downloading the latest release and running an app like: https://github.com/skinnyjames/hokusai_demo_paint
If you notice the paint repository, there is nothing to build, just ruby scripts and assets.
The tool also has commands to build your application for different platforms as standalone binary, but I'm currently working in that space for other reasons.
There are of course constraints to using MRuby vs CRuby, but I hope I speak to how this library addresses those.
It also integrates some helpful libraries, like libuv for cpu intensive tasks and I'm currently working on adding networking/HTTP and builds for android (it already runs on a pinephone).
The thing I think that is cool is that you don't need to compile your apps, you can just run them with the binary.