|
| 1 | +#!/usr/bin/env superdoit_solo |
| 2 | +instvars |
| 3 | +operation |
| 4 | +% |
| 5 | +usage |
| 6 | +----- |
| 7 | +USAGE $basename [--help | -h] |
| 8 | + t2f2t.sh [--debug ] create <component-name> <project-root> <t2f2t-data-dir> <tonel-pkg-dir> <filetree-pkg-dir> |
| 9 | + |
| 10 | + t2f2t.sh [--debug ] filetree <t2f2t-data-dir-path> |
| 11 | + t2f2t.sh [--debug ] tonel <t2f2t-data-dir-path> |
| 12 | + |
| 13 | +DESCRIPTION |
| 14 | + Copy all of the packages from one package directory to another package |
| 15 | + directory, converting from/to filetree/tonel along the way. |
| 16 | + |
| 17 | + Leverages the https://github.com/GsDevKit/T2F2T-Conversion project. |
| 18 | + |
| 19 | + |
| 20 | +OPTIONS |
| 21 | + -h, --help display usage message |
| 22 | + -D, --debug bring up topaz debugger in the event of a script error |
| 23 | + |
| 24 | +EXAMPLES |
| 25 | + $basename --help |
| 26 | + $basename -h |
| 27 | + $basename --debug |
| 28 | + $basename -D |
| 29 | + |
| 30 | + $basename create SuperDoit $GS_HOME/shared/repos/superDoit packages/t2f2t packages/tonel packages/filetree |
| 31 | + $basename --debug create $GS_HOME/shared/repos/superDoit packages/t2f2t packages/tonel packages/filetree |
| 32 | + |
| 33 | + $basename filetree $GS_HOME/shared/repos/superDoit/packages/t2f2t |
| 34 | + $basename --debug filetree $GS_HOME/shared/repos/superDoit/t2f2t |
| 35 | + |
| 36 | + $basename tonel $GS_HOME/shared/repos/superDoit/packages/t2f2t |
| 37 | + $basename --debug tonel $GS_HOME/shared/repos/superDoit/t2f2t |
| 38 | + |
| 39 | +----- |
| 40 | +% |
| 41 | +projectshome |
| 42 | +$GS_HOME/shared/repos |
| 43 | +% |
| 44 | +specs |
| 45 | +[ |
| 46 | +RwLoadSpecificationV2 { |
| 47 | + #projectName : 'T2F2T-Conversion', |
| 48 | + #gitUrl : 'file:$ROWAN_PROJECTS_HOME/T2F2T-Conversion', |
| 49 | + #revision : 'gemstone', |
| 50 | + #projectSpecFile : 'rowan/tonel.ston', |
| 51 | + #componentNames : [ |
| 52 | + 'Core' |
| 53 | + ], |
| 54 | + #comment : 't2f2t load specification for tonel format packages' |
| 55 | +} |
| 56 | +] |
| 57 | +% |
| 58 | +method |
| 59 | +operation |
| 60 | + | posArgs | |
| 61 | + operation |
| 62 | + ifNil: [ |
| 63 | + operation := self positionalArgs at: 1. |
| 64 | + (#( 'create' 'filetree' 'tonel' ) |
| 65 | + includes: operation) ifFalse: [ self error: 'Unknown command ', operation printString ]. |
| 66 | + operation = 'create' |
| 67 | + ifTrue: [ |
| 68 | + (posArgs := self positionalArgs size) ~= 6 |
| 69 | + ifTrue: [ |
| 70 | + self error: 'Missing positional arguments for ', |
| 71 | + operation printString, |
| 72 | + ' command. Expected 6 got ', |
| 73 | + posArgs printString ]. |
| 74 | + ^ operation ]. |
| 75 | + (posArgs := self positionalArgs size) ~= 2 |
| 76 | + ifTrue: [ |
| 77 | + self error: 'Missing positional arguments for ', |
| 78 | + operation printString, |
| 79 | + ' command. Expected 2 got ', |
| 80 | + posArgs printString ] ]. |
| 81 | + ^ operation |
| 82 | +% |
| 83 | +method |
| 84 | +t2f2tPath |
| 85 | + ^ self positionalArgs at: 2 |
| 86 | +% |
| 87 | +method |
| 88 | +componentName |
| 89 | + ^ self positionalArgs at: 2 |
| 90 | +% |
| 91 | +method |
| 92 | +projectRootPath |
| 93 | + ^ self positionalArgs at: 3 |
| 94 | +% |
| 95 | +method |
| 96 | +createT2f2tPath |
| 97 | + ^ self positionalArgs at: 4 |
| 98 | +% |
| 99 | +method |
| 100 | +tonelPackagePath |
| 101 | + ^ self positionalArgs at: 5 |
| 102 | +% |
| 103 | +method |
| 104 | +filetreePackagePath |
| 105 | + ^ self positionalArgs at: 6 |
| 106 | +% |
| 107 | +doit |
| 108 | + | converter | |
| 109 | + self preDoitSpecLoad. "load the T2F2T-Conversion project from spec" |
| 110 | + converter := (self |
| 111 | + globalNamed: 'T2F2TConversion' |
| 112 | + ifAbsent: [ self error: 'T2F2TConversion class not loaded']) new. |
| 113 | + self operation = 'create' |
| 114 | + ifTrue: [ |
| 115 | + converter |
| 116 | + createForProject: self projectRootPath |
| 117 | + t2f2t: self createT2f2tPath |
| 118 | + tonel: self tonelPackagePath |
| 119 | + filetree: self filetreePackagePath |
| 120 | + projectName: 't2f2tMeta' |
| 121 | + componentName: self componentName |
| 122 | + packageConvention: 'Monticello' |
| 123 | + stdout: self stdout. |
| 124 | + ^ true ]. |
| 125 | + converter |
| 126 | + convertTo: self operation |
| 127 | + packagesUsing: self t2f2tPath |
| 128 | + stdout: self stdout. |
| 129 | + ^true |
| 130 | +% |
| 131 | + |
0 commit comments