Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Sep 17, 2023
1 parent 1a72952 commit 19f7b03
Show file tree
Hide file tree
Showing 19 changed files with 342 additions and 314 deletions.
2 changes: 1 addition & 1 deletion src/Monticello-Tests/MCStWriterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ MCMethodDeclaration className: #MCMockClassD selector: #one category: #''''as ye

{ #category : 'data' }
MCStWriterTest >> expectedOrganizationDefinition [
^ 'SystemOrganization addCategory: #MonticelloMocks!
^ 'self packageOrganizer ensurePackage: #MonticelloMocks withTags: #()!
'
]

Expand Down
4 changes: 2 additions & 2 deletions src/Monticello/MCOrganizationParser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ MCOrganizationParser >> addDefinitionsTo: aCollection [

tokens := source parseLiterals.

packageName := (tokens at: 7) at: 4.
tags := tokens at: 1.
packageName := tokens at: 4.
tags := tokens at: 6.

definition
packageName: packageName;
Expand Down
6 changes: 3 additions & 3 deletions src/Monticello/MCStWriter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ MCStWriter >> writeMethodSource: definition [
MCStWriter >> writePackage: packageName tags: aCollection [
stream
nextChunkPut: ('{1} do: [ :tag | (self packageOrganizer ensurePackage: #{2}) ensureTag: tag ]' format: {
aCollection printString.
packageName });
nextChunkPut: ('self packageOrganizer ensurePackage: #{1} withTags: {2}' format: {
packageName.
aCollection printString });
cr
]
Expand Down
30 changes: 15 additions & 15 deletions src/RPackage-Core/ClassDescription.extension.st
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
Extension { #name : #ClassDescription }
Extension { #name : 'ClassDescription' }

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> definedSelectors [
^ self package definedSelectorsForClass: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> extendingPackages [
"the extending packages of a class are the packages that extend it."

^ self packageOrganizer extendingPackagesOf: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> extensionSelectors [
^ self extendingPackages flatCollect: [ :each | each extensionSelectorsForClass: self ]
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> isDefinedInPackage: aPackage [
"returns true if aPackage contains the definitino of this class"

^ aPackage includesClass: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> isExtended [

^ self extendingPackages isEmpty
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> isExtendedInPackage: aPackage [
"returns true if aPackage defines an extension to this class"
^ aPackage extendsClass: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> package [

^ self packageOrganizer packageOf: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> packageFromOrganizer: anOrganizer [
"returns the package that defines this class"
^ anOrganizer packageOf: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> packageName [

^ self package ifNotNil: [ :package | package name ]
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> packageTag [
"Package tags are sub categories of packages to have a better organization of the packages."

^ self package tagOf: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> packageTag: aSymbol [

self flag: #package. "In the future this method should work with a real package tag also."
(self package ensureTag: aSymbol) addClass: self
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> packageTagName [
"Package tags are sub categories of packages to have a better organization of the packages. I return the name of my package tag or nil if the class is uncategorized."

^ self packageTag ifNotNil: [ :tag | tag name ]
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> packages [
"the extending packages of a class are the packages that extend it."

^ self extendingPackages asSet copy add: self package; yourself
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
ClassDescription >> removePackageTag [

self packageTag isRoot ifTrue: [ "Cannot remove root tag" ^ self ].
Expand Down
6 changes: 3 additions & 3 deletions src/RPackage-Core/CompiledCode.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #CompiledCode }
Extension { #name : 'CompiledCode' }

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
CompiledCode >> extensionPackage [
"Private method - Do not use it if you don't know what to do.
In case I am in an extension, I return the package containing me. Else return nil."
Expand All @@ -14,7 +14,7 @@ CompiledCode >> extensionPackage [
ifNone: [ nil ]
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
CompiledCode >> package [
"This method returns the package this method belongs to. It takes into account classes and traits.
If the method is in no package, returns nil"
Expand Down
10 changes: 5 additions & 5 deletions src/RPackage-Core/CompiledMethod.extension.st
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Extension { #name : #CompiledMethod }
Extension { #name : 'CompiledMethod' }

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
CompiledMethod >> isDefinedInPackage: anRPackage [
^ anRPackage includesDefinedSelector: self selector ofClass: self methodClass
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
CompiledMethod >> isExtension [
"I return true if a method is an extension method. Which means that the methods is not packaged in the package of the class containing the method, but in another package."

Expand All @@ -16,12 +16,12 @@ CompiledMethod >> isExtension [
^ self extensionPackage isNotNil
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
CompiledMethod >> isExtensionInPackage: anRPackage [
^ anRPackage includesExtensionSelector: self selector ofClass: self methodClass
]

{ #category : #'*RPackage-Core' }
{ #category : '*RPackage-Core' }
CompiledMethod >> removeFromPackage [

self isFromTrait ifFalse: [ self package ifNotNil: [ :package | package removeMethod: self ] ]
Expand Down
10 changes: 6 additions & 4 deletions src/RPackage-Core/ManifestRPackageCore.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
Manifest for RPackage-Core
"
Class {
#name : #ManifestRPackageCore,
#superclass : #PackageManifest,
#category : #'RPackage-Core-Manifest'
#name : 'ManifestRPackageCore',
#superclass : 'PackageManifest',
#category : 'RPackage-Core-Manifest',
#package : 'RPackage-Core',
#tag : 'Manifest'
}

{ #category : #'meta-data - dependency analyser' }
{ #category : 'meta-data - dependency analyser' }
ManifestRPackageCore class >> manuallyResolvedDependencies [

<ignoreForCoverage>
Expand Down
10 changes: 6 additions & 4 deletions src/RPackage-Core/PackageAdded.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
I am a public announcement sent when a new RPackage is created
"
Class {
#name : #PackageAdded,
#superclass : #PackageAnnouncement,
#category : #'RPackage-Core-Announcements'
#name : 'PackageAdded',
#superclass : 'PackageAnnouncement',
#category : 'RPackage-Core-Announcements',
#package : 'RPackage-Core',
#tag : 'Announcements'
}

{ #category : #'class initialization' }
{ #category : 'class initialization' }
PackageAdded class >> initialize [
self deprecatedAliases: { #RPackageRegistered }
]
18 changes: 10 additions & 8 deletions src/RPackage-Core/PackageAnnouncement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,40 @@
Common superclass for package related announcements
"
Class {
#name : #PackageAnnouncement,
#superclass : #SystemAnnouncement,
#name : 'PackageAnnouncement',
#superclass : 'SystemAnnouncement',
#instVars : [
'package'
],
#category : #'RPackage-Core-Announcements'
#category : 'RPackage-Core-Announcements',
#package : 'RPackage-Core',
#tag : 'Announcements'
}

{ #category : #'class initialization' }
{ #category : 'class initialization' }
PackageAnnouncement class >> initialize [
self deprecatedAliases: { #RPackageAnnouncement }
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
PackageAnnouncement class >> to: aPackage [

^ self new package: aPackage
]

{ #category : #testing }
{ #category : 'testing' }
PackageAnnouncement >> affectsPackages [

^true
]

{ #category : #accessing }
{ #category : 'accessing' }
PackageAnnouncement >> package [

^ package
]

{ #category : #accessing }
{ #category : 'accessing' }
PackageAnnouncement >> package: anObject [

package := anObject
Expand Down
10 changes: 6 additions & 4 deletions src/RPackage-Core/PackageRemoved.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
I am a public announcement sent when a new RPackage is unregistred ( kind of removed from the system )
"
Class {
#name : #PackageRemoved,
#superclass : #PackageAnnouncement,
#category : #'RPackage-Core-Announcements'
#name : 'PackageRemoved',
#superclass : 'PackageAnnouncement',
#category : 'RPackage-Core-Announcements',
#package : 'RPackage-Core',
#tag : 'Announcements'
}

{ #category : #'class initialization' }
{ #category : 'class initialization' }
PackageRemoved class >> initialize [
self deprecatedAliases: { #RPackageUnregistered }
]
30 changes: 16 additions & 14 deletions src/RPackage-Core/PackageRenamed.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
I am a public announcement sent when a new RPackage is renamed
"
Class {
#name : #PackageRenamed,
#superclass : #PackageAnnouncement,
#name : 'PackageRenamed',
#superclass : 'PackageAnnouncement',
#instVars : [
'oldName',
'newName'
],
#category : #'RPackage-Core-Announcements'
#category : 'RPackage-Core-Announcements',
#package : 'RPackage-Core',
#tag : 'Announcements'
}

{ #category : #'class initialization' }
{ #category : 'class initialization' }
PackageRenamed class >> initialize [

self deprecatedAliases: { #RPackageRenamed }
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
PackageRenamed class >> to: aPackage oldName: aSymbol newName: anotherSymbol [

^ (self to: aPackage)
Expand All @@ -26,54 +28,54 @@ PackageRenamed class >> to: aPackage oldName: aSymbol newName: anotherSymbol [
yourself
]

{ #category : #testing }
{ #category : 'testing' }
PackageRenamed >> affectsClass: aClass [
^package == aClass package
]

{ #category : #testing }
{ #category : 'testing' }
PackageRenamed >> affectsMethod: aMethod [
^package == aMethod package
]

{ #category : #testing }
{ #category : 'testing' }
PackageRenamed >> affectsMethods [
"methods belong to package which could be represented by tools as part of method"
^true
]

{ #category : #testing }
{ #category : 'testing' }
PackageRenamed >> affectsMethodsDefinedInClass: aClass [

^(package definesClass: aClass)
or: [ package extendsClass: aClass ]
]

{ #category : #testing }
{ #category : 'testing' }
PackageRenamed >> affectsMethodsDefinedInPackage: aPackage [

^package == aPackage
]

{ #category : #accessing }
{ #category : 'accessing' }
PackageRenamed >> newName [

^ newName
]

{ #category : #accessing }
{ #category : 'accessing' }
PackageRenamed >> newName: anObject [

newName := anObject
]

{ #category : #accessing }
{ #category : 'accessing' }
PackageRenamed >> oldName [

^ oldName
]

{ #category : #accessing }
{ #category : 'accessing' }
PackageRenamed >> oldName: anObject [

oldName := anObject
Expand Down
Loading

0 comments on commit 19f7b03

Please sign in to comment.