-
Notifications
You must be signed in to change notification settings - Fork 27
Adding zpm "ci" command to install from a lock file #1080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
26c1f47
dedd323
6a759be
90daa5e
15eed15
d5bdbc1
7ad4aa2
8574b03
bdecd8b
405afad
827ae62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -791,6 +791,25 @@ generate /my/path -export 00000,PacketName2,IgnorePacket2^00000,PacketName3,Igno | |
| <example description="Show details of history item with ID 3 and information for each undergone lifecyle phase">history details 3 -phases</example> | ||
| </command> | ||
|
|
||
| <command name="ci"> | ||
| <summary>Installs a module from a lock file</summary> | ||
| <description> | ||
| Installs a module from its lock file. Will first install all listed repositories followed by dependency modules and then the base module. | ||
| </description> | ||
|
|
||
| <!-- Examples --> | ||
| <example description="Reads from the module-lock.json defined for mymodule and installs the repositories, module, and dependencies"> | ||
| ci mymodule 3.0.0 | ||
| </example> | ||
|
|
||
| <!-- Parameters --> | ||
| <parameter name="module" required="true" description="Name of module on which to perform update actions" /> | ||
| <parameter name="version" description="Version (or version expression) of module to install; defaults to the latest available if unspecified." /> | ||
|
|
||
| <!-- Modifiers --> | ||
| <modifier name="verbose" aliases="v" dataAlias="Verbose" dataValue="1" description="Produces verbose output from the command." /> | ||
| </command> | ||
|
|
||
| </commands> | ||
| } | ||
|
|
||
|
|
@@ -1031,8 +1050,10 @@ ClassMethod ShellInternal( | |
| do ..ModuleVersion(.tCommandInfo) | ||
| } elseif (tCommandInfo = "information") { | ||
| do ..Information(.tCommandInfo) | ||
| } elseif (tCommandInfo = "history") { | ||
| do ..History(.tCommandInfo) | ||
| } elseif (tCommandInfo = "history") { | ||
| do ..History(.tCommandInfo) | ||
| } elseif (tCommandInfo = "ci") { | ||
| do ..CleanInstall(.tCommandInfo) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit confusing to me to have "ci" stand for "CleanInstall", since 1) CI=continuous integration, and 2) it doesn't mention the lock file like "LockFileInstall" would for example. But taking a step back, what's the benefit of having a new command versus using a flag on
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The initial plan was to have creation of a lock file be tied to install/load but installing from it its own method. However, the more I think about this, I do think you are correct. Functionally, I don't think there is anything that requires a whole new method as opposed to the new flag you suggested. I'll make the switch for the next PR iteration (and we can always back track if a reason comes up to). As for the naming part: The reason we called it ci/CleanInstall for consistency since that is the same name used in other package managers. |
||
| } | ||
| } catch pException { | ||
| if (pException.Code = $$$ERCTRLC) { | ||
|
|
@@ -2396,12 +2417,11 @@ ClassMethod Install( | |
| $$$ThrowStatus($$$ERROR($$$GeneralError, "Deployed package '" _ tModuleName _ "' " _ tResult.VersionString _ " not supported on this platform " _ platformVersion _ ".")) | ||
| } | ||
| } | ||
| $$$ThrowOnError(log.SetSource(tResult.ServerName)) | ||
| $$$ThrowOnError(log.SetVersion(tResult.Version)) | ||
| $$$ThrowOnError(log.SetSource(tResult.ServerName)) | ||
| $$$ThrowOnError(log.SetVersion(tResult.Version)) | ||
| $$$ThrowOnError(##class(%IPM.Utils.Module).LoadQualifiedReference(tResult, .tParams, , log)) | ||
| } | ||
| } else { | ||
| set tPrefix = "" | ||
| if (tModuleName '= "") { | ||
| if (tVersion '= "") { | ||
| $$$ThrowStatus($$$ERROR($$$GeneralError, tModuleName_" "_tVersion_" not found in any repository.")) | ||
|
|
@@ -2415,10 +2435,32 @@ ClassMethod Install( | |
| } | ||
| } | ||
| } catch ex { | ||
| $$$ThrowOnError(log.Finalize(ex.AsStatus(), devMode)) | ||
| throw ex | ||
| } | ||
| $$$ThrowOnError(log.Finalize($$$OK, devMode)) | ||
| $$$ThrowOnError(log.Finalize(ex.AsStatus(), devMode)) | ||
| throw ex | ||
| } | ||
| $$$ThrowOnError(log.Finalize($$$OK, devMode)) | ||
| } | ||
|
|
||
| ClassMethod CleanInstall(ByRef commandInfo) [ Internal ] | ||
| { | ||
| set moduleName = $get(commandInfo("parameters","module")) | ||
| set version = $get(commandInfo("parameters","version")) | ||
| set verbose = $get(commandInfo("data","Verbose")) | ||
| set log = ##class(%IPM.General.HistoryTemp).CleanInstallInit(moduleName) | ||
|
isc-jlechtne marked this conversation as resolved.
Outdated
|
||
|
|
||
| // TODO: Add "path"? (see Update() for more info of calling install v load) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is this todo being done or removed?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is being done. This was just a reminder to myself when putting up the first commit and PR for comments that I still need to account for that case. |
||
|
|
||
| if verbose { | ||
| write !, "Going to run a clean install on "_moduleName | ||
| } | ||
|
|
||
| // Indicating to commandInfo that this is a clean install command, not an install or load command. commandInfo will be passed to either Install() or Load() to continue performing the update. | ||
| set commandInfo("data","cmd") = "ci" | ||
| set commandInfo("data","CleanInstall") = 1 | ||
| set log = ##class(%IPM.General.HistoryTemp).UpdateInit(moduleName) | ||
|
|
||
| // Forward execution to install | ||
| do ..Install(.commandInfo, log) | ||
| } | ||
|
|
||
| ClassMethod Reinstall(ByRef pCommandInfo) [ Internal ] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.