|
| 1 | +#!/usr/bin/env gsdevkit_launcher |
| 2 | +" |
| 3 | +USAGE: products [-h] |
| 4 | +
|
| 5 | +List downloaded GemStone/S products. |
| 6 | +
|
| 7 | +OPTIONS |
| 8 | + -h display help |
| 9 | +
|
| 10 | +EXAMPLES |
| 11 | + products -h |
| 12 | + products |
| 13 | +" |
| 14 | +Class { |
| 15 | + #name : 'GdkL_Products', |
| 16 | + #superclass : 'AbstractGsDevKitProgram', |
| 17 | + #instVars : [ |
| 18 | + 'installedProducts' |
| 19 | + ], |
| 20 | + #category : 'gsdevkit_launcher-Scripts' |
| 21 | +} |
| 22 | + |
| 23 | +{ #category : 'other' } |
| 24 | +GdkL_Products >> installedProducts [ |
| 25 | + "self new installedProducts" |
| 26 | + |
| 27 | + installedProducts |
| 28 | + ifNil: [ |
| 29 | + installedProducts := Dictionary new. |
| 30 | + self productsHome directories |
| 31 | + do: [ :productDir | |
| 32 | + | dirName | |
| 33 | + dirName := productDir basename. |
| 34 | + (dirName beginsWith: 'GemStone64Bit') |
| 35 | + ifTrue: [ |
| 36 | + | productVersion dashIndex | |
| 37 | + dashIndex := dirName indexOf: $-. |
| 38 | + productVersion := dirName copyFrom: 'GemStone64Bit' size + 1 to: dashIndex - 1. |
| 39 | + installedProducts at: productVersion put: productDir ] |
| 40 | + ifFalse: [ |
| 41 | + (dirName beginsWith: 'GemBuilderC') |
| 42 | + ifTrue: [ |
| 43 | + | productVersion dashIndex | |
| 44 | + dashIndex := dirName indexOf: $-. |
| 45 | + productVersion := dirName copyFrom: 'GemBuilderC' size + 1 to: dashIndex - 1. |
| 46 | + installedProducts at: productVersion put: productDir ] ] ] ]. |
| 47 | + ^ installedProducts |
| 48 | + |
| 49 | +] |
| 50 | + |
| 51 | +{ #category : 'other' } |
| 52 | +GdkL_Products >> installedProductsReportOn: stream [ |
| 53 | + stream |
| 54 | + nextPutAll: 'Installed Products:'; |
| 55 | + cr. |
| 56 | + self installedProducts keys sorted |
| 57 | + do: [ :gsVers | |
| 58 | + stream |
| 59 | + tab; |
| 60 | + nextPutAll: gsVers; |
| 61 | + cr ] |
| 62 | + |
| 63 | +] |
| 64 | + |
| 65 | +{ #category : 'other' } |
| 66 | +GdkL_Products >> main [ |
| 67 | + |
| 68 | + self installedProductsReportOn: self stdout |
| 69 | + |
| 70 | +] |
0 commit comments