From 305baf75fdc320724970009ac5d933719a7174bd Mon Sep 17 00:00:00 2001 From: Philippe Marschall Date: Wed, 10 Jul 2024 16:31:38 +0200 Subject: [PATCH] Factor out subclass creation Factor out subclass creation and add Pharo 13 implementation. --- .../instance/subclassOf.named.categorized..st | 12 ++++++++++++ .../monticello.meta/categories.st | 2 +- .../instance/subclassOf.named.categorized..st | 8 ++++++++ .../instance/createComponent..st | 10 ++++------ .../monticello.meta/categories.st | 4 +--- 5 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 repository/Seaside-Pharo-Welcome.package/GRPharoPlatform.extension/instance/subclassOf.named.categorized..st create mode 100644 repository/Seaside-Welcome.package/GRPlatform.extension/instance/subclassOf.named.categorized..st diff --git a/repository/Seaside-Pharo-Welcome.package/GRPharoPlatform.extension/instance/subclassOf.named.categorized..st b/repository/Seaside-Pharo-Welcome.package/GRPharoPlatform.extension/instance/subclassOf.named.categorized..st new file mode 100644 index 000000000..723fe1c24 --- /dev/null +++ b/repository/Seaside-Pharo-Welcome.package/GRPharoPlatform.extension/instance/subclassOf.named.categorized..st @@ -0,0 +1,12 @@ +*Seaside-Pharo-Welcome +subclassOf: aSuperClass named: aNameSymbol categorized: aCategoryString + ^ (aSuperClass respondsTo: #<<) + ifTrue: [ + aSuperClass << aNameSymbol + package: aCategoryString; + install ] + ifFalse: [ + super + subclassOf: aSuperClass + named: aNameSymbol + categorized: aCategoryString ] \ No newline at end of file diff --git a/repository/Seaside-Pharo-Welcome.package/monticello.meta/categories.st b/repository/Seaside-Pharo-Welcome.package/monticello.meta/categories.st index 5e7c510cf..5cd236c96 100644 --- a/repository/Seaside-Pharo-Welcome.package/monticello.meta/categories.st +++ b/repository/Seaside-Pharo-Welcome.package/monticello.meta/categories.st @@ -1 +1 @@ -SystemOrganization addCategory: #'Seaside-Pharo-Welcome'! +self packageOrganizer ensurePackage: #'Seaside-Pharo-Welcome' withTags: #()! diff --git a/repository/Seaside-Welcome.package/GRPlatform.extension/instance/subclassOf.named.categorized..st b/repository/Seaside-Welcome.package/GRPlatform.extension/instance/subclassOf.named.categorized..st new file mode 100644 index 000000000..e32dadca9 --- /dev/null +++ b/repository/Seaside-Welcome.package/GRPlatform.extension/instance/subclassOf.named.categorized..st @@ -0,0 +1,8 @@ +*Seaside-Welcome +subclassOf: aSuperClass named: aNameSymbol categorized: aCategoryString + ^ aSuperClass + subclass: aNameSymbol + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: aCategoryString \ No newline at end of file diff --git a/repository/Seaside-Welcome.package/WAWelcomeComponentCreator.class/instance/createComponent..st b/repository/Seaside-Welcome.package/WAWelcomeComponentCreator.class/instance/createComponent..st index 7b11d0eed..1af601122 100644 --- a/repository/Seaside-Welcome.package/WAWelcomeComponentCreator.class/instance/createComponent..st +++ b/repository/Seaside-Welcome.package/WAWelcomeComponentCreator.class/instance/createComponent..st @@ -9,12 +9,10 @@ createComponent: componentName self inform: '''', componentName, ''' is not a valid name for a component. Component names should begin with a letter. Please choose again.'. ^ nil ]. - userComponent := WAComponent - subclass: componentName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Seaside-User-Examples'. + userComponent := GRPlatform current + subclassOf: WAComponent + named: componentName + categorized: 'Seaside-User-Examples'. userComponent isNil ifTrue: [ self inform: 'A problem occurred creating ''', componentName, ''' component..'. diff --git a/repository/Seaside-Welcome.package/monticello.meta/categories.st b/repository/Seaside-Welcome.package/monticello.meta/categories.st index 22c274c2c..e63a9b314 100644 --- a/repository/Seaside-Welcome.package/monticello.meta/categories.st +++ b/repository/Seaside-Welcome.package/monticello.meta/categories.st @@ -1,3 +1 @@ -SystemOrganization addCategory: #'Seaside-Welcome'! -SystemOrganization addCategory: #'Seaside-Welcome-Base'! -SystemOrganization addCategory: #'Seaside-Welcome-Examples'! +self packageOrganizer ensurePackage: #'Seaside-Welcome' withTags: #(#Base #Examples)!