Skip to content

Commit

Permalink
Global CheckForDropboxConflicts & ]CloseProject -fast added
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed Mar 22, 2024
1 parent 8ecfe78 commit 17ec6ee
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 39 deletions.
25 changes: 15 additions & 10 deletions APLSource/Cider/CheckForTatinPackages.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
statuspath CheckForTatinPackages config;folders;list;bool;report;this;parms
statusparms CheckForTatinPackages config;folders;list;bool;report;this;parms;parms2
Checks whether at least one Tatin install folder is defined, does exist and is not empty, in which case a 1 is returned.
In case at least one install folder contains just a dependency file and a build file but nothing else then...
* when the user goes for re-installing the packages, a 2 is returned
Expand All @@ -8,17 +8,22 @@
:If 0<folders
folders{'=':¯1+'=' }¨folders
:AndIf 0<folders(0<¨folders)/folders
:AndIf 0<folders(F.Exists(path,'/'),¨folders)/folders
status0<+/¨list{0 ⎕NINFO('Wildcard' 1)}¨(path,'/'),¨folders,¨'/*'
:AndIf 1bool0=¨F.ListDirs¨(path,'/'),¨folders,¨'/'
:AndIf 1boolbool⎕NEXISTS(path,'/'),¨folders,¨'/apl-dependencies.txt'
:If C.YesOrNo'Tatin install folder',((1+1=+/bool)'s do' ' does'),' not contain packages - do you want them re-installed?'
:AndIf 0<folders(F.Exists(parms.folder,'/'),¨folders)/folders
status0<+/¨list{0 ⎕NINFO('Wildcard' 1)}¨(parms.folder,'/'),¨folders,¨'/*'
:AndIf 1bool0=¨F.ListDirs¨(parms.folder,'/'),¨folders,¨'/'
:AndIf 1boolbool⎕NEXISTS(parms.folder,'/'),¨folders,¨'/apl-dependencies.txt'
:If parms.batch
:OrIf C.YesOrNo'Tatin install folder',((1+1=+/bool)'s do' ' does'),' not contain packages - do you want them re-installed?'
status2
parms⎕SE.Tatin.CreateReInstallParms
parms.updateC.YesOrNo'Would you like to install later versions, if available?'
parms2⎕SE.Tatin.CreateReInstallParms
:If parms.batch
parms2.quiet1
:Else
parms2.updateC.YesOrNo'Would you like to install later versions, if available?'
:EndIf
foldersbool/folders
:For this :In (path,'/'),¨folders
reportparms ⎕SE.Tatin.ReInstallDependencies this
:For this :In (parms.folder,'/'),¨folders
reportparms2 ⎕SE.Tatin.ReInstallDependencies this
:EndFor
:Else
status3
Expand Down
22 changes: 19 additions & 3 deletions APLSource/Cider/CloseProject.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
r{list}CloseProject projects;list;project;ind;res
r{x}CloseProject projects;list;project;ind;res;list;checks
Simply breaks the Link between a project and its folder on disk.
In case ⍵ is empty ALL projects are closed.
`projects` may be one of:
Expand All @@ -7,9 +7,23 @@
3. One or more alias names like `[my-alias]`
4. One or more paths of currently open projects
5. A mixture of 2, 3 and 4
`x` can be a Boolean that defaults to 1, meaning "perform checks, if any"; see "CheckForDropboxConflicts"
A 0 would therefore prevent checks from being performed.
Returns the number of projects closed.
r0
list{0=⎕NC :ListOpenProjects 1 }'list'
checks1
:If 0=⎕NC'x'
listListOpenProjects 1
:Else
:If 3=|x
(list checks){[{' '=10}¨]}x
:ElseIf ' '=10x
listx
:Else
checksx
listListOpenProjects 1
:EndIf
:EndIf
:If 0<list
:If 0=projects
res{⎕SE.Link.Break }¨list
Expand All @@ -31,6 +45,8 @@
r+'Unlinked: '{()}res
:EndIf
:EndFor
{}CheckForDropboxConflicts¨list[;2]
:If checks
{}CheckForDropboxConflicts¨list[;2]
:EndIf
:EndIf
:EndIf
5 changes: 4 additions & 1 deletion APLSource/Cider/History.apla
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
(
'* 0.40.0 ⋄ 2024-03-21'
'* 0.40.0 ⋄ 2024-03-22'
' * New global parameter `CheckForDropboxConflicts` introduced. '
' * The user command interface has been slimmed: the "business logic" has been removed from the script and'
' been transformed into an ordinary namespace saved in `APLSource/`.'
' * The communication between Cider and the user in case Cider is opening itself has been improved.'
' This includes changes to the documentation.'
' * `CloseProject` has no a flag `fast` that closes projects without performing any checks (like `CheckForDropboxConflicts`)'
' * Bug fixes '
' * `LoadNuGetDependencies` used a now invalid syntax for specifying a namespace'
' * With noLoadPkgs←0 and batch←1 Cider interrogated the user in case Tatin packages were missing. It'
' now silently re-installs them.'
' * User command `]UpdateCider` now tells the user that the WS had not been updated '
' * Outdated comments in `GetProgramFilesFolder` fixed.'
' * ]CloseProject did not honour the -all flag'
Expand Down
6 changes: 3 additions & 3 deletions APLSource/Cider/OpenProject.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(successFlag ∆LOG)OpenProject y;parms;configFilename;config;bool;res;linkOptions;source;p;dmx;projectSpace_;parms;fn;qdmx;pkgStatus;buff;nugetFolder;msg
(successFlag ∆LOG)OpenProject y;parms;configFilename;config;bool;res;linkOptions;source;p;dmx;projectSpace_;parms;fn;qdmx;pkgStatus;buff;nugetFolder;msg
Open a Cider project.\\
`y` must be one of:
* a namespace holding all required parameters. Such a namespace can be created by calling `CreateOpenParms`
Expand Down Expand Up @@ -87,7 +87,7 @@
(1 parms.batch)p ReportLinkSettings config
:EndIf
:If 0=parms.noPkgLoad
pkgStatusparms.folder CheckForTatinPackages config
pkgStatusparms CheckForTatinPackages config
:If 0<pkgStatus
:If 0=parms.importFlag
:Trap 0
Expand Down Expand Up @@ -143,6 +143,6 @@
parms CheckOnToDo projectSpace_
successFlagSUCCESS
{}CheckForGit(~parms.batch)parms.folder config parms
{}CheckForDropboxConflicts(~parms.batch)parms.folder config parms
{}CheckForDropboxConflicts(~parms.batch)parms.folder
p'Project successfully ',((1+parms.importFlag)'loaded' 'imported'),' and established in "',parms.parent,,{(,'#'),:'"' '.',,'"'}parms.projectSpace
Done
9 changes: 5 additions & 4 deletions APLSource/Cider/UC/CloseProject.aplf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
rCloseProject Args;list;bool;row;invalid;noop;report;projectID;buff;ind;noOf
rCloseProject Args;list;bool;row;invalid;noop;report;projectID;ind;noOf;fast
r''
report1
fastArgs.Switch'fast'
:If 0=Args.Arguments
:If 0=nooplistP.ListOpenProjects 0 noop ←→ NoOf Open Projects
'There are no open Cider projects that could be closed'
Expand All @@ -11,13 +12,13 @@
r1,/(⎕UCS 13),¨list[;1]
:ElseIf 1=noop
:If 1 YesOrNo'Sure you want to close the project <',(list[1;]),'>?'
rbuffP.CloseProject
rfast P.CloseProject
:Else
r'Cancelled by user' 0
:EndIf
:Else
:If 0<ind'Select Cider project(s) to be closed' 1 Select list[;1]
r+/P.CloseProject list[ind;1]
r+/(~fast)P.CloseProject list[ind;1]
'Something went wrong'Assert r=ind
r1(⎕UCS 13),¨⎕FMT list[ind;]
:EndIf
Expand All @@ -39,7 +40,7 @@
:If 1invalid
('Not an open Cider project: ',{,',',}/invalid/projectID)Assert/~invalid
:EndIf
r+/listP.CloseProject¨projectID
r+/((~fast)list)P.CloseProject¨projectID
:EndIf
:If 0<r
:If ' '=10r
Expand Down
9 changes: 6 additions & 3 deletions APLSource/Cider/UC/Help.aplf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rlevel Help Cmd;ref;⎕TRAP
rlevel Help Cmd;ref;⎕TRAP
r''
:Select level
:Case 0
Expand Down Expand Up @@ -29,7 +29,7 @@
r,']Cider.CreateProject <folder> [<project-namespace>] -alias= -acceptConfig -noEdit -batch -ignoreUserExec'
:Case ⎕C'CloseProject'
r,'Break the Link between one or more project spaces and their associated files on disk'
r,']Cider.CloseProject [<namespace-name>|alias-name] -all'
r,']Cider.CloseProject [<namespace-name>|alias-name] -all -fast'
:Case ⎕C'Help'
r,'Put the HTML help files on display'
r,']Cider.Help'
Expand Down Expand Up @@ -218,8 +218,11 @@
r,''
r,'Multiple projects must be separated by spaces or by commas.'
r,''
r,' * In case a particular project was specified a Boolean is reported, 1 indicating success'
r,' * In case a particular project was specified, a Boolean is reported, 1 indicating success'
r,' * Otherwise the closed projects are reported in detail'
r,''
r,'-fast Use this to tell CloseProject that is should not perform any checks, see global Cider'
r,' config parameter `CheckForDropboxConflicts`.'
:Case ⎕C'ProjectConfig'
r,'Puts the config file of a project on display.'
r,'By specifying the -edit flag the user might edit the file rather then just viewing it.'
Expand Down
2 changes: 1 addition & 1 deletion APLSource/Cider/UC/List.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
c.Name'CloseProject'
c.Desc'Breaks the Link between the workspace and the files on disk'
c.Group'Cider'
c.Parse'-all'
c.Parse'-all -fast'
r,c

c⎕NS''
Expand Down
2 changes: 1 addition & 1 deletion APLSource/Cider/Version.aplf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rVersion
See also `History`
r'0.40.0-beta-8+671'
r'0.40.0-beta-10+671'
2 changes: 1 addition & 1 deletion Tests/Test_Open_008/packages/apl-dependencies.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aplteam-Tester2-3.1.3
aplteam-APLTreeUtils2-1.1.1
2 changes: 1 addition & 1 deletion apl-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
tags: "project-management",
tatin_version: "0.103.0",
userCommandScript: "APLSource/Cider_UC.dyalog",
version: "0.40.0+692",
version: "0.40.0+693",
}
30 changes: 26 additions & 4 deletions docs/Cider-API-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Requires three arguments:
## CloseProject

