Skip to content

Commit 255d17d

Browse files
committed
Major improvements
1 parent 5e1b1e0 commit 255d17d

File tree

50 files changed

+694
-1229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+694
-1229
lines changed

APLSource/Initialize.aplf

Lines changed: 0 additions & 9 deletions
This file was deleted.

APLSource/Latest/ADOC_Doc.apla

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
(
2+
'## Overview'
3+
''
4+
'`]Latest` is designed to list the latest changes.'
5+
''
6+
'`]Latest` main purpsoe it to act on opened Cider and/or opened acre projects (no argument required at all).'
7+
' '
8+
'However, it can do more than that:'
9+
''
10+
'* It can act on the workspace, meaning that you need to specify something like `#` or `⎕SE` or `#.Foo` as argument'
11+
'* It can act on a specific folder like C:\\MyProjects\\ThisProject\\APLSource'
12+
''
13+
'By default the user command reports all objects or files changed lately (read: last day with any changes).'
14+
''
15+
'This limits `]Latest` powers _within the workspace_, because scripts (classes, interfaces, scripted namespaces) '
16+
'do not own a timestamp that could be used. When acting on the file system however, this information is available.'
17+
''
18+
'Note that by providing a path as an argument you can extend the meaning of ]`Latest` beyond APL source files, in'
19+
'particular together with the `-all` flag.'
20+
''
21+
'Note that in case a path or the `all` flag was specified all files in .git/ or its sub-directories are removed'
22+
'from the result since the user will almost never be interested in them.'
23+
''
24+
'## The argument(s)'
25+
''
26+
'When an argument is specified it must be one of:'
27+
''
28+
'* An integer'
29+
' * A positive one smaller than 10000000 defines the number of objects/files to be listed.'
30+
' * A positive integer larger than 9999999 is treated as a specific date (YYYYMMDD).'
31+
' * A negative one defines the number of days with any changes.'
32+
'* A character vector; if it starts with `#` or `⎕` the argument is treated as a namespace path\\'
33+
' Otherwise it is treated as a path.'
34+
'* A vector of length two with an integer and a character vector in no particular order, see above.'
35+
''
36+
'In case no argument or only an integer is specified, `]Latest` will establish which Cider and/or acre projects are'
37+
'currently open. If it is just one it will act on it. If there are multiple projects open the user will be prompted.'
38+
''
39+
'Note that if you provide a path pointing to an acre project you should include `APLSource\\` if you are interested '
40+
'just in APL source files because that faster, and it also removes the folder APLSource/ from the result.'
41+
'For Cider projects APLSource/ is the default, but it can be overwritten. '
42+
''
43+
'If on the other hand you want to see more than just APL source file then you might want to specify the `-all` flag,'
44+
'see there for details.'
45+
''
46+
'## FLags (options)'
47+
''
48+
'`-recursive=0|1`'
49+
''
50+
': The default is 1, meaning that the path is searched recursively;'
51+
' if you don''t want this then specify a 0.'
52+
' '
53+
'`-all`'
54+
''
55+
': By default only files with extensions that are recognized as APL source files (`.aplf`, `.aplc` etc.) are'
56+
' listed. You can force `]Latest` to consider all files by specifying this flag.'
57+
' '
58+
': Also, when acting on an open Cider or an open acre project then ]Latest adds "APLSource\" to an acre'
59+
' project path (because under acre that is a convention) and the "source" folder for a Cider projects (which'
60+
' defaults to APLSource\ but that can be overwritten.'
61+
''
62+
'`-stats`'
63+
''
64+
': If this flag is specified you get a matrix with two columns, the first'
65+
' one with all unique dates and the second one with the number of objects changed '
66+
' on that day. The number of rows is defined by the number of unique dates.'
67+
''
68+
': If `-stats` is specified any integer provided as argument will be ignored.'
69+
''
70+
)

APLSource/Latest/ADOC_Doc.charlist

Lines changed: 0 additions & 59 deletions
This file was deleted.

APLSource/Latest/EndIf.aplf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EndIf

APLSource/Latest/History.apla

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
(
2+
'* 4.5.0 from 2022-05-21'
3+
' * Now compatible with Linux and Mac-OS (?!)'
4+
' * Can now handle open Cider projects'
5+
' * When the WS is empty the current dir is not questioned'
6+
' * .git is ignored now when a path or "all" is specified'
7+
' * Bug fix: for acre and Cider projects "APLSource/" should have been added to the path unless'
8+
' -all was specified because both project managers use that as default for source files.'
9+
' * The project path should have been deleted from file names for open projects with the "all"'
10+
' flag specified, but wasn''t.'
11+
'* 4.3.4 from 2021-07-25'
12+
' * Bug fix: In SelectProject APLTreeUtils2 was wrongly addressed, resulting in a VALUE ERROR'
13+
'* 4.3.3 from 2021-06-26'
14+
' * When # was passed as argument the # was missing in the output'
15+
'* 4.3.2 from 2021-09-21'
16+
' ]Latest # caused a VALUE ERROR'
17+
'* 4.3.1 from 2021-09-15'
18+
' * In case of an empty WS no VALUE ERROR is signalled but a message returned'
19+
'* 4.3.0 from 2020-09-15'
20+
' * `]Latests` now runs under Linux and Mac OS as well.'
21+
' * Message corrected when the WS is empty (for example): instead of "Not Found" it now states'
22+
' "Latest: nothing found"'
23+
'* 4.2.0 from 2020-06-06'
24+
' * Now acts on APLSource/ if no acre project is open and the folder exists in the current directory.'
25+
' * Bug fix: ]Latest n delievered, when n was a positiv integer, wrong result.'
26+
)

APLSource/Latest/History.charlist

Lines changed: 0 additions & 17 deletions
This file was deleted.

