Skip to content

Commit

Permalink
Issue #4: successfully execute execute: 'todeIt.solo "eval 3+4" --r…
Browse files Browse the repository at this point in the history
…egistry=issue_4 --stoneName=gs370 -D'
  • Loading branch information
dalehenrich committed Jul 28, 2023
1 parent 1ae32dd commit 155731e
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions bin/todeIt.solo
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env superdoit_solo
options
{
SuperDoitOptionalOptionWithRequiredArg long: 'registry'.
SuperDoitOptionalOptionWithRequiredArg long: 'stoneName'.
SuperDoitOptionalOptionWithNoArg long: 'verbose' short: 'v'.
}
%
Usage
-----
USAGE $basename [--help | -h] [--debug | -D] [--debugGem] [-v | --verbose] \
--registry=<registry-name> <stone-name>
--registry=<registry-name> --stoneName=<stone-name> <tode-command>

DESCRIPTION
This script is designed to run in the stone of interest and picks up the stone
information from the .GDKStoneSpec.ston file in the stone directory.
Execute tODE commands in the stone and print the result.

OPTIONS
-h, --help display usage message
Expand All @@ -23,7 +25,8 @@ EXAMPLES
$basename --help
$basename -D
$basename --debugGem
$basename "3+4"
$basename "eval \`3+4\`"
$basename "eval \`3+4\`" --registry=issue_4 --stoneName=gs_370
-----
%
specs
Expand Down Expand Up @@ -69,16 +72,25 @@ doit
ifTrue: [ spec projectsHome: '$GEMSTONE/examples/GsCommands/projectsHome' ]
ifFalse: [ spec projectsHome: self dirname asFileReference parent parent ] ].
registryClass := (self globalNamed: 'GDKRegistry').
self verbose
ifTrue: [ (self globalNamed: 'GDKGsDevKit_stonesBase') verbose: true ].
self positionalArgs size = 0
ifTrue: [ self error: 'a tODE command must be entered on command line' ]
ifFalse: [
ifTrue: [ self error: 'a tODE command must be entered on command line' ].
self registry
ifNotNil: [:registryName |
| stonesRegistry |
self stoneName
ifNil: [ self error: 'A --stoneName must be specified with --registry' ].
stonesRegistry := registryClass stonesRegistryNamed: self registry.
stoneSpec := stonesRegistry stoneNamed: self stoneName ]
ifNil: [
| specFile |
specFile := FileLocator workingDirectory asFileReference / '.GDKStoneSpec.ston'.
stoneSpec := (self globalNamed: 'GDKAbstractRegistryStore') fromPath: specFile ifAbsent: [] ].
sessionDescription := (self globalNamed: 'TDSessionDescription')
fromFile: stoneSpec todeHome asFileReference / 'sys' / 'local' / 'sessions' / stoneSpec stoneName.
^ (self globalNamed: 'TDShell')
^ ((self globalNamed: 'TDShell')
sessionDescription: sessionDescription
evaluate: (self positionalArgs at: 1)
debugMode: self debug
debugMode: self debug) asString
%

0 comments on commit 155731e

Please sign in to comment.