intersystems / ipm

InterSystems ObjectScript Package Manager
MIT License
29 stars 19 forks source link

Add an option to transfer parameters to modules installation #37

Closed evshvarov closed 4 years ago

evshvarov commented 4 years ago

For example the name of the REST application, or parameters for post-install methods

evshvarov commented 4 years ago

Could be implemented similar to what we have in %Installer: declare the defaults for parameters at the beginning of the module and substitute to transferred values in the call

timleavitt commented 4 years ago

You can already do this. In the command line, add -DParamName=Value - this goes into subscripts of the params array

evshvarov commented 4 years ago

wow. That's neat. And how to declare the default parameter?

On Thu, Feb 20, 2020 at 2:57 PM Tim Leavitt notifications@github.com wrote:

You can already do this. In the command line, add -DParamName=Value - this goes into subscripts of the params array

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/intersystems-community/zpm/issues/37?email_source=notifications&email_token=AAVHEP3XWTIU4IFWGPMK4W3RD2D6LA5CNFSM4KYMM7WKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMOCALA#issuecomment-589045804, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVHEP5KLH5LSFTHDSBU7FDRD2D6LANCNFSM4KYMM7WA .

timleavitt commented 4 years ago

@evshvarov looks like the fork from the HS package manager was before that feature was added. It'd be fairly straightforward to port. I'll send internal references over an ISC-only back channel. ;)

timleavitt commented 4 years ago

The other missing piece for this pattern (which I'd recommend) would be support for arbitrary parameter names in %ZPM.PackageManager.Developer.Processor.Abstract:%Evaluate

Note that in command line -> COS, -DParamName.Something.Foo=Value translates to pParams("ParamName","Something","Foo") = "Value".

evshvarov commented 4 years ago

@timleavitt , how can I refer to the parameter inside the module?

timleavitt commented 4 years ago

You have access to the params array in the installer as well as resource processor class *Phase methods. If it's something that you want to persist, you can just stuff it in a global from the appropriate place (of those options).

evshvarov commented 4 years ago

Is it the right usage? https://github.com/intersystems-community/ssl-client/blob/390619e2b739c63eecf38e816af241f0409a9739/module.xml#L12

timleavitt commented 4 years ago

@evshvarov I think so? Real test is, does it work? (I'm not super familiar with Invokes since that's not part of the original HS package manager.)