Monthly Archives: May 2014

Getting Close to a 3.2 release

I’ll have a 3.2b9 up in day or two. What’s in it? Cobbler works well. Nothing is perfect but it works well enough on Linux and OSX. Samples/simple-rubygems.rb doesn’t work WHEN run from the manual. It’s OK if you run it from commandline or the ‘Open App’ from the splash screen. It’s a nastly little bug (design flaw) with Shoes.setup. Worse than a hack or bug. A flaw. We don’t need it to work from the Manual. Cobbler is better that encoding that nonsense into a script. So Shoes.setup is deprecated. That means I need to change the manual and note the problem.

There’s some minor OSX build bugs remaining which no one else would find. So, I’m down to fixing the manual. I also need to fix the Wiki to mention Shoes 3.2 and Tobias suggested that 3.2 could be a ‘real’ branch of Shoes and hosted at github. Sounds simple. I’ll bet it isn’t that simple. I might by a real Mac too – the hackintosh VM is still annoying. So there won’t be much new between b9 and release versions. Except for a lot of work on thing you might never see.

Slightly Better Cobbler

The previous post showed how to install gems with Shoes 3.2 with the Shoes script cobbler.rb. It worked but had a flaw that I knew about. Not a bug, a flaw. I re-purposed Shoes/setup.rb to do the install because I’d debugged it once and it was there. It also depended on Shoes url and visit and some wacky code to keep Shoes.setup from being called twice and it was very dependent on being called by a Shoes.app with a slot that had the right number of children of the right type. Most of that ‘dessign’ doesn’t apply Cobbler. I pondered about more games with visit and urls and it grew silly.

So I did the proper thing. I copied and modified the setup code to be part of Cobbler. Instead of a brand new window being spawned, it looks like this:
install-serialport

Shoes.setup still works (if I didn’t break anything) but I no longer care that much. Legacy! It was always a kind of a hack. Yeah, I should make the progress bar move better. I guess. Someday.

This is why Shoes 3.2 exists

Some may have noticed my constant promoting of Shoe 3.2’s new gem handling and my pride at creating a Raspberry pi distribution of Shoes. I stumbled up on a great example. pi_co_op_on_pi__61805.1389718875.1280.1280The Pi Co-op board is something I’m really tempted to buy although I have no immediate use for it. Of course it’s Python based and there’s nothing wrong with that and some good reasons the python is popular on Pi.

But, if you chase down the links from the article you’ll see that there is a Ruby gem ‘firmata’ that will talk to the board. It uses the ‘serialport’ gem which has been a long running problem with Shoes. It shouldn’t be a problem now. Lets see what happens. On a pi with minimal installed software. I could spend a couple of hours getting rvm and ruby and all the shoes deps and the compile Shoes 3.2 from source. I did that on another SD card – its boring. Let;s pretend I’m a PI user and don’t know a whole lot about Ruby or Shoes so I’ll download the binary distrbution of Shoes.


ccoupe@bronco:~/Projects/shoes3.2$ ssh -X pi
ccoupe@pi ~ $ which ruby
ccoupe@pi ~ $ wget shoes.mvmanila.com/public/shoes/shoes-3.2b8-gtk2-armhf.run
--2014-05-26 15:07:44-- http://shoes.mvmanila.com/public/shoes/shoes-3.2b8-gtk2-armhf.run
Resolving shoes.mvmanila.com (shoes.mvmanila.com)... 208.113.218.222
Connecting to shoes.mvmanila.com (shoes.mvmanila.com)|208.113.218.222|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17943171 (17M) [application/x-makeself]
Saving to: `shoes-3.2b8-gtk2-armhf.run'

100%[======================================>] 17,943,171 666K/s in 28s

2014-05-26 15:08:12 (637 KB/s) - `shoes-3.2b8-gtk2-armhf.run' saved [17943171/17943171]

ccoupe@pi ~ $ chmod +x shoes-3.2b8-gtk2-armhf.run
ccoupe@pi ~ $ ./shoes-3.2b8-gtk2-armhf.run
Verifying archive integrity... All good.
Uncompressing Shoes....................................................................................................................................................................................................................................................................................................................................................................................................
Shoes has been copied to /home/ccoupe/.shoes/federales. Need root password
to copy Shoes.desktop to /usr/share/applications
Password:
ccoupe@pi ~ $
ccoupe@pi ~ $ ./.shoes/federales/shoes -c

