Skip to content

Commit

Permalink
simplified the gslist.solo script ... runs using solo GEMSTONE
Browse files Browse the repository at this point in the history
  • Loading branch information
dalehenrich committed Jun 2, 2023
1 parent 3b3d0c1 commit c3853ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 41 deletions.
36 changes: 6 additions & 30 deletions bin/gslist.solo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ customoptions
SuperDoitOptionalOptionWithNoArg long: 'help'.
SuperDoitOptionalOptionWithNoArg long: 'debug'.
SuperDoitOptionalOptionWithNoArg long: 'debugGem'.
SuperDoitOptionalOptionWithRequiredArg long: 'registry'.
SuperDoitOptionalOptionWithNoArg long: 'verbose'.
SuperDoitOptionalOptionWithNoArg long: 'long' short: 'l'.
SuperDoitOptionalOptionWithNoArg long: 'json' short: 'j'.
Expand All @@ -13,11 +12,10 @@ SuperDoitOptionalOptionWithNoArg long: 'removeLocks' short: 'c'.
%
Usage
-----
USAGE $basename [--help] [--debug] [--debugGem] [--verbose] \
--registry=<registry-name> <stone-name>
USAGE $basename [--help] [--debug] [--debugGem] [--verbose]

DESCRIPTION
Run gslist command using the GEMSTONE associated with the named stone.
Run gslist command using the GEMSTONE of solo stone.

OPTIONS
Note that the standard shortcuts options are not supported, since we weant
Expand All @@ -41,17 +39,11 @@ EXAMPLES
$basename --help
$basename --debug
$basename --debugGem
$basename --registry=bosch 3.7.0
$basename --registry=bosch 3.7.0 --long --removeLocks
# if launched from stone directory where .GDKStoneSpec.ston is present
$basename
$basename -l
$basename -lc
-----
%
instvars
gemstoneVersionString
%
specs
[
RwLoadSpecificationV2 {
Expand Down Expand Up @@ -90,34 +82,18 @@ RwLoadSpecificationV2 {
%
method
gemstoneVersionString
^ gemstoneVersionString ifNil: [ System gemVersionReport at: 'gsVersion' ]
^ System gemVersionReport at: 'gsVersion'
%
doit
| registryClass stoneName stoneSpec registry output |
| registryClass registry output |
self preDoitSpecLoad: [:spec |
spec projectName = 'GsCommands'
ifTrue: [ spec projectsHome: '$GEMSTONE/examples/GsCommands/projectsHome' ]
ifFalse: [ spec projectsHome: self dirname asFileReference parent parent ] ].
registryClass := (self globalNamed: 'GDKRegistry').
registryClass := (self globalNamed: 'GDKStonesRegistry').
self verbose
ifTrue: [ (self globalNamed: 'GDKGsDevKit_stonesBase') verbose: true ].
self positionalArgs size = 0
ifTrue: [
| specFile |
specFile := FileLocator workingDirectory asFileReference / '.GDKStoneSpec.ston'.
stoneSpec := (self globalNamed: 'GDKAbstractRegistryStore') fromPath: specFile ifAbsent: [].
gemstoneVersionString := stoneSpec gemstoneVersionString ]
ifFalse: [
| stonesRegistry |
self positionalArgs size > 1
ifTrue: [ self error: 'Expected a single positional argument: <stone-name>, not ', self positionalArgs size printString, ' positional arguments' ].
stoneName := self positionalArgs at: 1.
self registry
ifNil: [ self error: '--registry option must be specified when <stone-name> is specified' ].
stonesRegistry := registryClass stonesRegistryNamed: self registry.
stoneSpec := stonesRegistry stoneNamed: stoneName ].
registry := stoneSpec registry.
output := registry gslist: self withSuperDoitOptions: true.
output := registryClass gslist: self withSuperDoitOptions: true.
self stdout lf; nextPutAll: output; lf.
^ self noResult
%
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gslist: superDoitScriptOrNil withSuperDoitOptions: superDoitOptionsBoolean
gemstoneVersionString
removeLocks"

| stdout scriptPath exitStatus commandLine gslistOutput verbose long json oldGemstone removeLocks |
| stdout scriptPath exitStatus commandLine gslistOutput verbose long json removeLocks |
verbose := GDKGsDevKit_stonesBase verbose.
scriptPath := ' '.
removeLocks := json := long := false.
Expand All @@ -30,14 +30,6 @@ gslist: superDoitScriptOrNil withSuperDoitOptions: superDoitOptionsBoolean
'====== starting gslist at' , scriptPath , DateAndTime now printString;
lf ].
exitStatus := 0.
[
oldGemstone := System gemEnvironmentVariable: 'GEMSTONE'.
System
gemEnvironmentVariable: 'GEMSTONE'
put:
(self products
at: superDoitScriptOrNil gemstoneVersionString
ifAbsent: [ System gemEnvironmentVariable: 'GEMSTONE' ]).
commandLine := '$GEMSTONE/bin/gslist' asFileReference pathString.
long
ifTrue: [ commandLine add: ' -l' ].
Expand All @@ -59,8 +51,7 @@ gslist: superDoitScriptOrNil withSuperDoitOptions: superDoitOptionsBoolean
1 (No servers found)
2 (Stale lock(s) removed)
3, or 4 (Fatal error)"
exitStatus := ex status ] ]
ensure: [ System gemEnvironmentVariable: 'GEMSTONE' put: oldGemstone ].
exitStatus := ex status ].
exitStatus = 0
ifTrue: [
verbose
Expand Down

0 comments on commit c3853ae

Please sign in to comment.