```
r←{list} CloseProject projects
r←{x} CloseProject projects
```

Takes one ore more projects and closes them (read: break the link).
Expand All @@ -83,9 +83,19 @@ The right argument must be either a simple character vector or a nested vector o

The projects can be specified as fully qualified namespace names, as aliase or as project paths, or a mixture of them.

The optional left argument is relevant only for test cases.
Via the optional left argument the user can specify two arguments:

Returns the number of projects closed.
* A list of projects as returned by `ListProjects`.

Usually the user won't specify such a list, but the user command may.

* A flag `checks` that defaults to 1, meaning that potentially checks are performed. See `CheckForDropboxConflicts` for an example.

You may suppress such checks by passing a 0 as left argument.

You may specify any of them or both, in any order.

Returns the number of projects closed as result.

## CreateOpenParms

Expand Down Expand Up @@ -351,14 +361,25 @@ The function returns a two-element vector:
This must be one of:

* A path pointing to a folder that carries a file `cider.config`
* An alias like `[aliasname]`
* An alias like `[aliasname]`; see also `alias`

Note that this must _not_ be empty but it _might_ be `./` representing the current directory.

### alias

The alias under which you might want to access the project in the future.

Special syntax: if `alias` is just a `.` (dot), then the last part of the path becomes the alias. Example:

```
p←Cider.CreateOpenParms
p.folder←'/path/2/projects/foo'
p.alias←'.'
⍝ `foo` becomes the (new) alias
```

If you specify an alias on `folder` but also on `alias`, then Cider expects the alias on `folder` to be defined, and will use that one to open the project. It will then overwrite the former alias with the one defined on `alias`.

### checkPackageVersions

This is ignored in case...
Expand Down Expand Up @@ -499,3 +520,4 @@ This can be just `1.2.3`, but it may be something like `1.2.3-beta-1+113`




Loading

0 comments on commit 17ec6ee

Please sign in to comment.