-
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 pull request #137 from dalehenrich/issue_136
fix for Issue #136
- Loading branch information
Showing
31 changed files
with
229 additions
and
54 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
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
42 changes: 5 additions & 37 deletions
42
...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,39 +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 decodeFromUTF8. | ||
category := category copyFrom: 1 to: category size - 1. "remove newline" | ||
source := fileStream upToEnd decodeFromUTF8. | ||
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 |
41 changes: 41 additions & 0 deletions
41
...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,41 @@ | ||
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 decodeFromUTF8. | ||
category := category copyFrom: 1 to: category size - 1. "remove newline" | ||
source := fileStream upToEnd decodeFromUTF8. | ||
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 printString , ' in class ' , className printString | ||
, ' is inconsistent with the package name ' , prefix printString |
15 changes: 15 additions & 0 deletions
15
...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,15 @@ | ||
validation | ||
verifyCategory: categoryName matches: prefix | ||
"https://github.com/dalehenrich/filetree/issues/136" | ||
|
||
"copied from PackageInfo>>category:matches:" | ||
|
||
| prefixSize catSize | | ||
categoryName ifNil: [ ^ false ]. | ||
catSize := categoryName size. | ||
prefixSize := prefix size. | ||
catSize < prefixSize | ||
ifTrue: [ ^ false ]. | ||
(categoryName findString: prefix startingAt: 1 caseSensitive: false) = 1 | ||
ifFalse: [ ^ false ]. | ||
^ (categoryName at: prefix 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
2 changes: 1 addition & 1 deletion
2
repository/MonticelloFileTree-Core.package/monticello.meta/version
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
3 changes: 3 additions & 0 deletions
3
...celloFileTree-Tests.package/MCFileTreeIssue136Test.class/instance/tearDownPackagesList.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,3 @@ | ||
running | ||
tearDownPackagesList | ||
^ #('Issue136-1' 'Issue136-2') |
18 changes: 18 additions & 0 deletions
18
.../MonticelloFileTree-Tests.package/MCFileTreeIssue136Test.class/instance/testClassError.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,18 @@ | ||
tests | ||
testClassError | ||
| packageName gofer hitError description | | ||
packageName := 'Issue136-1'. | ||
{packageName} do: [ :pn | self deny: (self hasPackage: pn) ]. | ||
gofer := Gofer new | ||
disablePackageCache; | ||
repository: (self getTestRepository: 'issue136'); | ||
package: packageName; | ||
yourself. | ||
hitError := false. | ||
[ gofer load ] | ||
on: Error | ||
do: [ :ex | | ||
hitError := (description := ex description) | ||
endsWith: | ||
'Class category name ''Issue97'' for the class ''CypressMockIssue97'' is inconsistent with the package name ''Issue136-1''' ]. | ||
self assert: hitError description: description |
18 changes: 18 additions & 0 deletions
18
...oFileTree-Tests.package/MCFileTreeIssue136Test.class/instance/testExtensionMethodError.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,18 @@ | ||
tests | ||
testExtensionMethodError | ||
| packageName gofer hitError description | | ||
packageName := 'Issue136-2'. | ||
{packageName} do: [ :pn | self deny: (self hasPackage: pn) ]. | ||
gofer := Gofer new | ||
disablePackageCache; | ||
repository: (self getTestRepository: 'issue136'); | ||
package: packageName; | ||
yourself. | ||
hitError := false. | ||
[ gofer load ] | ||
on: Error | ||
do: [ :ex | | ||
hitError := (description := ex description) | ||
endsWith: | ||
'Method protocol ''*Issue97'' for the method ''isCypressMockIssue97'' in class ''Object'' is inconsistent with the package name ''*issue136-2''' ]. | ||
self assert: hitError description: description |
7 changes: 7 additions & 0 deletions
7
...itory/MonticelloFileTree-Tests.package/MCFileTreeIssue136Test.class/methodProperties.json
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,7 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"tearDownPackagesList" : "dkh 01/31/2015 07:31", | ||
"testClassError" : "dkh 01/31/2015 07:46", | ||
"testExtensionMethodError" : "dkh 01/31/2015 10:22" } } |
14 changes: 14 additions & 0 deletions
14
repository/MonticelloFileTree-Tests.package/MCFileTreeIssue136Test.class/properties.json
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,14 @@ | ||
{ | ||
"category" : "MonticelloFileTree-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "MCFileTreeIssue136Test", | ||
"pools" : [ | ||
], | ||
"super" : "MCFileTreeGenericLoaderTest", | ||
"type" : "normal" } |
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
2 changes: 1 addition & 1 deletion
2
repository/MonticelloFileTree-Tests.package/monticello.meta/version
Large diffs are not rendered by default.
Oops, something went wrong.
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,2 @@ | ||
{"packageExtension" : ".package", | ||
"propertyFileExtension" : ".json" } |
1 change: 1 addition & 0 deletions
1
...testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/README.md
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 @@ | ||
This mock contains basic class and instance method selectors |
3 changes: 3 additions & 0 deletions
3
...s/testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/class/current..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,3 @@ | ||
accessing | ||
current: anObject | ||
current := anObject |
3 changes: 3 additions & 0 deletions
3
tests/testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/class/current.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,3 @@ | ||
accessing | ||
current | ||
^current |
3 changes: 3 additions & 0 deletions
3
...testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/class/initialize.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,3 @@ | ||
initialization | ||
initialize | ||
self current: self new |
3 changes: 3 additions & 0 deletions
3
...s/testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/instance/extra.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,3 @@ | ||
accessing | ||
extra | ||
"extra method" |
4 changes: 4 additions & 0 deletions
4
...tRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/instance/initialize.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,4 @@ | ||
initialization | ||
initialize | ||
super initialize. | ||
self name: 'Unknown' |
3 changes: 3 additions & 0 deletions
3
...s/testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/instance/name..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,3 @@ | ||
accessing | ||
name: aString | ||
name := aString |
3 changes: 3 additions & 0 deletions
3
tests/testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/instance/name.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,3 @@ | ||
accessing | ||
name | ||
^name |
12 changes: 12 additions & 0 deletions
12
tests/testRepositories/issue136/Issue136-1.package/CypressMockIssue97.class/properties.json
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,12 @@ | ||
{ | ||
"category" : "Issue97", | ||
"classinstvars" : [ | ||
"current" ], | ||
"classvars" : [ | ||
"Something" ], | ||
"instvars" : [ | ||
"name" ], | ||
"name" : "CypressMockIssue97", | ||
"pools" : [ | ||
], | ||
"super" : "Object" } |
2 changes: 2 additions & 0 deletions
2
tests/testRepositories/issue136/Issue136-1.package/properties.json
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,2 @@ | ||
{ | ||
} |
4 changes: 4 additions & 0 deletions
4
...epositories/issue136/Issue136-2.package/Object.extension/instance/isCypressMockIssue97.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,4 @@ | ||
*Issue97 | ||
isCypressMockIssue97 | ||
|
||
^false |
2 changes: 2 additions & 0 deletions
2
tests/testRepositories/issue136/Issue136-2.package/Object.extension/properties.json
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,2 @@ | ||
{ | ||
"name" : "Object" } |
2 changes: 2 additions & 0 deletions
2
tests/testRepositories/issue136/Issue136-2.package/properties.json
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,2 @@ | ||
{ | ||
} |