Skip to content

Commit

Permalink
Issue #4: create/start stone working: createStone.solo --force --regi…
Browse files Browse the repository at this point in the history
…stry= --template=default_seaside --start gs_3.6.6 3.6.6
  • Loading branch information
dalehenrich committed May 31, 2023
1 parent e9a918d commit 8f50829
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ registerProduct.solo --registry=$registryName --fromDirectory=$GS_HOME/shared/do
# register named GemStone version using path to product tree
registerProduct.solo --registry=$registryName --productPath=/bosch1/users/dhenrich/_work/d_37x/noop50/gs/product 3.7.0

# register default stones directory
registerStonesDirectory.solo --registry=$registryName --stonesDirectory=/bosch1/users/dhenrich/_issue_4/stones

registryReport.solo
```

## Create a stone
```bash
stoneDirectoryPath=$GS_HOME/server/stones/gs_366
createStone.solo --force --registry=$registryName --template=default_seaside \
--start --root=stoneDirectoryPath 3.6.6
# create stone in default stones directory
createStone.solo --force --registry=$registryName --template=default_seaside --start gs_3.6.6 3.6.6

# create stone in custom stones directory
createStone.solo --root=/bosch1/users/dhenrich/_stones/stones --force --registry=$registryName --template=default_seaside --start gsd_3.6.6 3.6.6

registryReport.solo
```
Expand Down
27 changes: 17 additions & 10 deletions bin/createStone.solo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ options
SuperDoitOptionalOptionWithNoArg long: 'force' short: 'f'.
SuperDoitOptionalOptionWithNoArg long: 'start'.
SuperDoitRequiredOptionWithRequiredArg long: 'registry'.
SuperDoitRequiredOptionWithRequiredArg long: 'root'.
SuperDoitOptionalOptionWithRequiredArg long: 'root'.
SuperDoitRequiredOptionWithRequiredArg long: 'template'.
SuperDoitOptionalOptionWithNoArg long: 'verbose' short: 'v'.
}
Expand All @@ -31,8 +31,8 @@ EXAMPLES
$basename --help
$basename -D
$basename --debugGem
$basename --registry=bosch --template=minimal --root=/export/bosch1/users/dhenrich/_stones/stones/bosch_370 3.7.0
$basename -f --registry=bosch --template=minimal --root=/export/bosch1/users/dhenrich/_stones/stones/bosch_370 3.7.0
$basename --registry=bosch --template=minimal --root=/export/bosch1/users/dhenrich/_stones/stones bosch_370 3.7.0
$basename -f --registry=bosch --template=minimal --root=/export/bosch1/users/dhenrich/_stones/stones bosch_370 3.7.0
-----
%
specs
Expand Down Expand Up @@ -81,13 +81,17 @@ doit
self verbose
ifTrue: [ (self globalNamed: 'GDKGsDevKit_stonesBase') verbose: true ].
stonesRegistry := registryClass stonesRegistryNamed: self registry.
rootDir := self root asFileReference.
stoneName := rootDir basename.
gemstoneVersion := self positionalArgs at: 1.
rootDir := self root
ifNotNil: [:rootPath | rootPath asFileReference ]
ifNil: [ stonesRegistry stonesDirectory asFileReference ].
self positionalArgs size ~= 2
ifTrue: [ self error: 'Expected 2 positional arguments: <stone-name> <gemstone-version>, only got ', self positionalArgs size printString ].
stoneName := self positionalArgs at: 1.
gemstoneVersion := self positionalArgs at: 2.
stoneSpecClass := self globalNamed: 'GDKStoneSpec'.
stoneSpec := stoneSpecClass
newNamed: stoneName
rootDirectory: rootDir
rootDirectory: rootDir / stoneName
directorySpecName: self template
gemstoneVersionString: gemstoneVersion.
stoneSpec
Expand All @@ -96,9 +100,12 @@ doit
yourself.
(stoneSpec registryFile exists or: [stoneSpec rootDir exists])
ifTrue: [
self force
ifFalse: [ self error: 'registry file ', stoneSpec registryFile pathString printString, ' still exists. Use --force to clean up.'].
stoneSpec destroyStoneStructure ].
(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 ]
ifFalse: [ self error: 'A stone with the name ', stoneName printString, ' already exists. Not yet implemented' ] ].
stoneSpec createStoneStructureUsing: stonesRegistry.
stoneSpec registryDir ensureCreateDirectory.
stoneSpec export.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ createStoneStructure: stoneSpec
open: (stoneRoot / 'system.conf') pathString
mode: 'w+'
onClient: false. "need to append entries to the file"
exportDir at: GDKGsDevKit_stonesBase dataHomeEnvVar put: self class data_home pathString.
exportDir
at: GDKGsDevKit_stonesBase dataHomeEnvVar
put: self class data_home pathString.
self
keysAndValuesDo: [ :key :value |
key = #'customenv'
Expand All @@ -35,8 +37,9 @@ createStoneStructure: stoneSpec
ifTrue: [ (stoneRoot / value) ensureCreateDirectory ].
key = #'extents'
ifTrue: [
useExtentDir := '/' , value, '/'.
(stoneRoot / value) ensureCreateDirectory ].
useExtentDir := '/' , value , '/'.
(stoneRoot / value) ensureCreateDirectory.
stoneRoot / 'extent0.dbf' moveTo: stoneRoot / value ].
key = #'logs'
ifTrue: [ (stoneRoot / value) ensureCreateDirectory ].
key = #'stats'
Expand All @@ -51,8 +54,8 @@ createStoneStructure: stoneSpec
ifTrue: [ (stoneRoot / value) ensureCreateDirectory ].
key = #'product'
ifTrue: [
"???"
self halt ].
"noop, as product symbolic link is created by default"
].
key = #'gemstone'
ifTrue: [
"???"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
runtime
defineCustomEnvVars
self stoneDirectorySpec customenv
keysAndValuesDo: [ :varName :valueStr | System gemEnvironmentVariable: varName put: valueStr ]
ifNotNil: [ :customenv |
customenv
keysAndValuesDo: [ :varName :valueStr | System gemEnvironmentVariable: varName put: valueStr ] ]
2 changes: 1 addition & 1 deletion templates/default.ston
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GDKhomeStoneDirectorySpec{
GDKhomeStoneDirectorySpec{
#name : 'default',
#backups : 'backups',
#bin : 'bin',
Expand Down

0 comments on commit 8f50829

Please sign in to comment.