Monday, August 20, 2012

[HOW TO] Install Shoes (Ruby GUI Toolkit) in Xubuntu

Shoes is a cross-platform toolkit for writing graphical apps easily and artfully using Ruby. Unlike most other GUI toolkits, Shoes is designed to be easy and straightforward without losing power.
Shoes (Ruby GUI Toolkit) running on Xubuntu 12.04
Figure 1. Shoes (Ruby GUI Toolkit) running on Xubuntu 12.04

Installing Shoes on Xubuntu (or any other Ubuntu distribution) is not as straight forward as it should be. There's a Shoes package in the Ubuntu repositories, however, it's buggy and using it will result in the following error:

no such file to load -- rubygems

From my experience building Shoes might result in errors during the process.

The easiest and simplest way to install Shoes in Xubuntu were to download Shoes 2 (0.r1134), codenamed “Raisins” and use it to run the Shoes programs. It's a older version, but I'm just getting started with Shoes and for now it'll suffice.

Install

Open a terminal window and run:

sudo wget -O /usr/local/bin/shoes http://goo.gl/3cigS && sudo chmod +x /usr/local/bin/shoes

Usage

Shoes can be accessed typing the following command: shoes [SHOES_PROGRAM].

Running Shoes without arguments will run the interface shown on Figure 1. Then you use the "Open an App" option to run a Shoes program.

If you supply the Shoes program path to the shoes command, the program will be launched right away.

Example

Wanna take it for a spin? Run the following instruction to see it in action:

echo -e 'Shoes.app :width => 300, :height => 200 do\n  button("Click me!") { alert("Xubuntu Geek.") }\nend' > ~/hello_shoes.rb && shoes ~/hello_shoes.rb

This instruction will create a "hello_shoes.rb" file with the content shown below this paragraph. Then it'll the Shoes program. The result is shown on Figure 2.

Shoes.app :width => 300, :height => 200 do
  button("Click me!") { alert("Xubuntu Geek.") }
end
Hello World Shoes application running on Xubuntu
Figure 2. Hello World Shoes application running on Xubuntu

References

shoes gui - Ubuntu Forums
Shoooes!

2 comments:

  1. Olá,
    Em algumas postagens as linhas de código estão ultrapassando os limites da caixa de texto, o que dificulta a seleção.

    ReplyDelete
    Replies
    1. Esse problema não se verificava no Chromium. Já fiz a alteração e verifiquei no Firefox 14.X; as linhas já não ultrapassam os limites.

      Obrigado.

      Delete