That title just rolls of the tongue, doesn’t it? Here’s view of the 3.2.19 packager when you select “I want Advanced Options” when packaging an Directory (a .shy). It would be meaningless to use advanced options for a single file. It’s for ‘Apps’ that have multiple ruby files or images or sqlite3 db files or other files.
It’s close enough to the final version (he says) to discuss what the choices mean. If you don’t provide your own installer script then you’ll be using the default customer installer. Page down for a screen shot of that, in action.
If you want your own installer to run on the users system then you’d push that button and select your Shoes script – you’d probably start with a copy of
static/stubs/app-install.tmpl Notice where it says to always include a png? It’s serious.You need to do that even it you are targeting Windows or OSX.
Remember, the installer Shoes script, custom or default will run on the users machine using what ever Shoes it can find. It might be a Shoes included or it might be a part of a download if needed package that only installs Shoes if its not already installed. This secondary app-installer runs in Shoes on the users system, before/instead of the shy you packaged. Clear? Probably not.
There is a choice ‘Expand shy in users Directory”. When Shoes runs a .shy it creates a temporary directory, expands the shy into it and runs the .rb you chose as the staring script when you created the .shy. When the program exits, usually if things are working corrrectly, that temp dir is deleted. Anything you write in that temp dir is deleted. this is considered a very good thing by some folks. Shoes always worked that way and it’s the default option here.
Perhaps you don’t want that. Maybe you’re using an older Green Shoes script that assumes it can save files right next to the script. Or you want users to be able to edit and change your code but they can’t because it’s hidden in a .shy (temp dir) that disappears when Shoes quits. Then you check that expand option. You are the developer. You can hide your code or allow access.
Here’s how my YTM default custom app installer looks:
We can see several interesting things. The title is not “Shoes”! If the users theme allows it, the icon would be that .png you had to include. It will fail if you didn’t. The text in the panel shoes tehm the Shy meta data. The end user can pick where they want the ‘App’ installed. They can’t control your choice of expand or not. Either way they get something perament they can double click or run from menus/filemanager or Finder or Explorer. No need for the launching from the command line in Linux.
I’m showing the Linux version because that’s all that that works so far. I wish it was prettier with better functionality but there are limits to Linux. There will be limits to Windows and OSX but I do the hard case first because that sets the scope for all platforms.
I almost forgot. That categories edit_line only shows up on linux and entries in their are highly dependent on the users Linux, Windows manager and theme. You can ask for categories but don’t be surprised if you setup doesn’t honor your choices.
Did I mention it’s all Shoes. If you don’t like my default custom installer you can write your own. And you can this packaging from any Shoes platform to any other Shoes in the 3.2 family.
How does it work? It’s pretty simple on the surface, Here’s listing of the tmp dir while the custom installer is started
ccoupe@bronco:/tmp/shoes-ytm-custom.19160$ ls -l
-rw-rw-r-- 1 ccoupe ccoupe 20974 Dec 5 20:26 ytm.icns
-rw-rw-r-- 1 ccoupe ccoupe 99678 Dec 5 20:26 ytm.ico
-rw-rw-r-- 1 ccoupe ccoupe 4517 Dec 5 20:26 ytm-install.rb
-rw-rw-r-- 1 ccoupe ccoupe 1033 Dec 5 20:26 ytm.png
-rw-rw-r-- 1 ccoupe ccoupe 9065 Dec 5 20:26 ytm.shy
-rw-rw-r-- 1 ccoupe ccoupe 430 Dec 5 20:26 ytm.yaml
There are the icon’s I added on the building system. The running gui screen is ytm-install.rb. ytm.shy is the the .shy I chose to package. ytm.yaml is the options used to build ytm-install.rb with. Most of them are useless but expandshy isn’t. It controls what is written to the users chosen directory. ~/Applications/ytm in this case. This example is packed expandshy = false. Let’s click the install button and see what is placed in ~/Applications/ytm
ccoupe@bronco:~/Applications/ytm$ ls -l
-rw-rw-r-- 1 ccoupe ccoupe 257 Dec 5 20:47 ytm.desktop
-rw-rw-r-- 1 ccoupe ccoupe 1033 Dec 5 20:47 ytm.png
-rw-rw-r-- 1 ccoupe ccoupe 9065 Dec 5 20:47 ytm.shy
There’s the ytm.shy and the ytm.png. ytm.desktop is the Linux menu entry that was copied to one or two places on your Linux system. You can launch YTM in 3 ways. There’s a menu entry (my system) in Others. If my file browser understands .desktop files it will launch on a double click. Lastly, I could use the terminal.
What about expandshy = true?
ccoupe@bronco:~/Applications/ytm$ ls -l
-rw-r--r-- 1 ccoupe ccoupe 639 Dec 5 21:00 foo.csv
-rw-r--r-- 1 ccoupe ccoupe 761 Dec 5 21:00 foo.rb
-rwxr-xr-x 1 ccoupe ccoupe 745 Dec 5 21:00 quote.rb
-rw-r--r-- 1 ccoupe ccoupe 613 Dec 5 21:00 README.txt
-rw-r--r-- 1 ccoupe ccoupe 1230 Dec 5 21:00 TODO.txt
-rw-rw-r-- 1 ccoupe ccoupe 256 Dec 5 21:00 ytm.desktop
-rw-rw-r-- 1 ccoupe ccoupe 1033 Dec 5 21:00 ytm.png
-rwxr-xr-x 1 ccoupe ccoupe 14414 Dec 5 21:00 ytm.rb
-rw-r--r-- 1 ccoupe ccoupe 456 Dec 5 21:00 ytmsec.csv
-rw-r--r-- 1 ccoupe ccoupe 456 Dec 5 21:00 ytmsec.csv.sav
It’s every thing in my original shy only this time all the files are permanent. I can update my csv data files and the changes will stick. My launch options are the same – the .desktop points to ytm.rb in the the previous example it pointed to ytm.shy.
Expand or not, the end user of ytm only has to use the terminal once to execute the downloaded file and only suffers the marching ants on the terminal once.
The same design principles will apply to OSX and Windows. Details matter of course because they aren’t equal.
With your own custom installer script you can get as clever and pretty as Shoes and Ruby allows. Maybe you only care about Windows. Fine! Be that way, if you like. If you can find or create a gem that manipulates the Registry, you can use Shoes to download it and you have the ability to copy the existing Shoes into a different directory and install your app just like NSIS would. Difficult work, but do able. Pretty simple gem for someone to write.
Clever Linux and OSX tricks are easier than Windows. Copy an exsting.shoes/federales to somewhere else – make it your own app. Before your imagination runs wild, remember where gems are stored. These are possibilities you can do. I’m only supplying the ‘default’ custom installer.
I wonder what would happen if I packaged Hackety Hack with an expandshy = true and it’s icons. It could be done with any Shoes 3.2.19 platform. Assuming I get the Windows and OSX version working.