Skip to content

Commit

Permalink
Fixes #96 & #97
Browse files Browse the repository at this point in the history
  • Loading branch information
eMaringolo committed Aug 6, 2021
1 parent db770c6 commit 0b6b3b5
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 55 deletions.
8 changes: 8 additions & 0 deletions docs/strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,15 @@ writer writeENVYApps: false.

By default the writer is configured to write the ENVY app/subapps, so if that's your intention you don't have to do anything special.

### Identifiers
Tonel, the file format, has a loose specification, and in some dialects it uses Symbols for its identifiers and in others it uses Strings because in not all the dialects aString = aSymbol.

So to avoid having file differences when working on code that share a common repository you can configure the `TonelWriter` to use Symbols or Strings for its identifiers.

```smalltalk
writer := TonelWriter new.
writer identifiersClass: Symbol.
```


# Common recipes
Expand Down
36 changes: 18 additions & 18 deletions source/.configmaps
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
[
{
#conditions : [ ],
#ts : 3803117976,
#ts : 3805717748,
#comment : '',
#formatVersion : '1.1',
#applications : OrderedCollection [
{
#name : 'TonelBaseApp',
#versionName : 'strategies-1',
#ts : 3799672335
#versionName : '1.4.1',
#ts : 3805719868
},
{
#name : 'TonelFileSystem',
#versionName : 'strategies-1',
#ts : 3799672335
#versionName : '1.4.1',
#ts : 3805719868
},
{
#name : 'TonelLoaderInteractiveApp',
#versionName : 'strategies-12',
#ts : 3803046368
#versionName : '1.4.1',
#ts : 3805719868
},
{
#name : 'TonelLoaderModel',
#versionName : 'strategies-20',
#ts : 3803114237
#versionName : '1.4.1',
#ts : 3805718485
},
{
#name : 'TonelReaderModel',
#versionName : 'strategies-4',
#ts : 3802938109
#versionName : '1.4.1',
#ts : 3805719868
},
{
#name : 'TonelTools',
#versionName : 'strategies-3',
#ts : 3803040336
#versionName : '1.4.1',
#ts : 3805719674
},
{
#name : 'TonelWriterModel',
#versionName : 'strategies-3',
#ts : 3800169522
#versionName : '1.4.1',
#ts : 3805719868
}
],
#name : 'ENVY/Image Tonel',
#versionName : '2021/07/07 B'
#versionName : '1.4.1'
},
{
#conditions : [ ],
#ts : 3788500635,
#ts : 3805719946,
#comment : '',
#formatVersion : '1.1',
#applications : OrderedCollection [
Expand All @@ -72,6 +72,6 @@
}
],
#name : 'Test ENVY/Image Tonel',
#versionName : 'V 10.0.0 [480]'
#versionName : ''
}
]
7 changes: 3 additions & 4 deletions source/TonelLoaderModel/TonelLoader.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ TonelLoader >> autogenerateInstanceInitializers [
"Answer whether receiver will create class side instance creation methods that send #initialize to
its newly created instances."

^autogenerateInstanceInitializers
^autogenerateInstanceInitializers ifNil: [false]
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -168,8 +168,7 @@ TonelLoader >> checkRepositoryContents [
[self error: 'The selected directory does not contain any Tonel Package']
]

{ #category : 'accessing',
#vaVisibility : 'private' }
{ #category : 'accessing' }
TonelLoader >> computeSettings [
^self class settings copyFor: self
]
Expand Down Expand Up @@ -221,7 +220,7 @@ TonelLoader >> createReaderForRepository: directoryPath [

{ #category : 'accessing' }
TonelLoader >> createsHookMethods [
^createsHookMethods
^createsHookMethods ifNil: [false]
]

{ #category : 'accessing' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TonelLoaderApplicationPrereqStrategy >> concretePrerequisitesOf: aTonelApplicati

{ #category : 'accessing' }
TonelLoaderApplicationPrereqStrategy >> fixesMismatchs [
^fixesMismatchs
^fixesMismatchs ifNil: [false]
]

{ #category : 'accessing' }
Expand Down
1 change: 0 additions & 1 deletion source/TonelTools/TonelTools.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ TonelTools class >> exportConfigurationMapsNames: anOrderedCollection [

{ #category : 'operations' }
TonelTools class >> exportTonelApplications: aCollection [
"The following source failed to compile (all double quotes have been doubled):"

| selectedApps repositoryPath clearSources |

Expand Down
13 changes: 10 additions & 3 deletions source/TonelWriterModel/TonelArtifactWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ Class {
#category : 'TonelWriterModel'
}

{ #category : 'Not categorized' }
{ #category : 'instance-creation' }
TonelArtifactWriter class >> on: aFileSystem directory: aPath lineDelimiter: aLineDelimiter in: aTonelWriter [
^self new

^(self new)
fileSystem: aFileSystem;
directory: aPath;
lineDelimiter: aLineDelimiter;
parent: aTonelWriter;
yourself
]

{ #category : 'utility',
#vaVisibility : 'private' }
TonelArtifactWriter >> convertIdentifier: className [

^self parent convertIdentifier: className
]

{ #category : 'testing' }
TonelArtifactWriter >> convertsSharedPools [

Expand Down
2 changes: 1 addition & 1 deletion source/TonelWriterModel/TonelClassExtensionWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TonelClassExtensionWriter >> writeClassMethodsOf: aClassExtensionDefinition on:
TonelClassExtensionWriter >> writeDefinitionOf: aClassExtensionDefinition on: aWriteStream [

aWriteStream << 'Extension {' << lineDelimiter << Character tab << '#name : ' <<
aClassExtensionDefinition extendedClassName asString printString << lineDelimiter << '}' <<
(self convertIdentifier: aClassExtensionDefinition extendedClassName) << lineDelimiter << '}' <<
lineDelimiter
]

Expand Down
15 changes: 9 additions & 6 deletions source/TonelWriterModel/TonelClassWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ TonelClassWriter >> writeCategoryOf: aClassDefinition on: aWriteStream [
aWriteStream
nextPutAll: lineDelimiter;
tab;
nextPutAll: ('#category : <1p>' expandMacrosWith: aClassDefinition category)
nextPutAll: ('#category : <1s>' expandMacrosWith: (aClassDefinition category storeString))
]

{ #category : 'writing',
Expand Down Expand Up @@ -135,12 +135,14 @@ TonelClassWriter >> writeNameAndSuperclassOf: aClassDefinition on: aWriteStream

aWriteStream
tab;
nextPutAll: ('#name : <1p>,' expandMacrosWith: aClassDefinition definedClassName asString);
nextPutAll: (
'#name : <1s>,'
expandMacrosWith: (self convertIdentifier: aClassDefinition definedClassName));
nextPutAll: lineDelimiter;
tab;
nextPutAll: (
'#superclass : <1p>,'
expandMacrosWith: aClassDefinition definedClassSuperclassName asString)
'#superclass : <1s>,' expandMacrosWith:
(self convertIdentifier: aClassDefinition definedClassSuperclassName))
]

{ #category : 'writing',
Expand All @@ -152,8 +154,9 @@ TonelClassWriter >> writeSubclassTypeOf: aClassDefinition on: aWriteStream [
aWriteStream
nextPutAll: lineDelimiter;
tab;
nextPutAll:
('#type : <1p>,' expandMacrosWith: aClassDefinition subclassType asString)]
nextPutAll: (
'#type : <1s>,'
expandMacrosWith: (self convertIdentifier: aClassDefinition subclassType))]
]

{ #category : 'writing',
Expand Down
13 changes: 10 additions & 3 deletions source/TonelWriterModel/TonelMethodWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ TonelMethodWriter class >> new [
^super new initialize
]

{ #category : 'utility',
#vaVisibility : 'private' }
TonelMethodWriter >> convertIdentifier: aString [

^self parent convertIdentifier: aString
]

{ #category : 'initializing',
#vaVisibility : 'private' }
TonelMethodWriter >> initializeIn: aTonelWriter [
Expand All @@ -43,7 +50,7 @@ TonelMethodWriter >> normalizeMethodBody: aBodyString [
^normalized
]

{ #category : 'Not categorized' }
{ #category : 'public' }
TonelMethodWriter >> parent [
"Answer the parent TonelWriter of receiver."

Expand Down Expand Up @@ -77,7 +84,7 @@ TonelMethodWriter >> write: aMethodDefinition on: aWriteStream [
#vaVisibility : 'private' }
TonelMethodWriter >> writeCategoryOf: aMethodDefinition on: aWriteStream [

aWriteStream << space << '#category : ' << aMethodDefinition category storeString
aWriteStream << space << '#category : ' << (self convertIdentifier: aMethodDefinition category)
]

{ #category : 'writing',
Expand All @@ -92,7 +99,7 @@ TonelMethodWriter >> writeVACategoriesOf: aMethodDefinition on: aWriteStream [
categories := aMethodDefinition allCategories asSortedCollection.
aWriteStream nextPut: $[.
categories
do: [:each | aWriteStream nextPutAll: each printString]
do: [:each | aWriteStream nextPutAll: (self convertIdentifier: each)]
separatedBy: [aWriteStream nextPut: $,].
aWriteStream nextPut: $]]

Expand Down
Loading

0 comments on commit 0b6b3b5

Please sign in to comment.