Skip to content

Commit

Permalink
Move extensions to its own packages
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Aug 31, 2023
1 parent 8f94739 commit c8573c2
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 44 deletions.
4 changes: 4 additions & 0 deletions source/BaselineOfHyperspace/BaselineOfHyperspace.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ BaselineOfHyperspace >> setUpPackages: spec [
spec
package: 'Hyperspace-Model' with: [ spec requires: #('Buoy-Deployment' 'Zinc-Core')];
group: 'Deployment' with: 'Hyperspace-Model';
package: 'Hyperspace-Extensions' with: [ spec requires: 'Hyperspace-Model'];
group: 'Deployment' with: 'Hyperspace-Extensions';
package: 'Hyperspace-Pharo-Extensions' with: [ spec requires: 'Hyperspace-Model'];
group: 'Deployment' with: 'Hyperspace-Pharo-Extensions';
package: 'Hyperspace-Model-Tests'
with: [ spec requires: #( 'Hyperspace-Model' 'Dependent-SUnit-Extensions' ) ];
group: 'Tests' with: 'Hyperspace-Model-Tests'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Extension { #name : #ZnClient }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnClient >> logLevel [

^ logLevel
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnClient >> query [
"Execute an HTTP QUERY the request set up and return the response #contents."

Expand All @@ -17,32 +17,32 @@ ZnClient >> query [
]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnClient >> resetRequest [

request := ZnRequest empty.
response := nil
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnClient >> setAccept: object [

request setAccept: object
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnClient >> setIfMatchTo: etag [

request setIfMatchTo: etag
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnClient >> setIfNoneMatchTo: etag [

request setIfNoneMatchTo: etag
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnClient >> setLogLevelAtLeastTo: integer [

self logLevel: (integer max: logLevel)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ZnEntity }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnEntity class >> with: anObject ofType: aMimeType [

| entity |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
Extension { #name : #ZnMimeType }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnMimeType >> accepts: aMimeType [

^ (aMimeType main = '*' or: [ aMimeType main = self main ])
and: [ aMimeType sub = '*'
or: [ self sub = aMimeType sub or: [ (self sub splitOn: $+) includes: aMimeType sub ] ] ]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnMimeType >> asMediaType [

^ self
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnMimeType >> quality [

^ Float readFrom: (self parameterAt: 'q' ifAbsent: [ ^1.0 ])
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnMimeType >> version: aVersionString [

self parameters at: 'version' put: aVersionString
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
Extension { #name : #ZnRequest }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest >> acceptLanguage [

^ self headers at: 'Accept-Language'
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest >> hasLanguageProrityList [

^ self headers includesKey: 'Accept-Language'
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest class >> query: urlObject [

^ self supportQUERYDuring: [ self method: #QUERY url: urlObject ]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest >> readFrom: stream [

^ self class supportQUERYDuring: [ super readFrom: stream ]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest >> setAcceptLanguage: acceptLanguageDirectives [

self headers at: 'Accept-Language' put: acceptLanguageDirectives asString
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest >> setIfMatchTo: etag [

self headers at: 'If-Match' put: etag asString
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest >> setIfNoneMatchTo: etag [

self headers at: 'If-None-Match' put: etag asString
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnRequest class >> supportQUERYDuring: aBlock [

^ aBlock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
Extension { #name : #ZnResponse }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> addCachingDirective: aDirective [

self headers at: 'Cache-Control' add: aDirective
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> addContentLanguage: aLanguageTag [

self headers at: 'Content-Language' add: aLanguageTag
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> addLink: aLink [

self headers at: 'Link' add: aLink
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> addToVary: headerName [

self headers at: 'Vary' add: headerName
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> cachingDirectives [

| directives |
Expand All @@ -35,7 +35,7 @@ ZnResponse >> cachingDirectives [
ifFalse: [ Array with: directives ]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> contentLanguageTags [

| headerValue |
Expand All @@ -46,19 +46,19 @@ ZnResponse >> contentLanguageTags [
ifFalse: [ Array with: headerValue asLanguageTag ]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> entityTag [

^ (self headers at: 'ETag') asEntityTag
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> hasLocation [

^ self headers includesKey: 'Location'
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> links [

| headerValue |
Expand All @@ -69,13 +69,13 @@ ZnResponse >> links [
ifFalse: [ Array with: headerValue asWebLink ]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> setEntityTag: aStringOrEntityTag [

self headers at: 'ETag' put: aStringOrEntityTag asEntityTag asString
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> varyHeaderNames [

| headerValue |
Expand All @@ -86,7 +86,7 @@ ZnResponse >> varyHeaderNames [
ifFalse: [ Array with: headerValue ]
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnResponse >> withEntityTagDo: foundBlock ifAbsent: absentBlock [

self headers at: 'ETag' ifPresent: [ :headerValue | ^ foundBlock cull: headerValue asEntityTag ].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Extension { #name : #ZnSingleThreadedServer }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnSingleThreadedServer >> logLevel [

^ logLevel
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnSingleThreadedServer >> setLogLevelAtLeastTo: integer [

self logLevel: (integer max: logLevel)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ZnUrl }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnUrl >> asAbsoluteUrl [

AssertionChecker
Expand All @@ -11,7 +11,7 @@ ZnUrl >> asAbsoluteUrl [
^ self
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnUrl >> asHostedAt: aBaseUrl [

^ self copy
Expand All @@ -21,13 +21,13 @@ ZnUrl >> asHostedAt: aBaseUrl [
yourself
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnUrl >> asWebLink [

^ WebLink to: self
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnUrl >> queryAt: aKey putUrl: anUnencodedUrl [

| encodedUrl |
Expand All @@ -36,7 +36,7 @@ ZnUrl >> queryAt: aKey putUrl: anUnencodedUrl [
^ self queryAt: aKey put: encodedUrl
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Extensions' }
ZnUrl >> start: startIndex limit: limitCount [

self
Expand Down
1 change: 1 addition & 0 deletions source/Hyperspace-Extensions/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Hyperspace-Extensions' }
31 changes: 31 additions & 0 deletions source/Hyperspace-GS64-Extensions/CharacterCollection.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Extension { #name : #CharacterCollection }

{ #category : #'*Hyperspace-GS64-Extensions' }
CharacterCollection >> asAbsoluteUrl [

^ self asUrl asAbsoluteUrl
]

{ #category : #'*Hyperspace-GS64-Extensions' }
CharacterCollection >> asEntityTag [

^ EntityTag fromString: self
]

{ #category : #'*Hyperspace-GS64-Extensions' }
CharacterCollection >> asLanguageTag [

^ LanguageTag fromString: self
]

{ #category : #'*Hyperspace-GS64-Extensions' }
CharacterCollection >> asMediaType [

^ self asZnMimeType
]

{ #category : #'*Hyperspace-GS64-Extensions' }
CharacterCollection >> asWebLink [

^ WebLink fromString: self
]
1 change: 1 addition & 0 deletions source/Hyperspace-GS64-Extensions/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Hyperspace-GS64-Extensions' }
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
Extension { #name : #String }

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Pharo-Extensions' }
String >> asAbsoluteUrl [

^ self asUrl asAbsoluteUrl
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Pharo-Extensions' }
String >> asEntityTag [

^ EntityTag fromString: self
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Pharo-Extensions' }
String >> asLanguageTag [

^ LanguageTag fromString: self
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Pharo-Extensions' }
String >> asMediaType [

^ self asZnMimeType
]

{ #category : #'*Hyperspace-Model' }
{ #category : #'*Hyperspace-Pharo-Extensions' }
String >> asWebLink [

^ WebLink fromString: self
Expand Down
1 change: 1 addition & 0 deletions source/Hyperspace-Pharo-Extensions/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Hyperspace-Pharo-Extensions' }

0 comments on commit c8573c2

Please sign in to comment.