-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #4: implement startNetldi.solo
- Loading branch information
1 parent
a9a9474
commit 1a84d16
Showing
16 changed files
with
171 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/usr/bin/env superdoit_solo | ||
options | ||
{ | ||
SuperDoitOptionalOptionWithRequiredArg long: 'registry'. | ||
SuperDoitOptionalOptionWithNoArg long: 'verbose' short: 'v'. | ||
} | ||
% | ||
Usage | ||
----- | ||
USAGE $basename [--help | -h] [--debug | -D] [--debugGem] [-v | --verbose] \ | ||
--registry=<registry-name> <stone-name> | ||
|
||
DESCRIPTION | ||
Start netldi for named stone. | ||
|
||
OPTIONS | ||
-h, --help display usage message | ||
-D, --debug bring up topaz debugger in the event of a script error | ||
--debugGem If terminal is connected to stdout, bring up debugger. If not, | ||
dump stack to stdout and wait for topaz to attach using topaz | ||
DEBUGGEM command. | ||
-v, --verbose Verbose logging enabled. | ||
|
||
|
||
EXAMPLES | ||
$basename --help | ||
$basename -D | ||
$basename --debugGem | ||
$basename --registry=bosch bosch_370 | ||
----- | ||
% | ||
specs | ||
[ | ||
RwLoadSpecificationV2 { | ||
#projectName : 'GsDevKit_stones', | ||
#projectSpecFile : 'rowan/project.ston', | ||
#componentNames : [ | ||
'Core', | ||
'Solo' | ||
], | ||
#platformProperties : { | ||
'gemstone' : { | ||
'allusers' : { | ||
#defaultSymbolDictName : 'Globals' | ||
} | ||
} | ||
}, | ||
#comment : '' | ||
}, | ||
RwLoadSpecificationV2 { | ||
#projectName : 'GsCommands', | ||
#projectSpecFile : 'rowan/project.ston', | ||
#diskUrl : '$GEMSTONE/examples/GsCommands/projectsHome/GsCommands', | ||
#componentNames : [ | ||
'Commands' | ||
], | ||
#platformProperties : { | ||
'gemstone' : { | ||
'allusers' : { | ||
#defaultSymbolDictName : 'UserGlobals' | ||
} | ||
} | ||
}, | ||
#comment : '' | ||
} | ||
] | ||
% | ||
doit | ||
| registryClass stonesRegistry stoneName stoneSpec | | ||
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'). | ||
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: [] ] | ||
ifFalse: [ | ||
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 ]. | ||
stoneSpec startNetldi: self. | ||
^ self noResult | ||
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
src/GsDevKit_stones-Core.package/GDKStoneDirectorySpec.class/instance/logsDir.st
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
src/GsDevKit_stones-Core.package/GDKStoneDirectorySpec.class/instance/netldiPort..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
netldiPort: object | ||
netldiPort := object |
3 changes: 3 additions & 0 deletions
3
src/GsDevKit_stones-Core.package/GDKStoneDirectorySpec.class/instance/netldiPort.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
netldiPort | ||
^netldiPort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"bin", | ||
"extents", | ||
"logs", | ||
"netldiPort", | ||
"stats", | ||
"tranlogs", | ||
"snapshots", | ||
|
6 changes: 6 additions & 0 deletions
6
src/GsDevKit_stones-Core.package/GDKStoneSpec.class/instance/logsDir.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
accessing | ||
logsDir | ||
| dir | | ||
dir := self rootDir / self stoneDirectorySpec logs. | ||
dir ensureCreateDirectory. | ||
^ dir |
3 changes: 3 additions & 0 deletions
3
src/GsDevKit_stones-Core.package/GDKStoneSpec.class/instance/startNetldi..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
runtime | ||
startNetldi: superDoitScriptOrNil | ||
self startNetldi: superDoitScriptOrNil withSuperDoitOptions: false |
46 changes: 46 additions & 0 deletions
46
...vKit_stones-Core.package/GDKStoneSpec.class/instance/startNetldi.withSuperDoitOptions..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
runtime | ||
startNetldi: superDoitScriptOrNil withSuperDoitOptions: superDoitOptions | ||
"nothing special with regards to options at the present time" | ||
|
||
| scriptPath stdout exitStatus commandLine arrayOfOutputs | | ||
scriptPath := ''. | ||
stdout := superDoitScriptOrNil | ||
ifNotNil: [ | ||
scriptPath := superDoitScriptOrNil scriptPath. | ||
superDoitScriptOrNil stdout ] | ||
ifNil: [ GsFile stdout ]. | ||
stdout | ||
lf; | ||
nextPutAll: '====== starting netldi at ' , DateAndTime now printString; | ||
lf. | ||
exitStatus := 0. | ||
self defineCustomEnvVars. | ||
commandLine := '$GEMSTONE/bin/startnetldi' asFileReference pathString. | ||
commandLine | ||
add: ' -g'; | ||
add: ' -a ' , (System gemEnvironmentVariable: 'USER'); | ||
add: ' -P ' , self stoneDirectorySpec netldiPort asString; | ||
add: ' -l ' , (self logsDir / 'netldi.log') pathString; | ||
add: ' ' , self stoneName , '_ldi'; | ||
yourself. | ||
[ arrayOfOutputs := GsHostProcess execute: commandLine ] | ||
on: ChildError | ||
do: [ :ex | | ||
"exit status: | ||
0 on successful start | ||
1 if the specified netldi is already running | ||
2 if already running but the executable have been deleted | ||
3 or above, an error occurred and the specified netldi was not started" | ||
exitStatus := ex status ]. | ||
exitStatus = 0 | ||
ifTrue: [ stdout nextPutAll: (arrayOfOutputs at: 1) "stdout" ] | ||
ifFalse: [ | ||
(exitStatus = 1 or: [ exitStatus = 2 ]) | ||
ifTrue: [ stdout nextPutAll: 'netldi is already running' ] | ||
ifFalse: [ | ||
exitStatus >= 3 | ||
ifTrue: [ stdout nextPutAll: 'netldi failed to start' ] ] ]. | ||
stdout | ||
lf; | ||
nextPutAll: '****************************************'; | ||
lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters