-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API functions CreateProject and CreateCreateProjectParms added
- Loading branch information
Showing
46 changed files
with
241 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CreateCreateProjectParms←{⍺←⊢ ⋄ ⍺ ##.CreateCreateProjectParms ⍵} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CreateProject←{1:shy←##.CreateProject ⍵} |
2 changes: 1 addition & 1 deletion
2
APLSource/Cider/UC/configFilename.aplf → APLSource/Cider/ConfigFilename.aplf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
r←configFilename | ||
r←ConfigFilename | ||
r←'cider.config' |
18 changes: 9 additions & 9 deletions
18
APLSource/Cider/UC/CreateConfigFile.aplf → APLSource/Cider/CreateConfigFile.aplf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
{name}←CreateConfigFile(filename name);config;globalCiderConfigFilename;tatinVars | ||
{name}←CreateConfigFile(filename name);config;globalCiderConfigFilename;tatinVars | ||
⍝ Copies the config template file over and injects the last part of the path of "filename" as "projectSpace" | ||
('The folder already hosts a file "',configFilename,'"')Assert~⎕NEXISTS filename | ||
globalCiderConfigFilename←P.GetCiderGlobalConfigHomeFolder,'cider.config.template' | ||
tatinVars←P.##.TatinVars | ||
('The folder already hosts a file "',ConfigFilename,'"')Assert~⎕NEXISTS filename | ||
globalCiderConfigFilename←GetCiderGlobalConfigHomeFolder,'cider.config.template' | ||
tatinVars←##.TatinVars | ||
:If 0=⎕NEXISTS globalCiderConfigFilename | ||
⍝ First attempt | ||
globalCiderConfigFilename(⎕NCOPY P.##.F.ExecNfunction)tatinVars.HOME,'/cider.config.template' | ||
globalCiderConfigFilename(⎕NCOPY F.ExecNfunction)tatinVars.HOME,'/cider.config.template' | ||
:ElseIf ≢/{⊃⎕NGET ⍵}¨globalCiderConfigFilename(tatinVars.HOME,'/cider.config.template') | ||
⍝ Replace by the template if changed | ||
globalCiderConfigFilename(⎕NCOPY⍠('IfExists' 'Replace')P.##.F.ExecNfunction)tatinVars.HOME,'/cider.config.template' | ||
globalCiderConfigFilename(⎕NCOPY⍠('IfExists' 'Replace')F.ExecNfunction)tatinVars.HOME,'/cider.config.template' | ||
:EndIf | ||
config←⎕JSON⍠('Dialect' 'JSON5')⊣⊃P.##.F.NGET globalCiderConfigFilename | ||
config←⎕JSON⍠('Dialect' 'JSON5')⊣⊃F.NGET globalCiderConfigFilename | ||
:If 0=⎕SE.Link.⎕NC'Version' ⍝ There was no such function prior to Link 3 | ||
:OrIf 3=⌊⊃⊃(//)⎕VFI{⍵/⍨2>+\⍵='.'}⎕SE.Link.Version ⍝ Version 3.x? | ||
config.LINK.watch←(1+P.HasDotNet)⊃'ns' 'both' | ||
config.LINK.watch←(1+HasDotNet)⊃'ns' 'both' | ||
:EndIf | ||
:If (⊃name)∊'#⎕' | ||
name←{⍵↓⍨⍵⍳'.'}name | ||
:EndIf | ||
((~name∊⎕D,⎕A,'_∆⍙',⎕C ⎕A)/name)←'_' | ||
config.CIDER.projectSpace←⍕name | ||
config P.##.Put_JSON5 filename | ||
config Put_JSON5 filename | ||
⍝Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
parms←{parms_}CreateCreateProjectParms folder;list;b;l | ||
⍝ Creates a namespace with all parameters one might pass to `CreateProject`.\\ | ||
⍝ `folder` must point to the folder hosting the project to be created. | ||
⍝ `parms_`, if specified, must be a namespace with some such parameters. | ||
⍝ Parameters passed this way take precedence. | ||
parms_←{0<⎕NC ⍵:⍎⍵ ⋄ ⍬}'parms_' | ||
parms←(1⊃1↓⎕RSI,⎕THIS).⎕NS'' ⍝ Create namespace where we got called from | ||
parms.folder←folder | ||
parms.acceptConfig←0 | ||
parms.ignoreUserExec←0 | ||
parms.namespace←'' | ||
:If ~(⊂parms_)∊''⍬ | ||
'⍺ must not contain references'Assert 0=≢parms_.⎕NL 9 | ||
(b{0=+/b:'' ⋄ 'Invalid parameter: ',⊃{⍺,',',⍵}/⍺/⍵}l)Assert 0=+/b←~(l←' '~⍨¨↓parms_.⎕NL 2)∊' '~⍨¨↓parms.⎕NL 2 | ||
:If 0<≢list←' '~⍨¨↓parms_.⎕NL 2 | ||
parms⍎¨list{' '=1↑0⍴⍵:⍺,'←''',⍵,'''' ⋄ ⍵≡⍬:⍺,'←⍬' ⋄ ⍺,'←',⍕⍵}¨parms_.{⍎⍵}¨list | ||
:EndIf | ||
:EndIf | ||
'Must not be empty: "folder"'Assert 0<≢parms.folder | ||
('Is not a folder: ',parms.folder)Assert F.IsDir parms.folder | ||
⍝Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{r}←CreateProject parms;filename;config;projectFolder;list | ||
⍝ Create a project according to what's specified in parms. | ||
⍝ Returns always ''. Throws errors in case the project cannot be created | ||
parms←parms CreateCreateProjectParms ⍬ | ||
r←'' | ||
filename←(AddSlash parms.folder),'cider.config' | ||
:If 0=≢parms.namespace | ||
parms.namespace←{{⍵↑⍨1+-⌊/(⌽⍵)⍳'/\'}¯1↓⍵}1⊃1 ⎕NPARTS filename | ||
:EndIf | ||
:If ~(⊂,1 ⎕C parms.namespace)∊,¨'#' '⎕SE' | ||
('Not a valid APL name: <',parms.namespace,'>')Assert ¯1≠⎕NC parms.namespace | ||
:EndIf | ||
:If ~⎕NEXISTS parms.folder | ||
'Invalid folder: parent must exist'Assert{0=≢⍵:1 ⋄ ⎕NEXISTS ⍵}1⊃⎕NPARTS{⍵↓⍨-(¯1↑⍵)∊'/\'}parms.folder ⍝ Parent folder must exist | ||
parms.folder←∊1 ⎕NPARTS parms.folder | ||
⎕MKDIR parms.folder | ||
:EndIf | ||
CreateConfigFile filename parms.namespace | ||
config←⎕JSON⍠('Dialect' 'JSON5')⊣⊃⎕NGET filename | ||
('Invalid config file: ',filename)Assert 0 PerformConfigChecks config | ||
⍝Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
r←Version | ||
⍝ See also `History` | ||
r←'0.41.0-beta-3+671' | ||
r←'0.41.0-beta-4+671' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{r}←config WriteProjectConfigFile path;path2 | ||
⍝ Writes project configuration "config" to file.\\ | ||
⍝ `path` may or may not carry the filename as such. | ||
path2←'cider.config'{⍺≡(-≢⍺)↑⍵:⍵ ⋄ ({⍵,'/'/⍨~(¯1↑⍵)∊'/\'}⍵),⍺}path | ||
path2←ConfigFilename{⍺≡(-≢⍺)↑⍵:⍵ ⋄ ({⍵,'/'/⍨~(¯1↑⍵)∊'/\'}⍵),⍺}path | ||
r←config Put_JSON5 path2 | ||
⍝Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
R←Test_Create_500(stopFlag batchFlag);⎕TRAP;tempDir;parms;rc;parms2;res | ||
⍝ Create a new project via the API | ||
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N') | ||
R←T._Failed | ||
|
||
tempDir←∆GetFolderInTempDir⊃⎕SI | ||
3 ⎕MKDIR tempDir,'/APLSource' | ||
(⊂'r←TheAnswerIs' 'r←42')⎕NPUT(tempDir,'/APLSource/TheAnswerIs.aplf')1 | ||
|
||
parms←##.Cider.CreateCreateProjectParms tempDir | ||
##.Cider.CreateProject parms | ||
|
||
#.⎕EX'Foo' ⋄ #.⎕SHADOW'Foo' | ||
parms2←##.Cider.CreateOpenParms ⍬ | ||
parms2.folder←parms.folder | ||
parms2.batch←1 | ||
parms2.ignoreUserExec←1 | ||
parms2.parent←'#' | ||
parms2.projectSpace←'Foo' | ||
res←##.Cider.OpenProject parms2 | ||
→T.GoToTidyUp~∨/'Project successfully opened and established in "#.Foo"'⍷∊res | ||
|
||
R←T._OK | ||
|
||
∆TidyUp: | ||
Assert 0 ##.Cider.CloseProject'#.Foo' | ||
rc←⊃FilesAndDirs.RmDir tempDir,'/..' | ||
Assert rc∧.=0 | ||
⍝Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.