-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pharo3.0_dev :: Issue #136 bugfix
- Loading branch information
Showing
50 changed files
with
481 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.package/monticello.meta/version merge=mcVersion | ||
*.package/*.class/methodProperties.json merge=mcMethodProperties | ||
|
38 changes: 23 additions & 15 deletions
38
...-Core.package/MCFileTreeStCypressReader.class/instance/addClassDefinitionFrom.comment..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
utilities | ||
addClassDefinitionFrom: classPropertiesDict comment: classComment | ||
definitions | ||
add: | ||
(MCClassDefinition | ||
name: (classPropertiesDict at: 'name') | ||
superclassName: (classPropertiesDict at: 'super') | ||
traitComposition: (classPropertiesDict at: 'traitcomposition' ifAbsent: [ '{}' ]) | ||
classTraitComposition: (classPropertiesDict at: 'classtraitcomposition' ifAbsent: [ '{}' ]) | ||
category: (classPropertiesDict at: 'category' ifAbsent: [ self packageNameFromPackageDirectory ]) | ||
instVarNames: (classPropertiesDict at: 'instvars' ifAbsent: [ #() ]) | ||
classVarNames: (classPropertiesDict at: 'classvars' ifAbsent: [ #() ]) | ||
poolDictionaryNames: (classPropertiesDict at: 'pools' ifAbsent: [ #() ]) | ||
classInstVarNames: (classPropertiesDict at: 'classinstvars' ifAbsent: [ #() ]) | ||
type: (classPropertiesDict at: 'type' ifAbsent: [ 'normal' ]) asSymbol | ||
comment: classComment | ||
commentStamp: (classPropertiesDict at: 'commentStamp' ifAbsent: [ '' ])) | ||
| categoryName className | | ||
className := classPropertiesDict at: 'name'. | ||
categoryName := classPropertiesDict | ||
at: 'category' | ||
ifAbsent: [ self packageNameFromPackageDirectory ]. | ||
self validateClassCategory: categoryName for: className. | ||
definitions | ||
add: | ||
(MCClassDefinition | ||
name: className | ||
superclassName: (classPropertiesDict at: 'super') | ||
traitComposition: (classPropertiesDict at: 'traitcomposition' ifAbsent: [ '{}' ]) | ||
classTraitComposition: (classPropertiesDict at: 'classtraitcomposition' ifAbsent: [ '{}' ]) | ||
category: categoryName | ||
instVarNames: (classPropertiesDict at: 'instvars' ifAbsent: [ #() ]) | ||
classVarNames: (classPropertiesDict at: 'classvars' ifAbsent: [ #() ]) | ||
poolDictionaryNames: (classPropertiesDict at: 'pools' ifAbsent: [ #() ]) | ||
classInstVarNames: | ||
(classPropertiesDict at: 'classinstvars' ifAbsent: [ #() ]) | ||
type: (classPropertiesDict at: 'type' ifAbsent: [ 'normal' ]) asSymbol | ||
comment: classComment | ||
commentStamp: (classPropertiesDict at: 'commentStamp' ifAbsent: [ '' ])) | ||
|
37 changes: 22 additions & 15 deletions
37
...FileTreeStCypressReader.class/instance/addExtensionClassAndMethodDefinitionsFromEntry..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
utilities | ||
addExtensionClassAndMethodDefinitionsFromEntry: classEntry | ||
| classDirectory classPropertiesDict methodPropertiesDict entries | | ||
classDirectory := self fileUtils directoryFromEntry: classEntry. | ||
((entries := classDirectory entries) detect: [ :entry | self isPropertyFile: entry] ifNone: [ ]) | ||
ifNotNil: [ :propertyEntry | propertyEntry readStreamDo: [ :fileStream | classPropertiesDict := MCFileTreeJsonParser parseStream: fileStream ] ]. | ||
methodPropertiesDict := Dictionary new. | ||
(entries detect: [ :entry | self isMethodPropertyFile: entry] ifNone: [ ]) | ||
ifNotNil: [ :propertyEntry | | ||
propertyEntry | ||
readStreamDo: [ :fileStream | | ||
"Issue 33: https://github.com/dalehenrich/filetree/issues/33" | ||
methodPropertiesDict := MCFileTreeJsonParser parseStream: fileStream ] ]. | ||
self | ||
addMethodDefinitionsForClass: (classPropertiesDict at: 'name') | ||
methodProperties: methodPropertiesDict | ||
in: entries | ||
| classDirectory classPropertiesDict methodPropertiesDict entries | | ||
classDirectory := self fileUtils directoryFromEntry: classEntry. | ||
((entries := classDirectory entries) | ||
detect: [ :entry | self isPropertyFile: entry ] | ||
ifNone: [ ]) | ||
ifNotNil: [ :propertyEntry | | ||
propertyEntry | ||
readStreamDo: [ :fileStream | | ||
classPropertiesDict := MCFileTreeJsonParser | ||
parseStream: fileStream ] ]. | ||
methodPropertiesDict := Dictionary new. | ||
(entries detect: [ :entry | self isMethodPropertyFile: entry ] ifNone: [ ]) | ||
ifNotNil: [ :propertyEntry | | ||
propertyEntry | ||
readStreamDo: [ :fileStream | | ||
"Issue 33: https://github.com/dalehenrich/filetree/issues/33" | ||
methodPropertiesDict := MCFileTreeJsonParser parseStream: fileStream ] ]. | ||
self | ||
addMethodDefinitionsForClass: (classPropertiesDict at: 'name') | ||
methodProperties: methodPropertiesDict | ||
in: entries | ||
extensionMethod: true |
38 changes: 5 additions & 33 deletions
38
...leTreeStCypressReader.class/instance/addMethodDefinitionsForClass.methodProperties.in..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,7 @@ | ||
utilities | ||
addMethodDefinitionsForClass: className methodProperties: methodProperties in: entries | ||
entries | ||
do: [ :entry | | ||
| classIsMeta | | ||
classIsMeta := false. | ||
entry name = 'class' | ||
ifTrue: [ classIsMeta := true ]. | ||
(entry name = 'instance' or: [ entry name = 'class' ]) | ||
ifTrue: [ | ||
((self fileUtils directoryFromEntry: entry) entries select: [ :each | each name endsWith: '.st' ]) | ||
do: [ :methodEntry | | ||
methodEntry | ||
readStreamDo: [ :fileStream | | ||
| category source timestamp selector | | ||
category := fileStream nextLine. | ||
source := fileStream upToEnd. | ||
selector := self methodSelectorFor: source. | ||
timestamp := methodProperties | ||
at: | ||
(classIsMeta | ||
ifTrue: [ 'class' ] | ||
ifFalse: [ 'instance' ]) | ||
ifPresent: [ :map | map at: selector asString ifAbsent: [ ] ]. "Issue 33: https://github.com/dalehenrich/filetree/issues/33" | ||
timestamp | ||
ifNil: [ timestamp := self info author , ' ' , self info date mmddyyyy , ' ' , self info time print24 ]. | ||
definitions | ||
add: | ||
(MCMethodDefinition | ||
className: className | ||
classIsMeta: classIsMeta | ||
selector: selector | ||
category: category | ||
timeStamp: timestamp | ||
source: source) ] ] ] ] | ||
^ self | ||
addMethodDefinitionsForClass: className | ||
methodProperties: methodProperties | ||
in: entries | ||
extensionMethod: false |
37 changes: 37 additions & 0 deletions
37
...eader.class/instance/addMethodDefinitionsForClass.methodProperties.in.extensionMethod..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
utilities | ||
addMethodDefinitionsForClass: className methodProperties: methodProperties in: entries extensionMethod: extensionMethod | ||
entries | ||
do: [ :entry | | ||
| classIsMeta | | ||
classIsMeta := false. | ||
entry name = 'class' | ||
ifTrue: [ classIsMeta := true ]. | ||
(entry name = 'instance' or: [ entry name = 'class' ]) | ||
ifTrue: [ | ||
((self fileUtils directoryFromEntry: entry) entries select: [ :each | each name endsWith: '.st' ]) | ||
do: [ :methodEntry | | ||
methodEntry | ||
readStreamDo: [ :fileStream | | ||
| category source timestamp selector | | ||
category := fileStream nextLine. | ||
source := fileStream upToEnd. | ||
selector := self methodSelectorFor: source. | ||
timestamp := methodProperties | ||
at: | ||
(classIsMeta | ||
ifTrue: [ 'class' ] | ||
ifFalse: [ 'instance' ]) | ||
ifPresent: [ :map | map at: selector asString ifAbsent: [ ] ]. "Issue 33: https://github.com/dalehenrich/filetree/issues/33" | ||
timestamp | ||
ifNil: [ timestamp := self info author , ' ' , self info date mmddyyyy , ' ' , self info time print24 ]. | ||
extensionMethod | ||
ifTrue: [ self validateExtensionMethodCategory: category for: className selector: selector ]. | ||
definitions | ||
add: | ||
(MCMethodDefinition | ||
className: className | ||
classIsMeta: classIsMeta | ||
selector: selector | ||
category: category | ||
timeStamp: timestamp | ||
source: source) ] ] ] ] |
15 changes: 15 additions & 0 deletions
15
...eTree-Core.package/MCFileTreeStCypressReader.class/instance/validateClassCategory.for..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
validation | ||
validateClassCategory: categoryName for: className | ||
"https://github.com/dalehenrich/filetree/issues/136" | ||
|
||
"class category must match the package name ... guard against manual editing mistakes" | ||
|
||
| prefix | | ||
prefix := self packageNameFromPackageDirectory. | ||
(self verifyCategory: categoryName matches: prefix) | ||
ifTrue: [ ^ self ]. | ||
self | ||
error: | ||
'Class category name ' , categoryName printString , ' for the class ' | ||
, className printString , ' is inconsistent with the package name ' | ||
, prefix printString |
24 changes: 24 additions & 0 deletions
24
...MCFileTreeStCypressReader.class/instance/validateExtensionMethodCategory.for.selector..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
validation | ||
validateExtensionMethodCategory: categoryName for: className selector: selector | ||
"https://github.com/dalehenrich/filetree/issues/136" | ||
|
||
"method category must match the package name for extension methods... guard against manual editing mistakes" | ||
|
||
"extracted from PackageInfo>>isForeignClassExtension:" | ||
|
||
| prefix prefixSize catSize | | ||
prefix := '*' , self packageNameFromPackageDirectory asLowercase. | ||
categoryName | ||
ifNotNil: [ | ||
(categoryName isEmpty not | ||
and: [ | ||
categoryName first = $* | ||
and: [ | ||
"asLowercase needed in GemStone 3.1.0.6?" | ||
self verifyCategory: categoryName asLowercase matches: prefix ] ]) | ||
ifTrue: [ ^ self ] ]. | ||
self | ||
error: | ||
'Method protocol ' , categoryName printString , ' for the method ' | ||
, selector asString printString , ' in class ' , className printString | ||
, ' is inconsistent with the package name ' , prefix printString |
21 changes: 21 additions & 0 deletions
21
...FileTree-Core.package/MCFileTreeStCypressReader.class/instance/verifyCategory.matches..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
validation | ||
verifyCategory: categoryName matches: basicPackageName | ||
"https://github.com/dalehenrich/filetree/issues/136" | ||
|
||
"copied from PackageInfo>>category:matches: and GoferVersionReference>>parseName:" | ||
|
||
| prefixSize catSize packagePrefix | | ||
categoryName ifNil: [ ^ false ]. | ||
packagePrefix := basicPackageName. | ||
(packagePrefix includes: $.) | ||
ifTrue: [ | ||
"exclude branch name" | ||
packagePrefix := packagePrefix copyUpTo: $. ]. | ||
catSize := categoryName size. | ||
prefixSize := packagePrefix size. | ||
catSize < prefixSize | ||
ifTrue: [ ^ false ]. | ||
(categoryName findString: packagePrefix startingAt: 1 caseSensitive: false) | ||
= 1 | ||
ifFalse: [ ^ false ]. | ||
^ (categoryName at: packagePrefix size + 1 ifAbsent: [ ^ true ]) = $- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.