diff --git a/APLSource/.linkconfig b/APLSource/.linkconfig index 288399a9..d07045b4 100644 --- a/APLSource/.linkconfig +++ b/APLSource/.linkconfig @@ -1,10 +1 @@ - -{ - LinkVersion: { ID: "4.0.20"}, - - Settings: { - fastLoad: 1, - forceFilenames: 1, - watch: "both", - }, -} +{ LinkVersion: { ID: "4.0.20"}, Settings: { fastLoad: 1, forceFilenames: 1, watch: "both", }, } diff --git a/APLSource/Cider/AddTatinDependencies.aplf b/APLSource/Cider/AddTatinDependencies.aplf index 475adf31..49b31037 100644 --- a/APLSource/Cider/AddTatinDependencies.aplf +++ b/APLSource/Cider/AddTatinDependencies.aplf @@ -4,6 +4,9 @@ :If 1<≡packageIDs packageIDs←⊃1↓,/',',¨packageIDs :EndIf + :If ∧/'[]'∊projectFolder + projectFolder←GetFolderFromAlias2 projectFolder + :EndIf cfg←ReadProjectConfigFile projectFolder :If dev ref←cfg.CIDER.dependencies_dev diff --git a/APLSource/Cider/UC/AddTatinDependencies.aplf b/APLSource/Cider/UC/AddTatinDependencies.aplf index 85c4b471..57368105 100644 --- a/APLSource/Cider/UC/AddTatinDependencies.aplf +++ b/APLSource/Cider/UC/AddTatinDependencies.aplf @@ -5,7 +5,7 @@ development←0 Args.Switch'development' targetNamespace←''Args.Switch'target' :If IsAlias projectFolder - projectFolder←P.GetFolderFromAlias projectFolder + projectFolder←P.##.GetFolderFromAlias2 projectFolder :Else projectFolder←'GetProjectPathForAddingTatinPkgs@Which project would you like to add Tatin packages to?'GetProjectPath projectFolder :EndIf diff --git a/APLSource/TestCases/Test_AddTatinDep_001.aplf b/APLSource/TestCases/Test_AddTatinDep_001.aplf index a8bb9566..4a881086 100644 --- a/APLSource/TestCases/Test_AddTatinDep_001.aplf +++ b/APLSource/TestCases/Test_AddTatinDep_001.aplf @@ -1,5 +1,5 @@ R←Test_AddTatinDep_001(stopFlag batchFlag);⎕TRAP;folder;tempDir;parms;log;res;list;success;configfile;config -⍝ Exercise AddTatinDependencies +⍝ Exercise AddTatinDependencies in its most simple form: single package from https://tatin.dev ⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N') R←T._Failed @@ -23,8 +23,8 @@ →T.GoToTidyUp~success →T.GoToTidyUp∨/'ERROR'⍷log - list←##.Cider.AddTatinDependencies'[tatin]APLTreeUtils2,[tatin]FilesAndDirs'tempDir 0 - →T.GoToTidyUp 2≠≢list + list←##.Cider.AddTatinDependencies'https://tatin.dev/APLTreeUtils2'tempDir 0 + →T.GoToTidyUp 1≠≢list res←(~parms.batch)##.Cider.CloseProject tempDir →T.GoToTidyUp res≠1 @@ -35,7 +35,6 @@ →T.GoToTidyUp∨/'ERROR'⍷log {}#.TEMP.APLTreeUtils2.GetOperatingSystem ⍬ - {}#.TEMP.FilesAndDirs.PWD res←(~parms.batch)##.Cider.CloseProject tempDir →T.GoToTidyUp res≠1 diff --git a/APLSource/TestCases/Test_AddTatinDep_002.aplf b/APLSource/TestCases/Test_AddTatinDep_002.aplf new file mode 100644 index 00000000..d568bb2b --- /dev/null +++ b/APLSource/TestCases/Test_AddTatinDep_002.aplf @@ -0,0 +1,49 @@ + R←Test_AddTatinDep_002(stopFlag batchFlag);⎕TRAP;folder;tempDir;parms;log;res;list;success;configfile;config +⍝ Exercise AddTatinDependencies with alias names: two packages, both with a registry alias + ⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N') + R←T._Failed + + #.⎕SHADOW'TEMP' ⋄ 'TEMP'#.⎕NS'' + folder←∆GetTestPath⊃⎕SI + tempDir←∆GetFolderInTempDir⊃⎕SI + tempDir ⎕NCOPY⍠1⊢folder,'/*' + + configfile←tempDir,'/cider.config' + config←##.Cider.Get_JSON5 configfile + config.CIDER.dependencies.tatin←'tatin-packages' + config ##.Cider.Put_JSON5 configfile + + ##.Cider.C.YesOrNo_Answers←1 2⍴'ChangeCurrentDir@' 'n' + parms←##.Cider.CreateOpenParms'' + parms.folder←tempDir + parms.batch←1 + parms.ignoreUserExec←1 + + (success log)←##.Cider.OpenProject parms + →T.GoToTidyUp~success + →T.GoToTidyUp∨/'ERROR'⍷log + + list←##.Cider.AddTatinDependencies'[tatin]APLTreeUtils2,[tatin]FilesAndDirs'tempDir 0 + →T.GoToTidyUp 2≠≢list + + res←(~parms.batch)##.Cider.CloseProject tempDir + →T.GoToTidyUp res≠1 + + #.TEMP.(⎕EX ⎕NL-⍳9) + (success log)←##.Cider.OpenProject parms + →T.GoToTidyUp~success + →T.GoToTidyUp∨/'ERROR'⍷log + + {}#.TEMP.APLTreeUtils2.GetOperatingSystem ⍬ + {}#.TEMP.FilesAndDirs.PWD + + res←(~parms.batch)##.Cider.CloseProject tempDir + →T.GoToTidyUp res≠1 + + R←T._OK + +∆TidyUp: + ##.Cider.C.Cleanup + {}∆LINK'Break' '#.TEMP' + FilesAndDirs.RmDir tempDir,'/..' +⍝Done diff --git a/APLSource/TestCases/Test_AddTatinDep_003.aplf b/APLSource/TestCases/Test_AddTatinDep_003.aplf new file mode 100644 index 00000000..aab0e2af --- /dev/null +++ b/APLSource/TestCases/Test_AddTatinDep_003.aplf @@ -0,0 +1,52 @@ + R←Test_AddTatinDep_003(stopFlag batchFlag);⎕TRAP;folder;tempDir;parms;log;res;list;success;configfile;config;alias +⍝ Exercise AddTatinDependencies and add a package + ⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N') + R←T._Failed + + #.⎕SHADOW'TEMP' ⋄ 'TEMP'#.⎕NS'' + folder←∆GetTestPath⊃⎕SI + tempDir←∆GetFolderInTempDir⊃⎕SI + tempDir ⎕NCOPY⍠1⊢folder,'/*' + alias←'MyAliias_',⊃⎕SI + res←⎕SE.Cider.AddAlias tempDir alias + Assert 0=≢res + + configfile←tempDir,'/cider.config' + config←##.Cider.Get_JSON5 configfile + config.CIDER.dependencies.tatin←'tatin-packages' + config ##.Cider.Put_JSON5 configfile + + ##.Cider.C.YesOrNo_Answers←1 2⍴'ChangeCurrentDir@' 'n' + parms←##.Cider.CreateOpenParms'' + parms.folder←tempDir + parms.batch←1 + parms.ignoreUserExec←1 + + (success log)←##.Cider.OpenProject parms + →T.GoToTidyUp~success + →T.GoToTidyUp∨/'ERROR'⍷log + + list←##.Cider.AddTatinDependencies'https://tatin.dev/APLTreeUtils2'('[',alias,']')0 + →T.GoToTidyUp 1≠≢list + + res←(~parms.batch)##.Cider.CloseProject tempDir + →T.GoToTidyUp res≠1 + + #.TEMP.(⎕EX ⎕NL-⍳9) + (success log)←##.Cider.OpenProject parms + →T.GoToTidyUp~success + →T.GoToTidyUp∨/'ERROR'⍷log + + {}#.TEMP.APLTreeUtils2.GetOperatingSystem ⍬ + + res←(~parms.batch)##.Cider.CloseProject tempDir + →T.GoToTidyUp res≠1 + + R←T._OK + +∆TidyUp: + ##.Cider.C.Cleanup + {}∆LINK'Break' '#.TEMP' + FilesAndDirs.RmDir tempDir,'/..' + ⎕SE.Cider.DropAlias alias +⍝Done diff --git a/APLSource/TestCases/Test_UC_047.aplf b/APLSource/TestCases/Test_UC_047.aplf index 9286b8a2..15415705 100644 --- a/APLSource/TestCases/Test_UC_047.aplf +++ b/APLSource/TestCases/Test_UC_047.aplf @@ -1,5 +1,5 @@ - R←Test_UC_047(stopFlag batchFlag);⎕TRAP;res;msg;rc;folder;parms;tempDir;success;log;stop;expected -⍝ Exercise ]Cider.AddTatinDependencies without loading + R←Test_UC_047(stopFlag batchFlag);⎕TRAP;res;msg;rc;folder;parms;tempDir;success;log;stop;expected;alias +⍝ Exercise ]Cider.AddTatinDependencies without loading; uses a projet alias ⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N') R←T._Failed @@ -11,6 +11,9 @@ folder←∆GetTestPath⊃⎕SI tempDir←∆GetFolderInTempDir⊃⎕SI tempDir ⎕NCOPY⍠1⊢folder,'/*' + alias←'MyAliias_',⊃⎕SI + res←⎕SE.Cider.AddAlias tempDir alias + Assert 0=≢res parms←##.Cider.CreateOpenParms'' parms.folder←∊⎕NPARTS tempDir @@ -26,7 +29,7 @@ stop←0 ##.Cider.C.AddAutomation'YesOrNo' 'AddTatinDeps@' 'y' ##.Cider.C.AddAutomation'YesOrNo' 'LoadTatinDependenciesAfterAdding@' 'n' - (rc msg res)←stop ∆UCMD'AddTatinDependencies FilesAndDirs,APLTreeUtils2 "',tempDir,'"' + (rc msg res)←stop ∆UCMD'AddTatinDependencies FilesAndDirs,APLTreeUtils2 [',alias,']' →T.GoToTidyUp rc≠0 →T.GoToTidyUp 0≠≢msg expected←'2 Tatin dependencies added:' 'aplteam-FilesAndDirs-' 'aplteam-APLTreeUtils2-' @@ -38,4 +41,5 @@ ##.Cider.C.Cleanup {}∆LINK'Break' '#.TEMP' FilesAndDirs.RmDir tempDir,'/..' + ⎕SE.Cider.DropAlias alias ⍝Done diff --git a/Tests/Test_AddTatinDep_002/APLSource/Hello.aplf b/Tests/Test_AddTatinDep_002/APLSource/Hello.aplf new file mode 100644 index 00000000..76d2bbb1 --- /dev/null +++ b/Tests/Test_AddTatinDep_002/APLSource/Hello.aplf @@ -0,0 +1,2 @@ + r←Hello + r←'World' diff --git a/Tests/Test_AddTatinDep_002/cider.config b/Tests/Test_AddTatinDep_002/cider.config new file mode 100644 index 00000000..25094539 --- /dev/null +++ b/Tests/Test_AddTatinDep_002/cider.config @@ -0,0 +1,27 @@ +{ + CIDER: { + dependencies: { + tatin: "", + }, + dependencies_dev: { + tatin: "", + }, + distributionFolder: "", + init: "", + make: "", + parent: "#", + projectSpace: "TEMP", + project_url: "", + source: "APLSource", + tests: "", + }, + LINK: { + watch: "ns", + }, + SYSVARS: { + io: 1, + ml: 1, + }, + USER: { + }, +} diff --git a/Tests/Test_AddTatinDep_003/APLSource/Hello.aplf b/Tests/Test_AddTatinDep_003/APLSource/Hello.aplf new file mode 100644 index 00000000..76d2bbb1 --- /dev/null +++ b/Tests/Test_AddTatinDep_003/APLSource/Hello.aplf @@ -0,0 +1,2 @@ + r←Hello + r←'World' diff --git a/Tests/Test_AddTatinDep_003/cider.config b/Tests/Test_AddTatinDep_003/cider.config new file mode 100644 index 00000000..25094539 --- /dev/null +++ b/Tests/Test_AddTatinDep_003/cider.config @@ -0,0 +1,27 @@ +{ + CIDER: { + dependencies: { + tatin: "", + }, + dependencies_dev: { + tatin: "", + }, + distributionFolder: "", + init: "", + make: "", + parent: "#", + projectSpace: "TEMP", + project_url: "", + source: "APLSource", + tests: "", + }, + LINK: { + watch: "ns", + }, + SYSVARS: { + io: 1, + ml: 1, + }, + USER: { + }, +}