My pi is running headless at the moment so I ssh in and redirect the X session back to my main computer. I don’t have a Ruby installed. I grab the Shoes distribution, install it and run the Cobbler. Then I’ll list the gems that come with Shoes’s builtin ruby, search for serialport, and install it.
Screenshot-List

Screenshot-Search

Screenshot-Setup

If by chance you’re following along click by click you might ask “Why does Setup take so freaking long?”. I don’t know, yet. It pegs the PI at 100%, half Shoes and half Xserver. I suspect the animation is part of it. It’s slow on all systems, you just don’t notice it as much on a faster, multicore system. But that’s not the only reason.

Screenshot-Building

Screenshot-Installed

I’m sure glad that worked. Otherwise I’d look really foolish.

Shoes 3.2b8

I’ve uploaded another ‘beta’ with downloads for Linux (64,32,arm), Win 7 (32) and OSX 10.9 (64).

What’s new? Just a few more lines of code in shoes/cobbler.rb and now you can manage Shoes gems from a GUI screen. List, Search, add, delete. No big deal for the commandline afficted who did the jailbreak (see previous posts). That said, I no longer have to apologize (much) for not including Hpricot, json, and sqlite with Shoes 3.2. Install what ever you like (and have the tools to build, if needed).

There’s an odd bug on OSX. After you do an install, you’ll get a second Cobbler window instead returning to the launching screen. And on Linux, after an install, it doesn’t refresh properly. Both of those are oddly similar to a bug running Shoes.setup (samples/simple-rubygems.rb) from the manual. For now, just quit and restart Shoes after a gem install (or you push your luck like I do and keep on going). Not a fatal bug. It’s better to get something useful and working than to wait for perfection.

Speaking of better, the Gem search function is not a wild card. If you want 'sqlite3'
then that’s what you enter. 'sql' won’t list all gems that match. I’d like to fix that but there’s no clue train in Google of people calling the Gem api to do what I’m trying to do.

One last thing. I put up the source tar ball if you don’t want to clone my github fork.

Shoes 3.2b7 OSX – This might work.

