diff --git a/README.md b/README.md index ad62364..1135b68 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,8 @@ You can load individual Tonel packages as Applications or export VAST Applicatio ![Application Manager](docs/img/application-manager.png) +When loading apps using this GUI the _loader_ will attempt to detect whether the files are in a Git repository, and if a git repository is detected it will configure itself to use [git versioning](docs/strategies.md), otherwise it will use the default settings (or leave all editions open without version). + #### Configuration Maps You can also export and load Configuration Maps together with their applications from the Configuration Maps Browser. diff --git a/docs/strategies.md b/docs/strategies.md index f2842fb..be8d9fd 100644 --- a/docs/strategies.md +++ b/docs/strategies.md @@ -17,11 +17,11 @@ The _loader_ will instantiate a separate `TonelApplicationLoader` (aka _applicat When loading an `Application` the _loader_ will read it's prerequisites from the `vaPrerequisites` metadata in the `.package` file, but there could be the case where you need to specify some other prerequisite at load time. -### `TonelLoaderInteractivePrereqStrategy` (interactive, default) +### `TonelLoaderInteractivePrereqStrategy` (interactive) This strategy will display an `EtPrerequisiteCollectingPrompter` enabling the user to add/remove prerequisites before loading the application -### `TonelLoaderComputedPrerequisitesStrategy` (unattended) +### `TonelLoaderComputedPrerequisitesStrategy` (unattended, default) This strategy uses the prequisites specified in the metadata plus the ones computed by the loader. @@ -34,7 +34,7 @@ aTonelLoader useComputedPrerequisites The version strategy handles both the versioning, and also the creation of editions prior to versioning. -### `TonelLoaderInteractiveVersionStrategy` (interactive, default) +### `TonelLoaderInteractiveVersionStrategy` (interactive) This will prompt the user to specify a version name _for each application_ using the default version name prompter, leaving the option to not define any, and so only the edition will be created, but without versioning it. @@ -43,7 +43,7 @@ This will prompt the user to specify a version name _for each application_ using aTonelLoader useInteractiveVersioning ``` -### `TonelLoaderNoVersionStrategy` (unattended) +### `TonelLoaderNoVersionStrategy` (unattended, default) This strategy will create an new edition but won't version it. It is useful when you are developing and want to control manually the versioning and/or don't want to version at all. @@ -104,12 +104,12 @@ When loading the base edition, the application might need to load its prerequisi You can also specify whether the lookup of base editions will lookup only for versioned editions, to avoid selecting an edition that might be a draft or broken but that it is more recent than the latest "valid" edition (usually a versioned one). -### `TonelLoaderInteractiveBaseEditionStrategy` (interactive, default) +### `TonelLoaderInteractiveBaseEditionStrategy` (interactive) This is the default strategy, that will display a list of base editions to choose, and prompt the user to select one from the list. -### `TonelLoaderLatestBaseEditionStrategy` (unattended) +### `TonelLoaderLatestBaseEditionStrategy` (unattended, default) This will automatically select the latest (newest) edition as the base edition for the App/Subapp being loaded. diff --git a/envy/Tonel.dat b/envy/Tonel.dat index 88ffce3..8e21e84 100755 Binary files a/envy/Tonel.dat and b/envy/Tonel.dat differ diff --git a/source/.configmaps b/source/.configmaps index 3c055b2..c9d77a9 100644 --- a/source/.configmaps +++ b/source/.configmaps @@ -12,7 +12,7 @@ ] } ], - #ts : 3767954973, + #ts : 3768234608, #comment : '', #formatVersion : '1.1', #applications : OrderedCollection [ @@ -33,8 +33,8 @@ }, { #name : 'TonelLoaderModel', - #versionName : '1.68', - #ts : 3767947668 + #versionName : '1.69', + #ts : 3768231942 }, { #name : 'TonelReaderModel', @@ -43,8 +43,8 @@ }, { #name : 'TonelTools', - #versionName : '1.14', - #ts : 3767953884 + #versionName : '1.15', + #ts : 3768231806 }, { #name : 'TonelWriterModel', @@ -53,7 +53,7 @@ } ], #name : 'Tonel', - #versionName : '1.63' + #versionName : '1.64' }, { #conditions : [ @@ -62,8 +62,8 @@ #requiredMaps : [ { #name : 'Tonel', - #versionName : '1.63', - #ts : 3767954973 + #versionName : '1.64', + #ts : 3768234608 }, { #name : 'z.ST: SUnit', @@ -73,7 +73,7 @@ ] } ], - #ts : 3767954994, + #ts : 3768234611, #comment : '', #formatVersion : '1.1', #applications : OrderedCollection [ @@ -94,6 +94,6 @@ } ], #name : 'Test Tonel', - #versionName : '1.14' + #versionName : '1.15' } ] \ No newline at end of file diff --git a/source/TonelLoaderModel/TonelLoader.class.st b/source/TonelLoaderModel/TonelLoader.class.st index ff28ae5..f294526 100644 --- a/source/TonelLoaderModel/TonelLoader.class.st +++ b/source/TonelLoaderModel/TonelLoader.class.st @@ -171,14 +171,6 @@ TonelLoader >> forceCreationOfEditions [ self versionStrategy alwaysCreateEditions: true ] -{ #category : 'initializing', - #vaVisibility : 'private' } -TonelLoader >> initialize [ - super initialize. - self beInteractive. - self useDefaultNaming -] - { #category : 'initializing', #vaVisibility : 'private' } TonelLoader >> initializeApplications [ diff --git a/source/TonelLoaderModel/TonelLoaderSettings.class.st b/source/TonelLoaderModel/TonelLoaderSettings.class.st index 925d82f..7593e7d 100644 --- a/source/TonelLoaderModel/TonelLoaderSettings.class.st +++ b/source/TonelLoaderModel/TonelLoaderSettings.class.st @@ -53,7 +53,7 @@ TonelLoaderSettings >> appSuperGroupSetting: superGroup [ { #category : 'strategies' } TonelLoaderSettings >> baseEditionStrategy [ - ^self strategyAt: #baseEdition ifAbsentPut: [TonelLoaderInteractiveBaseEditionStrategy new] + ^self strategyAt: #baseEdition ifAbsentPut: [TonelLoaderLatestBaseEditionStrategy new] ] { #category : 'strategies' } @@ -148,7 +148,7 @@ TonelLoaderSettings >> postCopy [ { #category : 'strategies' } TonelLoaderSettings >> prerequisitesStrategy [ - ^self strategyAt: #prerequisites ifAbsentPut: [TonelLoaderInteractivePrereqStrategy new] + ^self strategyAt: #prerequisites ifAbsentPut: [TonelLoaderComputedPrerequisitesStrategy new] ] { #category : 'strategies' } @@ -171,6 +171,13 @@ TonelLoaderSettings >> strategyAt: aSymbol [ ^self strategies at: aSymbol ] +{ #category : 'strategies', + #vaVisibility : 'private' } +TonelLoaderSettings >> strategyAt: aSymbol ifAbsent: aBlock [ + + ^self strategies at: aSymbol ifAbsent: aBlock +] + { #category : 'strategies', #vaVisibility : 'private' } TonelLoaderSettings >> strategyAt: aSymbol ifAbsentPut: anObject [ @@ -188,7 +195,7 @@ TonelLoaderSettings >> strategyAt: aSymbol put: anObject [ { #category : 'strategies' } TonelLoaderSettings >> versionStrategy [ - ^self strategyAt: #version ifAbsentPut: [TonelLoaderInteractiveVersionStrategy new] + ^self strategyAt: #version ifAbsentPut: [TonelLoaderNoVersionStrategy new] ] { #category : 'strategies' } diff --git a/source/TonelTools/TonelTools.class.st b/source/TonelTools/TonelTools.class.st index a233a54..cc6ecf6 100644 --- a/source/TonelTools/TonelTools.class.st +++ b/source/TonelTools/TonelTools.class.st @@ -89,7 +89,7 @@ TonelTools class >> exportConfigurationMapsNames: anOrderedCollection [ { #category : 'operations' } TonelTools class >> exportTonelApplications: aCollection [ - | selectedApps repositoryPath convertPools clearSources | + | selectedApps repositoryPath clearSources | selectedApps := (CwListSelectionPrompter new) title: TonelMsg27; messageString: TonelMsg28; @@ -108,11 +108,10 @@ TonelTools class >> exportTonelApplications: aCollection [ at: System cursorPosition save: true) ifNil: [^self] ifNotNil: [:string | repositoryPath := (CfsPath named: string) directory]. "$NLS$ Select target path" "$NON-NLS$" - convertPools := self promptPoolConversion. + clearSources := self promptClearSources. (TonelWriter new) applications: selectedApps; - convertsSharedPools: convertPools; clearsSourcesDirectory: clearSources; writeProjectInto: repositoryPath ] @@ -133,81 +132,42 @@ TonelTools class >> exportTonelTools [ TonelTools class >> loadTonelApplications [ "Enter the new method definition below and click 'Resume'." - | reader loader repositoryPath selectedApps versionStrategyClass | - - (EtFileNamePrompter - promptForFileName: TonelMsg12 "$NLS$ Select Tonel repository path" + | reader loader repositoryPath selectedApps | + (EtFileNamePrompter + promptForFileName: TonelMsg12 default: '.project' - at: System cursorPosition) - ifNil: [^self] - ifNotNil: [:string | repositoryPath := (CfsPath named: string) directory]. + at: System cursorPosition) ifNil: [^self] + ifNotNil: [:string | repositoryPath := (CfsPath named: string) directory]. "$NLS$ Select Tonel repository path" reader := TonelReader new. - (repositoryPath exists and: [(reader computeSourcesDirectoryFrom: repositoryPath) exists]) - ifFalse: [ - self halt: TonelMsg14 "$NLS$ The selected Tonel repository does not contain a valid sources directory.". - ^self]. - + (repositoryPath exists + and: [(reader computeSourcesDirectoryFrom: repositoryPath) exists]) + ifFalse: + [self halt: TonelMsg14. "$NLS$ The selected Tonel repository does not contain a valid sources directory." + ^self]. reader readFrom: repositoryPath. loader := TonelLoader on: reader. - selectedApps := - CwListSelectionPrompter new - title: TonelMsg15 "$NLS$ Select Tonel Packages to be imported as VAST Applications"; - messageString: TonelMsg21 "$NLS$ The following Tonel Packages will be imported as VAST Applications"; - labelString: TonelMsg22 "$NLS$ Available Tonel Packages"; - selectedLabelString: TonelMsg23 "$NLS$ Selected Tonel Packages"; - items: (loader applications asSortedCollection: [:a :b | a name <= b name]); - selectedItems: #(); - selectionPolicy: CwConstants::XmEXTENDEDSELECT; - printBlock: [:app | app name]; - selectedPrintBlock: [:app | app name]; - prompt. - + selectedApps := (CwListSelectionPrompter new) + title: TonelMsg15; + messageString: TonelMsg21; + labelString: TonelMsg22; + selectedLabelString: TonelMsg23; + items: (loader applications asSortedCollection: [:a :b | a name <= b name]); + selectedItems: #(); + selectionPolicy: CwConstants::XmEXTENDEDSELECT; + printBlock: [:app | app name]; + selectedPrintBlock: [:app | app name]; + prompt. "$NLS$ Select Tonel Packages to be imported as VAST Applications" "$NLS$ The following Tonel Packages will be imported as VAST Applications" "$NLS$ Available Tonel Packages" "$NLS$ Selected Tonel Packages" selectedApps isEmptyOrNil ifTrue: [^self]. - - loader applications isEmpty - ifTrue: [ - self halt: TonelMsg25 "$NLS$ The selected Tonel repository is not valid or does not contain any package.'.". + loader applications isEmpty + ifTrue: + [self halt: TonelMsg25. "$NLS$ The selected Tonel repository is not valid or does not contain any package.'." ^self]. - - versionStrategyClass := - CwListPrompter new - title: 'Select the versioning strategy'; - messageString: 'Select how you want to version the Applications and classes loaded'; - labelString: 'Available versioning strategies'; - items: (TonelLoaderVersionStrategy allSubclasses); - selectedItems: (Array with: TonelLoaderInteractiveVersionStrategy); - selectionPolicy: CwConstants::XmSINGLESELECT; - printBlock: [:app | app description]; - prompt. - - versionStrategyClass ifNil: [ ^self]. - - loader versionStrategy: (versionStrategyClass for: loader). - loader versionStrategy isSpecific ifTrue: [ - | versionName | - versionName := (CwTextPrompter - prompt: 'Enter the version name you want to use for the loaded components' - answer: '' - title: 'Enter version name'). - versionName isEmpty - ifTrue: [^self] - ifFalse: [loader versionStrategy versionName: versionName] - ]. - - ((CwMessagePrompter new) - iconType: CwConstants::XmICONQUESTION; - title: 'Confirm the forced creation of editions'; - buttonType: CwConstants::XmYESNOCANCEL; - messageString: 'Do you want to create editions even for Applications and classes without changes?'; - prompt) ifNil: [^self] - ifNotNil: [:answer | - loader versionStrategy alwaysCreateEditions: answer - ]. - - - loader loadApplications: selectedApps - + "If the default version strategy is not git, we check whether the files are in a git repository to enable git versioning by default." + self setVersionStrategyOf: loader. + (loader loadApplications: selectedApps) notEmpty ifTrue: [ + System image message: 'Load of Tonel Applications completed.' + ] ] { #category : 'operations' } @@ -232,63 +192,26 @@ TonelTools class >> loadTonelConfigMaps [ selectedMaps := CwListSelectionPrompter new title: 'Select Configuration Maps to be loaded.'; - messageString: 'The following ConfigurationMaps will be imported and loaded with all its applications and required maps'; + messageString: + 'The following ConfigurationMaps will be imported and loaded with all its applications and required maps'; labelString: 'Configuration Maps in this repository'; selectedLabelString: 'Selected Configuration Maps'; items: (loader configurationMaps asSortedCollection: [:a :b | a name <= b name]); selectedItems: #(); selectionPolicy: CwConstants::XmEXTENDEDSELECT; - printBlock: [:app | app name, ' ', app versionName]; + printBlock: [:app | app name , ' ' , app versionName]; selectedPrintBlock: [:app | app name]; prompt. selectedMaps isEmptyOrNil ifTrue: [^self]. - loader applications isEmpty + loader configurationMaps isEmpty ifTrue: [ - self halt: TonelMsg25 "$NLS$ The selected Tonel repository is not valid or does not contain any package.'.". + self halt: + 'The selected Tonel repository is not valid or does not contain any configuration map.'. ^self]. - - versionStrategyClass := - CwListPrompter new - title: 'Select the versioning strategy'; - messageString: 'Select how you want to version the Applications and classes loaded'; - labelString: 'Available versioning strategies'; - items: (TonelLoaderVersionStrategy allSubclasses); - selectedItems: (Array with: TonelLoaderInteractiveVersionStrategy); - selectionPolicy: CwConstants::XmSINGLESELECT; - printBlock: [:app | app description]; - prompt. - - versionStrategyClass ifNil: [ ^self]. - - loader versionStrategy: (versionStrategyClass for: loader). - loader versionStrategy isSpecific ifTrue: [ - | versionName | - versionName := (CwTextPrompter - prompt: 'Enter the version name you want to use for the loaded components' - answer: '' - title: 'Enter version name'). - versionName isEmpty - ifTrue: [^self] - ifFalse: [loader versionStrategy versionName: versionName] - ]. - - loader versionStrategy class isGit ifTrue: [ - loader baseEditionStrategy: (TonelLoaderGitParentBaseEditionStrategy for: loader) - ]. - - ((CwMessagePrompter new) - iconType: CwConstants::XmICONQUESTION; - title: 'Confirm the forced creation of editions'; - buttonType: CwConstants::XmYESNOCANCEL; - messageString: 'Do you want to create editions even for Applications and classes without changes?'; - prompt) ifNil: [^self] - ifNotNil: [:answer | - loader versionStrategy alwaysCreateEditions: answer - ]. - - + + self setVersionStrategyOf: loader. loader loadConfigurationMaps: selectedMaps @@ -339,6 +262,17 @@ TonelTools class >> promptConfigurationMapsVersionsFrom: anOrderedCollection [ prompt ] +{ #category : 'prompting', + #vaVisibility : 'private' } +TonelTools class >> promptForcedCreationOfEditions [ + ^(CwMessagePrompter new) + iconType: CwConstants::XmICONQUESTION; + title: 'Confirm the forced creation of editions'; + buttonType: CwConstants::XmYESNOCANCEL; + messageString: 'Do you want to create editions even for Applications and classes without changes?'; + prompt +] + { #category : 'prompting', #vaVisibility : 'private' } TonelTools class >> promptPoolConversion [ @@ -357,3 +291,14 @@ TonelTools class >> promptRepositoryPath [ at: System cursorPosition save: true "$NLS$ Select target path" "$NON-NLS$" ] + +{ #category : 'operations', + #vaVisibility : 'private' } +TonelTools class >> setVersionStrategyOf: loader [ + + loader versionStrategy class isGit + ifFalse: + [([(TonelLoaderGitVersionStrategy for: loader) attemptVersionFromGit] + on: TonelLoaderError + do: [:ex | ex return]) ifNotNil: [loader useGitVersion]] "If the default version strategy is not git, we check whether the files are in a git repository to enable git versioning by default." +]