-
Notifications
You must be signed in to change notification settings - Fork 19
Custom Install Scripts
This feature may appear in Shoes 3.3.x, depending on demand. What' s shown and described does work but it needs a lot of testing and some real applications that could test it and propose improvements.
This feature is also called Secondary Packaging and is intended for Shoes script writers to manage how their Shoes script in installed in the end user's system. Without this feature, a packaged script is installed it will check if Shoes is already installed. If not, it will either download Shoes and install that (dnlif - Download If Needed) or install a copy of Shoes that was in the included with the script (Include Shoes, aka repack). Then Shoes is used to run the script/shy. That works but it is lacking in some flexibility.
For instance. If you have a shy that contains your scripts and data files and writes to those data file are lost when the script exits or crashes because the shy is not permanent storage. So you have to write code that determines that it is being installed and move things around before it can get running. That's something of pain to figure out in Shoes. What if you could write a install script that only runs once, when the shy is installed and it could move files around, create icons associations, set up menus and other things just like a real app installer would do. Stuff you don't want to deal with. So this feature does that. It provides a default secondary install script with some platform specific ways to those things. Of course you could modify the default secondary install script or write your own.
Lets say your app has an myicon.png you use to set_window_icon and a another Ruby file of helper methods or Shoe and and Sqllite3. Currently inside your myapp.exe it looks like this:
myapp.exe/
-- Shoes.install.exe (dnlif or repack, 100kb or 12 MB)
-- Shoes.rsrc (Walkabout icons)
-- myapp.shy/
-- myapp.yaml -- you can't see this normally
-- mymain.script
-- helper.script
-- myapp-icon.png
-- mysql.db
OSX and Linux differ only in those resource files. Conceptually the same. With custom or secondary packaging is your shy is enclosed in another shy.
myapp.exe/
-- Shoes.install.exe (dnlif or repack, 100kb or 12 MB)
-- Shoes.rsrc (these are Walkabout icons)
-- custom.shy/
-- installer.yaml
-- installer_script.rb
-- installer.ico
-- installer.icns
-- installer.png
-- myapp.shy/
-- myapp.yaml
-- mymain.script
-- helper.script
-- myapp-icon.png
-- mysql.db
Now at install time, Shoes unpacks custom.shy and runs installer_script.rb. It's job is to unpack myapp.shy, use those installer icons to setup menus, short cuts, OSX.app structure, move your mysql.db to some place permanent and otherwise create an app for the user. How does it know what to do?
Wait for it...
It's a Shoes.app running in Shoes! It can ask the user where to put things and you as developer can supply defaults.
Lets peek at the using these features using my depo app ytm
The default installer script lives in static/stubs/app-install.tmpl so every Shoes since 3.2.19 has it. Study it before writing your own. It's cross platform. Maybe that doesn't matter to you. Maybe it will. Where it says "alway add a png" it's serious. Even if you're packaging for windows or OSX, add that Linux.png