APLSource/Latest/Run.aplf

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,74 @@
1-
r←Run(path_ recursive stats all noOf);acreFlag;F;A;bool;projects;buff;pathFlag;path;projects1;promaFlag;projects2;ind;ref
1+
r←Run(path_ recursive stats all noOf);hasOpenAcreProjects;F;A;bool;projects;buff;pathFlag;path;projects1;hasOpenCiderProjects;projects2;ind;ref;name;isAcreProject;isCiderProject
22
⍝ Handles the following cases:
33
⍝ * Investigate the workspace (simple namespace or #)
44
⍝ * Investigate (currently tracked/opened) acre projects
5-
⍝ * Investigate (currently tracked/opened) ProMa projects
6-
⍝ * Investigate an acre project that is not currently tracked (not open)
7-
A←APLTreeUtils2 ⋄ F←FilesAndDirs
5+
⍝ * Investigate (currently tracked/opened) Cider projects
6+
⍝ * Investigate a folder
7+
A←##.APLTreeUtils2 ⋄ F←##.FilesAndDirs
88
r←''
9-
pathFlag←acreFlag←0
9+
pathFlag←hasOpenAcreProjects←hasOpenCiderProjects←0
1010
path←path_
11+
isAcreProject←isCiderProject←0
1112
:If 0=≢path ⍝ Only true if we deal with a project
13+
projects1←projects2←0 2⍴''
1214
:If 9=⎕SE.⎕NC'acre'
1315
projects1←⎕SE.acre.Projects ⍬
14-
acreFlag←0<≢projects1
16+
hasOpenAcreProjects←0<≢projects1
1517
:EndIf
16-
:If 0=⎕SE.⎕NC'ProMa'
17-
{}⎕SE.UCMD'ProMa.Version'
18+
:If 9=⎕SE.⎕NC'Cider'
19+
{}⎕SE.UCMD'Cider.Version'
20+
hasOpenCiderProjects←0<≢projects2←⎕SE.Cider.ListOpenProjects 0
1821
:EndIf
19-
projects2←⎕SE.ProMa.ListProjects 0
20-
:If promaFlag←0<≢projects2
21-
projects2←(⍪projects2),{⍵.PromaConfig.HOME}∘⍎¨projects2
22-
:Else
23-
projects2←0 2⍴⍬
24-
:EndIf
25-
:If 0<+/≢¨projects1,projects2
26-
projects←(projects1,1)⍪(projects2,2)
27-
:Else
22+
projects←(projects1,1)⍪(projects2,2)
23+
:If 0=≢projects
2824
path←'expand'F.NormalizePath F.PWD,F.CurrentSep ⍝ Current dir is the best we can do here
2925
pathFlag←1
3026
:EndIf
3127
:ElseIf ~(1⍴path)∊'#⎕' ⍝ True if it's a folder path
3228
path←('expand'F.NormalizePath path),F.CurrentSep
29+
('Is not a folder: ',path)⎕SIGNAL 6/⍨~F.IsDir path
3330
pathFlag←1
3431
:EndIf
3532
:If 0=≢path
36-
:AndIf 0=acreFlag
37-
path←F.PWD,F.CurrentSep
38-
pathFlag←F.IsDir path,'APLSource'
33+
:AndIf 0=hasOpenAcreProjects+hasOpenCiderProjects
34+
path←F.PWD,F.CurrentSep,'APLSource'
35+
pathFlag←F.IsDir path
3936
:EndIf
40-
:If acreFlag∨promaFlag
41-
ind←SelectProject{⍵[;0 1],('acre project' 'ProMa project')[⍵[;2]-1]}projects
42-
→(¯1=ind)/0
43-
path←1⊃projects[ind;]
44-
projects1[;1]←{'/'@(⍸'\'=⍵)⊣⍵}¨projects1[;1]
45-
projects2[;1]←{'/'@(⍸'\'=⍵)⊣⍵}¨projects2[;1]
37+
:If hasOpenAcreProjects∨hasOpenCiderProjects
38+
:If 1=≢projects
39+
name←↑projects
40+
:If 1=≢projects1
41+
path←↑projects1[;1]
42+
path←(~all){⍵.AcreConfig.ProjectFolder,⍺/'APLSource/'}⍎name ⍝ Fixed in acre
43+
isAcreProject←1
44+
:Else
45+
path←(~all){⍵.HOME,'/',⍺/⍵.CIDER.source}⍎(↑projects2),'.CiderConfig'
46+
isCiderProject←1
47+
:EndIf
48+
:Else
49+
ind←SelectProject{⍵[;0 1],('acre project' 'Cider project')[⍵[;2]-1]}projects
50+
→(¯1=ind)/0
51+
name←↑projects[ind;]
52+
isAcreProject←∨/name∘≡¨projects1[;0]
53+
isCiderProject←∨/name∘≡¨projects2[;0]
54+
:If isCiderProject
55+
path←(~all){⍵.HOME,'/',⍺/⍵.CIDER.source}⍎name,'.CiderConfig'
56+
:ElseIf isAcreProject
57+
path←(~all){⍵.AcreConfig.ProjectFolder,⍺/'APLSource/'}⍎name ⍝ Fixed in acre
58+
:EndIf
59+
:EndIf
60+
projects1[;1]←F.NormalizePath projects1[;1]
61+
projects2[;1]←F.NormalizePath projects2[;1]
4662
:EndIf
47-
:If acreFlag∨promaFlag∨pathFlag
63+
:If isAcreProject∨isCiderProject∨pathFlag
4864
path←'expand'F.NormalizePath path,F.CurrentSep
49-
:If F.IsDir path
65+
:If 0<≢#.⎕NL⍳16
66+
:AndIf F.IsDir path
5067
r←⍉⊃('recursive'recursive)('type'(0 1 3))F.Dir path
5168
r←(r[;1]=2)⌿r ⍝ Only regular files
52-
:If 0=all
69+
:If all
70+
r←(~{≢'[/\\]\.git[/\\]'⎕S 0⊣⍵}¨r[;0])⌿r
71+
:Else
5372
r←(({2⊃⎕NPARTS ⍵}¨r[;0])∊GetExtensions)⌿r
5473
:EndIf
5574
r[;2]←↓A.FormatDateTime⊃r[;2]
@@ -62,7 +81,7 @@
6281
⍝ 0 in case text was provided as argument
6382
⍝ An integer otherwise.
6483
:If ⍬≡noOf
65-
r←((10↑¨r[;1])≡¨⊂10↑1⊃r[¯1+≢r;])⌿r
84+
r←((10↑¨r[;1])≡¨⊂10↑1⊃r[¯1+≢r;])⌿r ⍝ All from the day with the latest change
6685
:ElseIf 0≢noOf
6786
:If ¯1=×noOf
6887
buff←10↑¨r[;1] ⍝ YYYY-MM-DD
@@ -83,12 +102,15 @@
83102
:Else
84103
r[;0]←(≢path)↓¨r[;0]
85104
:EndIf
105+
:ElseIf all
106+
r[;0]←(≢path){∧/~'/\'∊⍵:⍵ ⋄ ⍺↓⍵}¨r[;0]
86107
:Else
87-
:If (⊂{'/'@(⍸'\'=⍵)⊣⍵}path)∊AddSlash projects1[;1]
108+
:If ∨/name∘≡¨projects1[;0]
88109
r[;0]←⎕SE.acre.Itemname r[;0]
89-
:ElseIf (⊂{'/'@(⍸'\'=⍵)⊣⍵}path)∊AddSlash projects2[;1]
90-
r[;0]←⎕SE.Link.GetItemName{'/'@(⍸'\'=⍵)⊣⍵}¨r[;0]
110+
:ElseIf ∨/name∘≡¨projects2[;0]
111+
r[;0]←⎕SE.Link.GetItemName¨F.EnforceSlash¨r[;0]
91112
:EndIf
113+
r←(0<≢¨r[;0])⌿r
92114
:EndIf
93115
:EndIf
94116
:EndIf

APLSource/Latest/Version.aplf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
r←Version
22
⍝ See also `History`
3-
r←'Latest' '4.5.0-beta-1+97' '2021-07-30'
3+
r←'Latest' '4.5.0+127' '2022-05-22'

0 commit comments

Comments
 (0)