I think I’ve produced a reasonable Shoes 3.2 for OSX 10.9 (see the download tab to find shoes-3.2b7-osx10.9.tbz. Download it, double click to decompress and then run the Shoes app from the download folder (double click) or drag it to some other folder (any folder) and double click from there. It may take a few seconds to get to the splash screen open.

Like all Shoes 3.2 versions, there are no built-in gems – no json, no hpricot, no sqlite3 so samples that require those gems will fail. As will samples that use old and dead url’s. The ruby inside is 2.1.1 (verify with samples/simple-info.rb if you like)

You might notice an extra menu item on the splash screen – ‘Maintain Shoes’ Try it. The only two three options that work are ‘Clear image cache’ and ‘Jailbreak Gems’. Don’t clear cache unless you’ve read the code and understand what it will do to existing Red Shoes images caches. ‘Copy samples’ just makes a copy of samples in a new directory so you don’t have to poke around with a commandline to find them. Sadly, the open_save_folder dialog is seriously awful in OSX.

Jailbreak Gems is how you can tell Shoes 3.2 to use existing gem directories on your system. Be aware of versioning problems with binary gems. If your existing nokogiri, hpricot, sqlite3….. was built with Ruby 1.9.3 or 2.0 it will fail because as I mentioned, Shoe 3.2b7 for OSX uses Ruby 2.1. Gem handling is much different in Shoes 3.2 (Shoes.setup might really work, see below)

For OSX to compile a binary gem, you’ll need XCode (a free but large large download if you have a free Apple developer ID). The Ruby included with Shoes 3.2b7 also has the include files so anything compiled by Shoes.setup will use those Shoes included headers and libs, not some other Ruby you might have installed and laying around.

That may sound restrictive and anal compulsive nit picking. If you want to use the ‘serialport’ gem or some other ‘fringe’ binary gem in Shoes 3.2, you can if you follow the rules. No need for special pleading to the Shoes Gods to accomodate your favorite gem when (if) they get around to it. You can handle it yourself in Shoes 3.2. If somebody writes a gem to interface with the Raspberry GPIO pins, you can use it in Shoes 3.2. That liberty comes with some effort on your part to install the development tools and other libs that are needed for building the gem. Jailbreak.

The 3.2b7 downloads for Linux and Windows are also available.

Ain’t that pretty at all

Apologies to the late great Warren Zevon for the title of this post. I’ve started to ‘refactor‘ the Rakefiles once again for OSX. It’s not pretty. Never was and it may never be pretty. Still, consistency is the Hobgoblin of small minds or so I’m told.

My small mind says (assited by Ruby changes since 1.9.1) that there are two kinds of Shoes3.2 – one you can build and run with whatever you have (Loose Shoes) and a Shoes you can distribute to anyone else (Tight Shoes). You can run build and run Tight Shoes on your platform (just like the original shoes) so tight shoes is what I need to get working for OSX because that’s the Shoes you can upload and expect that it works for the downloaders. Tight.

Shoes3.2 behaves slightly differently for Tight and Loose at startup for gem handling and also for gem installing. It’s not my small mind. It’s the big minds at Ruby HQ. So OSX needs the loose/tight build capabilities. It’s a long slow slog for me. Ain’t that pretty at all.

Too clever for my Shoes

I mean no disrespect for whoever wrote the OSX/homebrew rake file code but it’s one fragile mess – but it looks cool because it uses map and inject and that saved half a dozen lines of code. Shoes code does suffer from over-engineering and coolness de-jure. I’d leave it alone, if it worked.

Introducing a ‘~/.rvm’ RVM installed Ruby breaks the rake. (humor attempt). It’s really about the problem that Ruby-1.9.3/2.0/2.1 inflicted on Shoes that are intended to be copied: –enable-load-relative. On OSX, not only do you have to have that kind of Ruby (I use RVM) you need do a wild dance with otools and install-name-tool and the original rakefile fails to dance when Ruby doesn’t not live where the orignal author that it would. I solved this for Linux. Windows didn’t need solving, which bothers me in a different way.

I can solve it for OSX. It’s just a freaking linking loader problem, with a lot of accumulated cruft and wisdom dating back to PPC/m68K and OSX-10.0 days plus ppc/intel and then i386/x86_64 and now just x86_64. Apple was (is) damn clever about those multiple arch things. With 10.9 and Shoes, I really don’t care about that mulit-arch past – I just need to know what is historical and what is useful now because of that past.

There’s a lot of layers of ‘Oh, Shiney. Is that new? It must be good”. It’s not just Shoes or Ruby. That problem is why you have old people. Smart enough to know shiny from shinola.

Hackintosh – Time for RVM install Ruby.

Hopefully everyone knows not to trust my pronoucements. The default Ruby (2.x) and Shoes on OSX shares the same problem with Linux : not compiled with –enable-load-relative. To refresh your memory there are two types of Shoes 3.2 – tight shoes and loose shoes. Tight shoes can be shared or copied or moved across the internets because they have their own copy of Ruby. Loose shoes (build from source) just compiles with whatever Ruby you have and can’t be moved. I’ve whined about this before but it still matters. Things appear to work for you (me) and yet they don’t work for anyone else. See here if you don’t believe me.

The OSX code (rakefiles) doesn’t know about loose vs tight for OSX. OSX needs to be a Tight Shoes if I’m going to put up a binary tbz for others to download, so I need to compile a Ruby that does the right thing (Rubies that come with the system, rarely do the right thing for Shoes).

I had hoped to buy a real mac mini but that fell apart. I still will, when the price is right but I was hoping I wouldn’t have to do rvm twice and homebrew one more time. I lose. Not that more practice would hurt me.

FWIW, the Hackintosh in Virtualbox survived the 10.9.3 upgrade. I used the Jewelery Box GUI to install RVM. Then I started a new terminal (to get rvm env) and did a command line install $ rvm install 2.0.0 -C --enable-load-relative
Cecils-Mac-Pro:~ ccoupe$ rvm install 2.0.0 -C --enable-load-relative
Checking requirements for osx.
Installing requirements for osx.
Updating system......................................
Installing required packages: autoconf, automake, libtool, libyaml, readline, li
bksba, openssl.........
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/ccoupe/.rvm/rubies/ruby-2.0.0-p451, this
may take a while depending on your cpu(s)...
ruby-2.0.0-p451 - #downloading ruby-2.0.0-p451, this may take a while depending
on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.2M 100 10.2M 0 0 233k 0 0:00:44 0:00:44 --:--:-- 685k
ruby-2.0.0-p451 - #extracting ruby-2.0.0-p451 to /Users/ccoupe/.rvm/src/ruby-2.0
.0-p451...
ruby-2.0.0-p451 - #applying patch /Users/ccoupe/.rvm/patches/ruby/changeset_r452
25.diff.
ruby-2.0.0-p451 - #applying patch /Users/ccoupe/.rvm/patches/ruby/changeset_r452
40.diff.
ruby-2.0.0-p451 - #configuring.................................................
ruby-2.0.0-p451 - #post-configuration.
ruby-2.0.0-p451 - #compiling....................................................
ruby-2.0.0-p451 - #installing..............
ruby-2.0.0-p451 - #making binaries executable..
ruby-2.0.0-p451 - #downloading rubygems-2.2.2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 404k 100 404k 0 0 276k 0 0:00:01 0:00:01 --:--:-- 276k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.0.0-p451 - #extracting rubygems-2.2.2...
ruby-2.0.0-p451 - #removing old rubygems.........
ruby-2.0.0-p451 - #installing rubygems-2.2.2...............
ruby-2.0.0-p451 - #gemset created /Users/ccoupe/.rvm/gems/ruby-2.0.0-p451@global
ruby-2.0.0-p451 - #importing gemset /Users/ccoupe/.rvm/gemsets/global.gems.....|
ruby-2.0.0-p451 - #generating global wrappers.........
ruby-2.0.0-p451 - #gemset created /Users/ccoupe/.rvm/gems/ruby-2.0.0-p451
ruby-2.0.0-p451 - #importing gemsetfile /Users/ccoupe/.rvm/gemsets/default.gems
evaluated to empty gem list
ruby-2.0.0-p451 - #generating default wrappers.........
ruby-2.0.0-p451 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.0.0-p451 - #complete
Please be aware that you just installed a ruby that requires 2 patches ju
st to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to ruby-2.1.1 which will have all of the latest securi
ty patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri
Cecils-Mac-Pro:~ ccoupe$

Note that RVM installed the autoconf,make and build stuff (to bite me later?) and the Ruby dependencies (libyaml, readline, openssl ..). I do like that. Note how it updated for Rubygems 2.2.2 — that is a real time saver.
Then I installed Ruby 2.1.1 as suggested.

Does the OSX rakefile know how to handle an RVM install? — Stay tuned.

Shoes 3.2b6 for OSX – much better.

Ignore that previous post about the OSX release and it’s funky problems. This one actually works. You might notice it’s not a .dmg. It’s a bzip2 tar ball of Shoes.app. You can run it from the downloads folder or drag it to your Applications folder from there is you want (you don’t have to). I understand what’s happening now (mostly). It does have most of the 3.1 problems since I haven’t fixed any OSX bugs — I just made it work with OSX 10.9.2 and Ruby 2.0.9-p451.

I’ll play with installed names next so it doesn’t collide with other Shoes you might have on your Mac. – that’s a lot easier now w/o the .dmg

Shoes 4 Prerelease

In case you read this blog and aren’t on the Shoes Mailing List, Shoes 4 (prerelease) was made available a few days ago. Congratulations!

What does that mean to my Shoes 3.2 effort? There’s additional tested samples to try – that’s good. If I disappear, there is still a forward path. That’s very good. There’s a target of functionality I don’t want to break compatibility with and strive to achieve — a new reference platform. That’s good.

It also takes a subtle, self imposed, pressure off of me. I don’t have to fix every bug in Shoes 3.2 if they are fixed in Shoes 4 and I can deal with working with what make Shoes 3.2 unique and interesting too me.