From 132cfffb0ca3823074be0173835d701b2a793746 Mon Sep 17 00:00:00 2001 From: Dale Henrichs Date: Mon, 31 Jul 2023 12:53:57 -0700 Subject: [PATCH] Isue #4: working through setUpSys and progressed through 'mount --todeRoot' commands --- .../instance/todeHomeDirectory.populate..st | 1 + .../_serverExecuteString.debugMode..st | 8 ++-- .../_setupSessionForGsDevKit_stones.st | 26 +++++++++++++ .../instance/debugMode.st | 5 +++ .../evaluateCommand.batchMode.debugMode..st | 6 +-- .../instance/session.st | 3 +- .../properties.json | 1 + .../instance/evaluate.batchMode..st | 38 ++++++++++++++++++- tode/example7 | 7 ++++ tode/setUpSys | 13 +++++++ 10 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_setupSessionForGsDevKit_stones.st create mode 100644 src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/debugMode.st create mode 100644 tode/example7 create mode 100644 tode/setUpSys diff --git a/src/GsDevKit_stones-Core.package/GDKStonesRegistry.class/instance/todeHomeDirectory.populate..st b/src/GsDevKit_stones-Core.package/GDKStonesRegistry.class/instance/todeHomeDirectory.populate..st index eb407666..859107ad 100644 --- a/src/GsDevKit_stones-Core.package/GDKStonesRegistry.class/instance/todeHomeDirectory.populate..st +++ b/src/GsDevKit_stones-Core.package/GDKStonesRegistry.class/instance/todeHomeDirectory.populate..st @@ -10,6 +10,7 @@ todeHomeDirectory: todeHomePath populate: populate ifTrue: [ todeHomeDir ensureCreateDirectory. (todeHomeDir / 'sys') ensureCreateDirectory. + (todeHomeDir / 'sys' / 'default') ensureCreateDirectory. (todeHomeDir / 'sys' / 'local') ensureCreateDirectory. (todeHomeDir / 'sys' / 'local' / 'server') ensureCreateDirectory. (todeHomeDir / 'sys' / 'local' / 'server' / 'gemstone') ensureCreateDirectory. diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_serverExecuteString.debugMode..st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_serverExecuteString.debugMode..st index f1e39515..930c6d2a 100644 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_serverExecuteString.debugMode..st +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_serverExecuteString.debugMode..st @@ -1,6 +1,7 @@ server external session calls -_serverExecuteString: executeString debugMode: debugMode +_serverExecuteString: executeString debugMode: debugModeBool | doitString | + debugMode := debugModeBool. doitString := debugMode ifTrue: [ ' @@ -14,7 +15,7 @@ _serverExecuteString: executeString debugMode: debugMode [ self session nbExecute: doitString ] on: GsErrorNotification do: [ :ex | self error: 'Unable to execute #executeString: on tODE server' ]. - [self session nbResult] + [ self session nbResult ] on: GciError do: [ :ex | ex gsNumber = 2336 @@ -26,5 +27,4 @@ _serverExecuteString: executeString debugMode: debugMode session: self; tag: ex gciErrSType; signal ]. -ex continue. "after this continue, lastResult is the string we are looking for, however, the continue is necessary and we end up returning something different" - ] ] \ No newline at end of file + ex continue "after this continue, lastResult is the string we are looking for, however, the continue is necessary and we end up returning something different" ] ] \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_setupSessionForGsDevKit_stones.st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_setupSessionForGsDevKit_stones.st new file mode 100644 index 00000000..5666908b --- /dev/null +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/_setupSessionForGsDevKit_stones.st @@ -0,0 +1,26 @@ +private +_setupSessionForGsDevKit_stones + "set up the tODE for GsDevKit_stones environment. session has been logged in, so we can + execute commands and set up environement: + 1. set gitRootPath + " + + | executeString doitString | + executeString := 'TDProjectEntryDefinition defaultGitRootPath: ' + , self sessionDescription serverGitRoot printString. + doitString := debugMode + ifTrue: [ + ' +[ + ^ (' , executeString + , + ') ] + on: Error, Halt + do: [ :ex | System waitForDebug ]' ] + ifFalse: [ executeString ]. + + + [ self session nbExecute: doitString ] + on: GsErrorNotification + do: [ :ex | self error: 'Unable send #backupDirectory: message to tODE server' ]. + ^ self session nbResult \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/debugMode.st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/debugMode.st new file mode 100644 index 00000000..a6fd332d --- /dev/null +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/debugMode.st @@ -0,0 +1,5 @@ +accessing +debugMode + "if true, remote debugging via debugGem will be enabled" + + ^ debugMode \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode.debugMode..st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode.debugMode..st index 3ae54edb..ba558f1b 100644 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode.debugMode..st +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/evaluateCommand.batchMode.debugMode..st @@ -1,9 +1,9 @@ -evaluation -evaluateCommand: command batchMode: batchBool debugMode: debugMode +other +evaluateCommand: command batchMode: batchBool debugMode: debugModeBool | stonString | stonString := STON toString: command. ^ self _serverExecuteString: '(' , self todeServerAccessString , ' for: ' , self shell shellId asString , ') evaluateSTONCommand:' , stonString printString - debugMode: debugMode \ No newline at end of file + debugMode: debugModeBool \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st index 7c974fd5..59deccd4 100644 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/instance/session.st @@ -3,5 +3,6 @@ session session ifNil: [ session := self login. - self topezServerProxy ]. + self topezServerProxy. + self _setupSessionForGsDevKit_stones]. ^ session \ No newline at end of file diff --git a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/properties.json b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/properties.json index 462b2987..133de121 100644 --- a/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/properties.json +++ b/src/GsDevKit_stones-Tode.package/TDExternalSessionClient.class/properties.json @@ -9,6 +9,7 @@ "shell", "session", "topezServerProxy", + "debugMode", "clientForwarderCache", "serverApiVersion", "effectiveApiVersion" ], diff --git a/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st b/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st index d33ab801..9130d9a9 100644 --- a/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st +++ b/src/GsDevKit_stones-Tode.package/TDShell.class/instance/evaluate.batchMode..st @@ -5,7 +5,43 @@ evaluate: aString batchMode: aBool TDCommandLine fromStream: aString readStream selectLine: [ :line | true ] - forEachCommand: [ :command | result := self evaluateCommand: command batchMode: aBool ]. + forEachCommand: [ :command | + | index commandLine todeRoot rest | + commandLine := command commandLine copy. + todeRoot := '--todeRoot'. + (command command = 'mount' + and: [ (index := commandLine findString: todeRoot startingAt: 1) > 0 ]) + ifTrue: [ + | newCommandLine commandStream skipDone | + "--todeRoot option for mount command uses a call back, so hard-wire todeRoot path into the command + and remove --todeRoot option from commandLine" + newCommandLine := (commandLine copyFrom: 1 to: index - 1) + , (commandLine copyFrom: index + todeRoot size to: commandLine size). + commandStream := newCommandLine readStream. + commandStream + skipSeparators; + skip: 'mount' size; + skipSeparators; + yourself. + newCommandLine := 'mount ' , self sessionDescription serverTodeRoot. + commandStream peek = $/ + ifFalse: [ + (self sessionDescription serverTodeRoot endsWith: '/') + ifFalse: [ newCommandLine add: '/' ] ]. + skipDone := false. + [ skipDone ] + whileFalse: [ + | char | + "characters up to the next separator are part of first positional argument " + (char := commandStream next) isSeparator + ifTrue: [ skipDone := true ]. + newCommandLine add: char ]. + rest := commandStream upToEnd. + newCommandLine add: rest. + TDCommandLine + fromStream: newCommandLine readStream + forEachCommand: [ :newCommand | result := self evaluateCommand: newCommand batchMode: aBool ] ] + ifFalse: [ result := self evaluateCommand: command batchMode: aBool ] ]. ^ result ] on: Error , TDRestoreFromBackupComplete , GsTopezCommandErrorNotification do: [ :ex | diff --git a/tode/example7 b/tode/example7 new file mode 100644 index 00000000..1296b7d4 --- /dev/null +++ b/tode/example7 @@ -0,0 +1,7 @@ +# +# test project command +# +# ... look in the gemnet file for the gem to find the +# DEBUGGEM expression to use +# +project new --force Foo diff --git a/tode/setUpSys b/tode/setUpSys new file mode 100644 index 00000000..4bcffc9d --- /dev/null +++ b/tode/setUpSys @@ -0,0 +1,13 @@ +# Set up /sys node structure +mount --todeRoot / / _home +mount --todeRoot sys/default /sys default +mount --todeRoot sys/local /sys local +mount --todeRoot sys/local/server/stones /sys stones +# ensure that --stoneRoot directory structure is present +# /sys/default/bin/validateStoneSysNodes --files --repair +mount --stoneRoot / /sys stone +# Define /home and /projects based on a composition of the /sys nodes +mount --stoneRoot homeComposition.ston / home +mount --stoneRoot projectComposition.ston / projects +commit +cd