Skip to content

Commit

Permalink
Issue #4: clean things up so createStone and deleteStone do the right…
Browse files Browse the repository at this point in the history
… things
  • Loading branch information
dalehenrich committed Aug 3, 2023
1 parent 1f18bf1 commit a0eb772
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 18 deletions.
15 changes: 3 additions & 12 deletions bin/createStone.solo
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,11 @@ doit
yourself.
(stoneSpec registryFile exists or: [stoneSpec rootDir exists])
ifTrue: [
(stoneSpec rootDir exists)
ifTrue: [
self force
ifFalse: [
self error:
'A stone is already present at ',
stoneSpec rootDir pathString printString,
'. Use --force to clean up.'].
stoneSpec destroyStoneStructure ]
self force
ifFalse: [
self error:
'A stone with the name ',
stoneName printString,
' already exists. Not yet implemented' ] ].
'A stone named ', stoneName, ' already exists. Use --force to clean up.'].
stoneSpec destroyStoneStructure ].
stoneSpec createStoneStructureUsing: stonesRegistry.
stoneSpec registryDir ensureCreateDirectory.
stoneSpec export.
Expand Down
4 changes: 3 additions & 1 deletion bin/deleteStone.solo
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ doit
self positionalArgs size ~= 1
ifTrue: [ self error: 'Expected a positional argument: <stone-name>' ].
stoneName := self positionalArgs at: 1.
stoneSpec := stonesRegistry stoneNamed: stoneName.
stoneSpec := stonesRegistry
stoneNamed: stoneName
ifAbsent: [ self error: 'The stone ', stoneName printString, ' does not exist' ].
stonesRegistry destroyStoneStructureFor: stoneName.
^ self noResult
%
2 changes: 1 addition & 1 deletion bin/validateStoneSysNodes.stone
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,5 @@ doit
value: stoneRootDir
value: 'repos.ston'
value: 'repos' ].
^ self noResult
^ System commit
%
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ destroyStoneStructure

"shut down stone BEFORE calling"

[
(self waitStone: 1) ~= 3
ifTrue: [
self
error:
'The stone ' , self stoneName
,
' is still running. It must be stopped BEFORE destroying the stone structure' ].
' is still running. It must be stopped BEFORE destroying the stone structure' ] ]
on: Error
do: [ :ignored |
"ignore errors during waitstone"
].
self rootDir exists
ifTrue: [ self rootDir ensureDeleteAll ].
self registryFile exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ stone management
destroyStoneStructureFor: stoneName
| stoneSpec status |
stoneSpec := self stoneNamed: stoneName.
[
(stoneSpec waitStone: 1) = 0
ifTrue: [
| count |
Expand All @@ -14,8 +15,16 @@ destroyStoneStructureFor: stoneName
count := count + 1.
count > 2
ifTrue: [ self error: 'Cannot stop stone' ].
Delay waitForSeconds: 1 ] ].
stoneSpec stopNetldi.
Delay waitForSeconds: 1 ] ] ]
on: Error
do: [ :ignored |
"ignore errors during waitstone/stopstone"
].
[ stoneSpec stopNetldi ]
on: Error
do: [ :ignored |
"ignore errors during stopNetldi"
].
stoneSpec destroyStoneStructure.
self stones removeKey: stoneName.
self export
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ todeHomeDirectory: todeHomePath templatesDir: sourceTemplatesDir populate: popul
(todeHomeDir / 'sys' / 'default' / 'server') ensureCreateDirectory.
(todeHomeDir / 'sys' / 'default' / 'server' / 'gemstone')
ensureCreateDirectory.

(todeHomeDir / 'sys' / 'default' / 'server' / 'home') ensureCreateDirectory.
(todeHomeDir / 'sys' / 'default' / 'server' / 'home' / 'tode') ensureCreateDirectory.
"copy GsDevKit_stones/todeHome/tode"
(todeHomeDir / 'sys' / 'default' / 'server' / 'home' / 'utils' ) ensureCreateDirectory.
"copy GsDevKit_stones/todeHome/utils"

(todeHomeDir / 'sys' / 'default' / 'server' / 'projects')
ensureCreateDirectory.
(todeHomeDir / 'sys' / 'default' / 'server' / 'stones') ensureCreateDirectory.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
stash
shellId
shellId ifNil: [ shellId := 1 ].
shellId ifNil: [ shellId := 0 ].
^ shellId

0 comments on commit a0eb772

Please sign in to comment.