Skip to content

Commit

Permalink
:Include APLTreeUtils fixed plus Documentation corrected (link) and p…
Browse files Browse the repository at this point in the history
…olished
  • Loading branch information
aplteam committed Feb 16, 2019
1 parent d5191b5 commit b21f657
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 38 deletions.
40 changes: 15 additions & 25 deletions APLSource/Execute-1.aplc
Original file line number Diff line number Diff line change
@@ -1,56 +1,46 @@
:Class Execute
:Class Execute
This class allows you two different things:
* Start a process and catch its return code.
* Start an application and catch its standard output.
* Start an application and catch its standard output.\\
The two goals are quite different and therefore handled by two
different methods: `Process` and `Application`.
different methods: `Process` and `Application`.\\
You would use `Application` in order to start...
* another instance of Dyalog from Dyalog.
* a console application from within Dyalog.
* any EXE from Dyalog.
* a batch script from Dyalog.
When you need the actual output then you would use `Process`. Examples are:
* a batch script from Dyalog.\\
When you need the actual output then you would use `Process`. Examples are:\
* Get a list with a SubVersion command.
* Get a directory listing with the console DIR command.
* Get a directory listing with the console DIR command.\\
Note that if you specify `/` as a delimiter at the beginning then `Execute`
enforces `\` characters for you. Example:
enforces `\` characters for you. Example:\\
~~~
#.Execute.Process'"C:/My Scripts/foo.bat" ⍝ this will work
~~~
If however a parameter passed later on happens to be a directory name then
it is up to you to specify `\` rather than `/` as separator. Example:
~~~
#.Execute.Process'CMD' 'dir C:/' 'Exit 199' ⍝ this won't work
~~~
Thanks to Peter Michael Hager (<mailto:Hager@Dortmund.net>) without whom
this class would hardly exist.
Author: Kai Jaeger ⋄ APL Team Ltd
Home page: <http://aplwiki.com/Execute>
this class would hardly exist.\\
Author: Kai Jaeger ⋄ APL Team Ltd\\
Home page: <https://github.com/aplteam/Execute>

:Include ##.APLTreeUtils
:Include APLTreeUtils

okayfalsenull0 true1

rVersion
:Access Public shared
r(Last⎕THIS)'1.9.0.2' '2018-02-19'
r(Last⎕THIS)'1.9.1.3' '2019-02-04'

History
:Access Public Shared
* 1.9.0
* First version after conversion from the APL wiki to GitHub.
* 1.9.1
* Bug fix: `:Include ##.APLTreeUtils` is now ':Include APLTreeUtils`.
* Documentation corrected (home page link) and polished.
\\
For information regarding older versions see <https://github.com/aplteam/Execute/releases>
Expand Down
15 changes: 5 additions & 10 deletions APLSource/TestCases-11/Test_ZZZ_999-e1.aplf
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
RTest_ZZZ_999(stopFlag batchFlag);v;n;d;xml;rf;f1;f2;f3;⎕TRAP
Check the "Version" function and publish.config and history.txt
RTest_ZZZ_999(stopFlag batchFlag);v;n;d;xml;rf;f1;f2;⎕TRAP
Check the "Version" function and publish.config.
⎕TRAP(999 'C' '. ⍝ Deliberate error')(0 'N')
R∆Failed

rf#._Execute.Execute

First we check whether "Version" returns a valid result:
(n v d)rf.Version
v{/3>+\'.'=}v Remove build ID
f1~5v
f12'.'+.=v
f1~/⎕Dv~'.'

f110d
f1d[4 7+⎕IO].'-'
f1~/⎕Dd~'-'

publish.config must be in line with what "Version" returns of course:
xml⎕XML'flat'#.APLTreeUtils.ReadUtf8File'publish.config'
f2v(2+⎕IO)xml[xml[;1+⎕IO]'version';]
f2d(2+⎕IO)xml[xml[;1+⎕IO]'date';]

history.txt might be useful during development but must not exist
when the project is checked in:
f3⎕NEXISTS'history.txt'

:If f1
'Result of the "Version" function is invalid.'
:EndIf
:If f2
'The contents of "publish.config" is not in line with "Version".'
:EndIf
:If f3
'There is a file "history.txt" but there shouldn''t.'
:EndIf

FailsIf f1f2f3
FailsIf f1f2

R∆OK
2 changes: 2 additions & 0 deletions APLSource/r-0.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
r
No run function really!!
Binary file modified Make/Make.DWS
Binary file not shown.
1 change: 0 additions & 1 deletion Tests/TestDir/Здравствуй мир.txt

This file was deleted.

2 changes: 1 addition & 1 deletion acre.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[ CaseCode←'On' KeepHistory←'On' Open←'' ProjectSpace←'#._Execute' StartUp←'']
[ CaseCode←'On' Open←'' ProjectSpace←'#._Execute' StartUp←'']
Expand Down
2 changes: 1 addition & 1 deletion publish.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<tool name="Execute"> <version>1.9.0</version> <date>2018-02-19</date> <container>#._Execute</container> <files></files> <needs> <script>APLTreeUtils</script> <script>FilesAndDirs</script> <script>OS</script> <script>Tester</script> </needs> <scriptOnly>1</scriptOnly> <wsid>Development</wsid> <autoload>1</autoload> <buildid>2</buildid></tool>
<tool name="Execute"> <version>1.9.1</version> <date>2019-02-04</date> <container>#._Execute</container> <files></files> <needs> <script>APLTreeUtils</script> <script>FilesAndDirs</script> <script>OS</script> <script>Tester</script> </needs> <scriptOnly>1</scriptOnly> <wsid>Development</wsid> <autoload>1</autoload> <buildid>3</buildid></tool>
Expand Down

0 comments on commit b21f657

Please sign in to comment.