diff --git a/rowan/components/Deployment.ston b/rowan/components/Deployment.ston index eaf2475..6d8e99b 100644 --- a/rowan/components/Deployment.ston +++ b/rowan/components/Deployment.ston @@ -5,10 +5,16 @@ RwSimpleProjectLoadComponentV2 { #packageNames : [ 'Buoy-Assertions', 'Buoy-Assertions-Extensions', + 'Buoy-Collections-Extensions', 'Buoy-Collections-GS64-Extensions', - 'Buoy-Conditions-Extensions', + 'Buoy-Comparison', + 'Buoy-Comparison-Extensions', 'Buoy-Conditions', + 'Buoy-Conditions-Extensions', + 'Buoy-Dynamic-Binding', 'Buoy-Exception-Handling-Extensions', + 'Buoy-Math-GS64-Extensions', + 'Buoy-Metaprogramming', 'Buoy-Metaprogramming-Extensions', 'Buoy-Metaprogramming-GS64-Extensions' ], @@ -19,15 +25,24 @@ RwSimpleProjectLoadComponentV2 { 'Buoy-Assertions-Extensions' : { 'symbolDictName' : 'Globals' }, + 'Buoy-Collections-Extensions' : { + 'symbolDictName' : 'Globals' + }, 'Buoy-Collections-GS64-Extensions' : { 'symbolDictName' : 'Globals' }, + 'Buoy-Comparison-Extensions' : { + 'symbolDictName' : 'Globals' + }, 'Buoy-Conditions-Extensions' : { 'symbolDictName' : 'Globals' }, 'Buoy-Exception-Handling-Extensions' : { 'symbolDictName' : 'Globals' }, + 'Buoy-Math-GS64-Extensions' : { + 'symbolDictName' : 'Globals' + }, 'Buoy-Metaprogramming-Extensions' : { 'symbolDictName' : 'Globals' }, diff --git a/rowan/components/Tests.ston b/rowan/components/Tests.ston index 2b82ca0..f6307d9 100644 --- a/rowan/components/Tests.ston +++ b/rowan/components/Tests.ston @@ -8,8 +8,11 @@ RwSimpleProjectLoadComponentV2 { ], #packageNames : [ 'Buoy-Assertions-Tests', + 'Buoy-Comparison-Tests', 'Buoy-Conditions-Tests', - 'Buoy-Exception-Handling-Extensions-Tests', + 'Buoy-Dynamic-Binding-Tests', + 'Buoy-Exception-Handling-Tests', + 'Buoy-Metaprogramming-Tests', 'Buoy-SUnit-Tests' ], #comment : '' diff --git a/source/BaselineOfBuoy/BaselineOfBuoy.class.st b/source/BaselineOfBuoy/BaselineOfBuoy.class.st index ab6fcb9..d8b0788 100644 --- a/source/BaselineOfBuoy/BaselineOfBuoy.class.st +++ b/source/BaselineOfBuoy/BaselineOfBuoy.class.st @@ -50,11 +50,17 @@ BaselineOfBuoy >> baselineAssertions: spec [ BaselineOfBuoy >> baselineCollections: spec [ spec - package: 'Buoy-Collections' - with: [ spec requires: #( 'Buoy-Assertions' 'Buoy-Dynamic-Binding' 'Buoy-Comparison' ) ]; + package: 'Buoy-Collections' with: [ + spec requires: + #( 'Buoy-Assertions' 'Buoy-Dynamic-Binding' + 'Buoy-Comparison' ) ]; group: 'Deployment' with: 'Buoy-Collections'; - package: 'Buoy-Collections-Tests' - with: [ spec requires: #( 'Buoy-Collections' 'Dependent-SUnit-Extensions' ) ]; + package: 'Buoy-Collections-Extensions' + with: [ spec requires: 'Buoy-Collections' ]; + group: 'Deployment' with: 'Buoy-Collections-Extensions'; + package: 'Buoy-Collections-Tests' with: [ + spec requires: #( 'Buoy-Collections' 'Buoy-Collections-Extensions' + 'Dependent-SUnit-Extensions' ) ]; group: 'Tests' with: 'Buoy-Collections-Tests' ] @@ -62,10 +68,15 @@ BaselineOfBuoy >> baselineCollections: spec [ BaselineOfBuoy >> baselineComparison: spec [ spec - package: 'Buoy-Comparison' with: [ spec requires: 'Buoy-Assertions' ]; + package: 'Buoy-Comparison' + with: [ spec requires: 'Buoy-Assertions' ]; group: 'Deployment' with: 'Buoy-Comparison'; + package: 'Buoy-Comparison-Extensions' + with: [ spec requires: 'Buoy-Comparison' ]; + group: 'Deployment' with: 'Buoy-Comparison-Extensions'; package: 'Buoy-Comparison-Tests' - with: [ spec requires: #('Buoy-Comparison' 'Dependent-SUnit-Extensions') ]; + with: [ + spec requires: #( 'Buoy-Comparison-Extensions' 'Dependent-SUnit-Extensions' ) ]; group: 'Tests' with: 'Buoy-Comparison-Tests' ] @@ -106,8 +117,8 @@ BaselineOfBuoy >> baselineExceptionHandling: spec [ spec package: 'Buoy-Exception-Handling-Extensions'; group: 'Deployment' with: 'Buoy-Exception-Handling-Extensions'; - package: 'Buoy-Exception-Handling-Extensions-Tests' with: [ spec requires: 'Buoy-Exception-Handling-Extensions' ]; - group: 'Tests' with: 'Buoy-Exception-Handling-Extensions-Tests' + package: 'Buoy-Exception-Handling-Tests' with: [ spec requires: 'Buoy-Exception-Handling-Extensions' ]; + group: 'Tests' with: 'Buoy-Exception-Handling-Tests' ] { #category : #baselines } @@ -129,10 +140,12 @@ BaselineOfBuoy >> baselineMetaprogramming: spec [ group: 'Deployment' with: 'Buoy-Metaprogramming'; package: 'Buoy-Metaprogramming-Extensions' with: [ spec requires: 'Buoy-Assertions' ]; - group: 'Deployment' with: 'Buoy-Metaprogramming-Extensions'; + package: 'Buoy-Metaprogramming-Pharo-Extensions'; + group: 'Deployment' with: 'Buoy-Metaprogramming-Pharo-Extensions'; package: 'Buoy-Metaprogramming-Tests' with: [ spec requires: - #( 'Buoy-Metaprogramming' 'Buoy-Metaprogramming-Extensions' ) ]; + #( 'Buoy-Metaprogramming' 'Buoy-Metaprogramming-Extensions' + 'Buoy-Metaprogramming-Pharo-Extensions' ) ]; group: 'Tests' with: 'Buoy-Metaprogramming-Tests' ] diff --git a/source/Buoy-Collections-Extensions/SequenceableCollection.extension.st b/source/Buoy-Collections-Extensions/SequenceableCollection.extension.st new file mode 100644 index 0000000..e593e90 --- /dev/null +++ b/source/Buoy-Collections-Extensions/SequenceableCollection.extension.st @@ -0,0 +1,20 @@ +Extension { #name : #SequenceableCollection } + +{ #category : #'*Buoy-Collections-Extensions' } +SequenceableCollection >> equalityChecker [ + + ^ SequenceableCollectionEqualityChecker new +] + +{ #category : #'*Buoy-Collections-Extensions' } +SequenceableCollection >> withoutFirst [ + + ^self withoutFirst: 1 +] + +{ #category : #'*Buoy-Collections-Extensions' } +SequenceableCollection >> withoutFirst: n [ + + (self size <= n) ifTrue: [^self species new]. + ^self copyFrom: n + 1 to: self size +] diff --git a/source/Buoy-Collections-Extensions/package.st b/source/Buoy-Collections-Extensions/package.st new file mode 100644 index 0000000..b2fcb35 --- /dev/null +++ b/source/Buoy-Collections-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Collections-Extensions' } diff --git a/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st b/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st new file mode 100644 index 0000000..098a20a --- /dev/null +++ b/source/Buoy-Collections-GS64-Extensions/AbstractDictionary.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #AbstractDictionary } + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +AbstractDictionary >> at: key ifPresent: aBlock ifAbsentPut: anAbsentBlock [ + + | presentValue | + presentValue := self at: key ifAbsent: [ + | absentValue | + absentValue := anAbsentBlock value. + self at: key put: absentValue. + ^ absentValue ]. + ^ aBlock cull: presentValue +] diff --git a/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st b/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st index 038f2f6..15b8772 100644 --- a/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st +++ b/source/Buoy-Collections-GS64-Extensions/CharacterCollection.extension.st @@ -6,6 +6,12 @@ CharacterCollection >> expandMacros [ ^ self expandMacrosWithArguments: #( ) ] +{ #category : #'*Buoy-Collections-GS64-Extensions' } +CharacterCollection >> expandMacrosWith: anObject [ + + ^ self expandMacrosWithArguments: { anObject } +] + { #category : #'*Buoy-Collections-GS64-Extensions' } CharacterCollection >> expandMacrosWith: anObject with: anotherObject [ diff --git a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st index 78e4823..9c16631 100644 --- a/source/Buoy-Collections-GS64-Extensions/Collection.extension.st +++ b/source/Buoy-Collections-GS64-Extensions/Collection.extension.st @@ -5,3 +5,23 @@ Collection >> anyOne [ ^ self any ] + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +Collection >> ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock [ + + ^ self isEmpty + ifTrue: emptyBlock + ifFalse: [ notEmptyBlock cull: self ] +] + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +Collection >> isSequenceable [ + + ^ false +] + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +Collection >> select: selectBlock thenCollect: collectBlock [ + + ^ (self select: selectBlock) collect: collectBlock +] diff --git a/source/Buoy-Collections-GS64-Extensions/SequenceableCollection.extension.st b/source/Buoy-Collections-GS64-Extensions/SequenceableCollection.extension.st new file mode 100644 index 0000000..99275fb --- /dev/null +++ b/source/Buoy-Collections-GS64-Extensions/SequenceableCollection.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #SequenceableCollection } + +{ #category : #'*Buoy-Collections-GS64-Extensions' } +SequenceableCollection >> isSequenceable [ + + ^ true +] diff --git a/source/Buoy-Collections/SequenceableCollection.extension.st b/source/Buoy-Collections/SequenceableCollection.extension.st index a04e5b4..c463f2d 100644 --- a/source/Buoy-Collections/SequenceableCollection.extension.st +++ b/source/Buoy-Collections/SequenceableCollection.extension.st @@ -23,22 +23,3 @@ SequenceableCollection >> copyNoMoreThanLast: n [ ^ self copyLast: ( n min: self size ) ] - -{ #category : #'*Buoy-Collections' } -SequenceableCollection >> equalityChecker [ - - ^ SequenceableCollectionEqualityChecker new -] - -{ #category : #'*Buoy-Collections' } -SequenceableCollection >> withoutFirst [ - - ^self withoutFirst: 1 -] - -{ #category : #'*Buoy-Collections' } -SequenceableCollection >> withoutFirst: n [ - - (self size <= n) ifTrue: [^self species new]. - ^self copyFrom: n + 1 to: self size -] diff --git a/source/Buoy-Comparison/Object.extension.st b/source/Buoy-Comparison-Extensions/Object.extension.st similarity index 67% rename from source/Buoy-Comparison/Object.extension.st rename to source/Buoy-Comparison-Extensions/Object.extension.st index 41d7a5a..b74b09c 100644 --- a/source/Buoy-Comparison/Object.extension.st +++ b/source/Buoy-Comparison-Extensions/Object.extension.st @@ -1,12 +1,12 @@ Extension { #name : #Object } -{ #category : #'*Buoy-Comparison' } +{ #category : #'*Buoy-Comparison-Extensions' } Object >> equalityChecker [ ^ PropertyBasedEqualityChecker on: self ] -{ #category : #'*Buoy-Comparison' } +{ #category : #'*Buoy-Comparison-Extensions' } Object >> equalityHashCombinator [ ^ BitwiseExclusiveDisjunctionHashCombinator new diff --git a/source/Buoy-Comparison-Extensions/package.st b/source/Buoy-Comparison-Extensions/package.st new file mode 100644 index 0000000..2643441 --- /dev/null +++ b/source/Buoy-Comparison-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Comparison-Extensions' } diff --git a/source/Buoy-Dynamic-Binding/Optional.class.st b/source/Buoy-Dynamic-Binding/Optional.class.st index 5f45bb3..353b2c5 100644 --- a/source/Buoy-Dynamic-Binding/Optional.class.st +++ b/source/Buoy-Dynamic-Binding/Optional.class.st @@ -34,29 +34,37 @@ Optional class >> unusedBecauseAll: anExplanationCollection [ { #category : #'instance creation' } Optional class >> whenAllUsedIn: optionals injectInto: aDyadicBlock [ - ^ optionals ifNotEmpty: [ optionals first whenAllUsedIn: optionals allButFirst injectInto: aDyadicBlock ] ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + whenAllUsedIn: optionals allButFirst + injectInto: aDyadicBlock ] ] { #category : #'instance creation' } Optional class >> whenAllUsedIn: optionals return: aMonadycBlock [ - ^ optionals ifNotEmpty: [ optionals first whenAllUsedIn: optionals allButFirst return: aMonadycBlock ] ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + whenAllUsedIn: optionals allButFirst + return: aMonadycBlock ] ] { #category : #'instance creation' } Optional class >> withUsedOnlyIn: optionals injectInto: aDyadicBlock [ - ^ optionals - ifNotEmpty: [ optionals first withUsedOnlyIn: optionals allButFirst injectInto: aDyadicBlock ] - ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + withUsedOnlyIn: optionals allButFirst + injectInto: aDyadicBlock ] ] { #category : #'instance creation' } Optional class >> withUsedOnlyIn: optionals return: aMonadycBlock [ - ^ optionals - ifNotEmpty: [ optionals first withUsedOnlyIn: optionals allButFirst return: aMonadycBlock ] - ifEmpty: [ self unused ] + ^ optionals ifEmpty: [ self unused ] ifNotEmpty: [ + optionals first + withUsedOnlyIn: optionals allButFirst + return: aMonadycBlock ] ] { #category : #comparing } diff --git a/source/Buoy-Exception-Handling-Extensions-Tests/package.st b/source/Buoy-Exception-Handling-Extensions-Tests/package.st deleted file mode 100644 index 97be3ef..0000000 --- a/source/Buoy-Exception-Handling-Extensions-Tests/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #'Buoy-Exception-Handling-Extensions-Tests' } diff --git a/source/Buoy-Exception-Handling-Extensions-Tests/ExceptionHandlingSystemTest.class.st b/source/Buoy-Exception-Handling-Tests/ExceptionHandlingSystemTest.class.st similarity index 99% rename from source/Buoy-Exception-Handling-Extensions-Tests/ExceptionHandlingSystemTest.class.st rename to source/Buoy-Exception-Handling-Tests/ExceptionHandlingSystemTest.class.st index a0cee09..371f46d 100644 --- a/source/Buoy-Exception-Handling-Extensions-Tests/ExceptionHandlingSystemTest.class.st +++ b/source/Buoy-Exception-Handling-Tests/ExceptionHandlingSystemTest.class.st @@ -4,7 +4,7 @@ I'm a test case for the exception handling system. Class { #name : #ExceptionHandlingSystemTest, #superclass : #TestCase, - #category : #'Buoy-Exception-Handling-Extensions-Tests' + #category : #'Buoy-Exception-Handling-Tests' } { #category : #private } diff --git a/source/Buoy-Exception-Handling-Tests/package.st b/source/Buoy-Exception-Handling-Tests/package.st new file mode 100644 index 0000000..2a2c404 --- /dev/null +++ b/source/Buoy-Exception-Handling-Tests/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Exception-Handling-Tests' } diff --git a/source/Buoy-GS64-Compatibility/AbstractDictionary.class.st b/source/Buoy-GS64-Compatibility/AbstractDictionary.class.st new file mode 100644 index 0000000..2180cb9 --- /dev/null +++ b/source/Buoy-GS64-Compatibility/AbstractDictionary.class.st @@ -0,0 +1,10 @@ +" +AbstractDictionary is an abstract class in GS64, the superclass of all the Dictionary-like abstractions. +This version is just a placeholder so we can easily create extension methods to load in GS64 specific +packages. +" +Class { + #name : #AbstractDictionary, + #superclass : #Collection, + #category : #'Buoy-GS64-Compatibility' +} diff --git a/source/Buoy-GS64-Compatibility/ClassOrganizer.class.st b/source/Buoy-GS64-Compatibility/ClassOrganizer.class.st new file mode 100644 index 0000000..6b4afc5 --- /dev/null +++ b/source/Buoy-GS64-Compatibility/ClassOrganizer.class.st @@ -0,0 +1,10 @@ +" +In GS64, a `ClassOrganizer` can answer queries about classes in the image, provides + tools and reports on information on classes and methods and can perform + cross-referencing and fileout. +" +Class { + #name : #ClassOrganizer, + #superclass : #Object, + #category : #'Buoy-GS64-Compatibility' +} diff --git a/source/Buoy-Math-GS64-Extensions/Number.extension.st b/source/Buoy-Math-GS64-Extensions/Number.extension.st new file mode 100644 index 0000000..da64aef --- /dev/null +++ b/source/Buoy-Math-GS64-Extensions/Number.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #Number } + +{ #category : #'*Buoy-Math-GS64-Extensions' } +Number >> isZero [ + + ^ self = 0 +] diff --git a/source/Buoy-Math-GS64-Extensions/package.st b/source/Buoy-Math-GS64-Extensions/package.st new file mode 100644 index 0000000..3bb7517 --- /dev/null +++ b/source/Buoy-Math-GS64-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Math-GS64-Extensions' } diff --git a/source/Buoy-Metaprogramming-GS64-Extensions/Class.extension.st b/source/Buoy-Metaprogramming-GS64-Extensions/Class.extension.st new file mode 100644 index 0000000..15d1df2 --- /dev/null +++ b/source/Buoy-Metaprogramming-GS64-Extensions/Class.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #Class } + +{ #category : #'*Buoy-Metaprogramming-GS64-Extensions' } +Class >> allLeafSubclasses [ + + | leafs | + leafs := OrderedCollection new. + (ClassOrganizer new allSubclassesOf: self) do: [ :class | + class subclasses ifEmpty: [ leafs add: class ] ]. + ^ leafs +] diff --git a/source/Buoy-Metaprogramming/Behavior.extension.st b/source/Buoy-Metaprogramming-Pharo-Extensions/Behavior.extension.st similarity index 78% rename from source/Buoy-Metaprogramming/Behavior.extension.st rename to source/Buoy-Metaprogramming-Pharo-Extensions/Behavior.extension.st index d008393..8c88cc1 100644 --- a/source/Buoy-Metaprogramming/Behavior.extension.st +++ b/source/Buoy-Metaprogramming-Pharo-Extensions/Behavior.extension.st @@ -1,6 +1,6 @@ Extension { #name : #Behavior } -{ #category : #'*Buoy-Metaprogramming' } +{ #category : #'*Buoy-Metaprogramming-Pharo-Extensions' } Behavior >> allLeafSubclasses [ | leafs | diff --git a/source/Buoy-Metaprogramming/Symbol.extension.st b/source/Buoy-Metaprogramming-Pharo-Extensions/Symbol.extension.st similarity index 56% rename from source/Buoy-Metaprogramming/Symbol.extension.st rename to source/Buoy-Metaprogramming-Pharo-Extensions/Symbol.extension.st index edbb764..1fbba8b 100644 --- a/source/Buoy-Metaprogramming/Symbol.extension.st +++ b/source/Buoy-Metaprogramming-Pharo-Extensions/Symbol.extension.st @@ -1,6 +1,6 @@ Extension { #name : #Symbol } -{ #category : #'*Buoy-Metaprogramming' } +{ #category : #'*Buoy-Metaprogramming-Pharo-Extensions' } Symbol >> argumentCount [ ^self numArgs diff --git a/source/Buoy-Metaprogramming-Pharo-Extensions/package.st b/source/Buoy-Metaprogramming-Pharo-Extensions/package.st new file mode 100644 index 0000000..6d81509 --- /dev/null +++ b/source/Buoy-Metaprogramming-Pharo-Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'Buoy-Metaprogramming-Pharo-Extensions' } diff --git a/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st b/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st index fc62c29..4672190 100644 --- a/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st +++ b/source/Buoy-Metaprogramming-Tests/NamespaceTest.class.st @@ -66,7 +66,7 @@ NamespaceTest >> testBindTo [ namespace bind: #Zero to: 0. self - assertCollection: namespace names equals: #(#Zero); + assertCollection: namespace names hasSameElements: #(#Zero); assert: namespace >> #Zero equals: 0 ]