Zuehlke / cookbook-windev

One cookbook with resources for setting up a Windows development environment
MIT License
7 stars 1 forks source link

Added option to package.rb to unzip and then install #21

Closed mrkita closed 7 years ago

mrkita commented 8 years ago

Perhaps this is not the cleanest way to do it, but I wanted to create this now before it gets lost as it makes installing loose leaf custom package installs much easier and still something that can be fetched.

damphyr commented 8 years ago

This overloads the "installer" option which in the doc is defined only when we don't download.

The scenarios in this case are:

How does the JSON look like in each case so that we don't break existing configurations but it also remains simple? Should we for example rely on detecting the type using the extension of the save_as and then expecting an installer entry in the case of remotes? I am wary of too much "magic" here but also of making the configuration too cumbersome

mrkita commented 7 years ago

I don't want any magic either, just after flexibility. My commit @d9fb3ca1 is an alternative, removing the automagic unpack step. However, my original line of thinking is, we only download individual files. Either the file is an executable of some sort, and will be run, or its a zip containing multiple files which must first be unpacked.

This alternative I introduce would require the use of an unpack keyword to invoke the unzip before using the installer. I'm not really sure I like it better.

However, I see the original chain as follows:

Default The 'installer' key alone means the package was already prepared and is sitting somewhere in the cache, so use it direct to run the install.

Sourced as in first commit: Does the file need to be cached first because the 'source' key is present? If yes then download it. If no 'installer' is specified, then just assume to use the 'save_as' target as the install package. If an 'installer' is specified then there must be more than one file in the download... since we don't download directories it must be a zip (what else can it be that we support?), so unzip it. We use 'installer' as a local path that was first created by the above. The semantic meaning of the key is the same.

Sourced as in second commit: Does the file need to be cached first because the 'source' key is present? If yes then download it. If no 'installer' is specified, then just assume to use the 'save_as' target as the install package. If 'unpack' is specified, then the file is a zip and must be unpacked first to the relative (not forced) local path. We use 'installer' as a local path that was first created by the above. The semantic meaning of the key is the same.

What I don't like in the second version , is that the unpack seems superfluous if we don't support other file types than single installer packages or zip files. Also in this case the use of 'unpack' would require 'installer' as there can be no assumption of which file to run in the unpacked directory.

Either case; however, is functional and can be documented for clarity.

What do you think? Would be nice to get this in ACI3 to close this hole...