Skip to content

Commit

Permalink
add --ensure option to createStone.solo; create registryQuery,solo; t…
Browse files Browse the repository at this point in the history
…est both
  • Loading branch information
dalehenrich committed Oct 24, 2023
1 parent 469b4ca commit a563e34
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 6 deletions.
26 changes: 21 additions & 5 deletions bin/createStone.solo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env superdoit_solo
options
{
SuperDoitOptionalOptionWithNoArg long: 'ensure' short: 'e'.
SuperDoitOptionalOptionWithNoArg long: 'force' short: 'f'.
SuperDoitOptionalOptionWithNoArg long: 'start'.
SuperDoitOptionalOptionWithRequiredArg long: 'registry' short: 'r'.
Expand All @@ -11,7 +12,11 @@ SuperDoitOptionalOptionWithNoArg long: 'verbose' short: 'v'.
%
Usage
-----
USAGE $basename [--help | -h] [--debug | -D] [--debugGem] [-f | --force] [-v | --verbose] \
USAGE $basename [--help | -h] [--debug | -D] [--debugGem][-v | --verbose] \
[
[-f | --force] |
[-e | --ensure]
]
--root=<stone-directory> [--registry=<registry-name> | -r <registry-name>] \
--template=<template-name> <stone-name> <gemstone-version>

Expand All @@ -25,6 +30,7 @@ OPTIONS
dump stack to stdout and wait for topaz to attach using topaz
DEBUGGEM command.
-f, --force Delete the stone directory if it exists.
-e, --ensure Ensure that the stone exists. Use it "as is".
-v, --verbose Verbose logging enabled.
--registry=<registry-name> | -r <registry-name>
<registry-name> is the name of the registry. Default is hostname.
Expand All @@ -35,6 +41,7 @@ EXAMPLES
$basename --debugGem
# extent0.dbf, SystemUser
$basename --force --registry=gsdevkit --template=minimal gs_366 3.6.6
$basename --ensure --registry=gsdevkit --template=minimal gs_366 3.6.6
# extent0.rowan.dbf, SystemUser
$basename -f --registry=bosch --template=minimal_rowan rowan_366 3.6.6
# extent0.seaside.dbf, tODE installed, DataCurator
Expand Down Expand Up @@ -115,6 +122,13 @@ loadTode: stoneSpec
stdout: nil
andInput: nil
%
method
startTheStoneAndNetldi: stoneSpec
self start
ifTrue: [
stoneSpec startStone: self withSuperDoitOptions: false.
stoneSpec startNetldi: self withSuperDoitOptions: true ].
%
doit
| registryClass stonesRegistry gemstoneVersion stoneName rootDir stoneSpec stoneSpecClass |
self preDoitSpecLoad: [:spec |
Expand Down Expand Up @@ -154,6 +168,11 @@ doit
ifTrue: [
self force
ifFalse: [
self ensure
ifTrue: [
"stone already exists ... leave as is ... start stone if desired"
self startTheStoneAndNetldi: stoneSpec.
^ stoneSpec ].
self error:
'A stone named ', stoneName, ' already exists. Use --force to clean up.', ' (', self basename, ')'].
stonesRegistry destroyStoneStructureFor: stoneName ].
Expand All @@ -165,9 +184,6 @@ doit
stoneSpec class
symbolicLink: stoneSpec registryPath
linkName: stoneSpec rootDir / '.GDKStoneSpec.ston'.
self start
ifTrue: [
stoneSpec startStone: self withSuperDoitOptions: false.
stoneSpec startNetldi: self withSuperDoitOptions: true ].
self startTheStoneAndNetldi: stoneSpec.
^ stoneSpec
%
87 changes: 87 additions & 0 deletions bin/registryQuery.solo
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env superdoit_solo
options
{
SuperDoitOptionalOptionWithRequiredArg long: 'registry' short: 'r'.
SuperDoitOptionalOptionWithRequiredArg long: 'product'.
SuperDoitOptionalOptionWithNoArg long: 'stonesDirectory'.
}
%
usage
-----
USAGE $basename [--help | -h] [--debug | -D] [--debugGem] \
[ \
[ --registry=<registry-name> | -r <registry-name>] \
[ --product=<product-name> ] \
[ --stonesDirectory ]
]

DESCRIPTION
Writes the value of the given attribute on stdout, or an empty string, if the
attribute is not found.

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.
--registry=<registry-name> | -r <registry-name>
<registry-name> is the name of the registry.
--product=<productName-name>
write path to product directory to stdout or empty string, if
the <product-name> is not registered
--stonesDirectory
write stones directory path to stdout or empty string, if not
registered

EXAMPLES
$basename --help
$basename -D
$basename --debugGem
$basename
$basename --registry=bosch
$basename --registry=bosch --projectSet=dev
$basename --registry=bosch --template=minimal
$basename -r bosch --stone=bosch_370
-----
%
specs
[
RwLoadSpecificationV2 {
#projectName : 'GsDevKit_stones',
#projectSpecFile : 'rowan/project.ston',
#componentNames : [
'Core',
'Solo'
],
#platformProperties : {
'gemstone' : {
'allusers' : {
#defaultSymbolDictName : 'Globals'
}
}
},
#comment : ''
}
]
%
method
registryName
^ self registry
ifNil: [ (self globalNamed: 'System') hostname ]
ifNotNil: [:value | value ].
%
doit
| registryClass stonesRegistry |
self preDoitSpecLoad: [:spec |
spec projectsHome: self dirname asFileReference parent parent].
registryClass := (self globalNamed: 'GDKRegistry').
stonesRegistry := registryClass stonesRegistryNamed: self registryName.
self stonesDirectory
ifTrue: [
self stdout nextPutAll: (stonesRegistry stonesDirectory ifNil: [ '']); lf ].
self product
ifNotNil: [ :productName |
self stdout nextPutAll: (stonesRegistry products at: productName ifAbsent: ['']); lf ].
^ self noResult
%
7 changes: 6 additions & 1 deletion tests/test_defaultRegistry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# test coverage for when --registry option is omitted (default registry name will be hostname):
# registryReport.sol
# registryQuery.solo
# createRegistry.solo
# createProjectSet.solo
# updateProjectSet.solo
Expand Down Expand Up @@ -81,6 +82,8 @@ downloadGemStone.solo $GS_VERS $*
# update product list from shared product directory when a download is done by shared registry
registerProduct.solo --fromDirectory=$STONES_HOME/test_gemstone $*

productPath=`registryQuery.solo --product`
echo "product path for ${GS_VERS}: $productPath"
# create and register default stones directory for rowanV3
if [ ! -d $STONES_HOME/test_stones ]; then
mkdir $STONES_HOME/test_stones
Expand Down Expand Up @@ -110,9 +113,11 @@ case "$GS_VERS" in
esac
# create a $GS_VERS Rowan stone and install GsDevKit_home
export stoneName=gs_$GS_VERS
createStone.solo --template=$template $stoneName $GS_VERS $*
createStone.solo --ensure --template=$template $stoneName $GS_VERS $*

createStone.solo --ensure --template=$template $stoneName $GS_VERS $*
echo $PLATFORM

set -x
if [ "$CI" = "true" ]; then
# possible native code generation issues on mac and github, disable native code
Expand Down

0 comments on commit a563e34

Please sign in to comment.