From 8e54ef361f6843c6abe68d83825d68b3e1103791 Mon Sep 17 00:00:00 2001 From: Sebastian Sastre Date: Sat, 24 Feb 2024 11:24:19 -0300 Subject: [PATCH] remove deprecations --- Ride-Builder/RideAppClassHelper.class.st | 8 - Ride/RidePresenter.class.st | 40 --- Ride/RideService.class.st | 13 - Ride/RideSession.class.st | 24 -- Ride/RideViewPresenterLocator.class.st | 338 ----------------------- 5 files changed, 423 deletions(-) delete mode 100644 Ride/RideViewPresenterLocator.class.st diff --git a/Ride-Builder/RideAppClassHelper.class.st b/Ride-Builder/RideAppClassHelper.class.st index d2a1d4d..6e996a9 100644 --- a/Ride-Builder/RideAppClassHelper.class.st +++ b/Ride-Builder/RideAppClassHelper.class.st @@ -97,13 +97,6 @@ RideAppClassHelper >> addInstallMethodTo: aClass for: aSymbol [ aClass class organization classify: #install under: 'actions' ] -{ #category : #actions } -RideAppClassHelper >> addNewSessionWith_UrlMethodTo: aClass for: aSymbol [ - self deprecated: 'not used'. - aClass class compile: (self class newSessionWith_UrlMethodFor: aSymbol). - aClass class organization classify: #'newSessionWith:url:' under: 'actions' -] - { #category : #actions } RideAppClassHelper >> addSessionClassMethodTo: aClass for: aSymbol [ @@ -131,7 +124,6 @@ RideAppClassHelper >> for: aSymbol [ appClass := super for: aSymbol. self addSessionClassMethodTo: appClass for: aSymbol. - "self addNewSessionWith_UrlMethodTo: appClass for: aSymbol." self addInstallMethodTo: appClass for: aSymbol. self addApplicationResourceClassMethodTo: appClass for: aSymbol. self addInitializeServerMethodTo: appClass for: aSymbol. diff --git a/Ride/RidePresenter.class.st b/Ride/RidePresenter.class.st index 5a144d7..d65228b 100644 --- a/Ride/RidePresenter.class.st +++ b/Ride/RidePresenter.class.st @@ -475,36 +475,6 @@ RidePresenter >> render: aRenderContext [ using: (renderer getRenderSelectorOf: aRenderContext) ] -{ #category : #rendering } -RidePresenter >> render: aSelector inLayout: aLayoutNameOrNil on: aRenderContext [ - - self deprecated: 'use render:using:in:'. - ^ renderer - render: aSelector - using: aLayoutNameOrNil - in: aRenderContext - for: self -] - -{ #category : #rendering } -RidePresenter >> render: aSelector model: aRideModel [ - - "Render the given model using aSelector to decide how it should be rendered." - - self deprecated: 'use render:using:'. - ^ renderer render: aSelector model: aRideModel for: self -] - -{ #category : #rendering } -RidePresenter >> render: aSelector on: aRenderContext [ - - self deprecated: 'use render:in:'. - ^ self - render: aSelector - inLayout: self getLayoutName - on: aRenderContext -] - { #category : #rendering } RidePresenter >> render: aRenderContext using: aSelector [ @@ -521,16 +491,6 @@ RidePresenter >> render: aRenderContext using: aSelector in: aLayoutNameOrNil [ for: self ] -{ #category : #rendering } -RidePresenter >> renderModel: aRideModel [ - - "Render the given model using its own default way to do it." - self deprecated: 'not used'. - aRideModel ifNil: [ RideNotFoundError signal: 'Model not found ' ]. - self halt. - ^ self render: aRideModel getDefaultRenderSelector model: aRideModel -] - { #category : #rendering } RidePresenter >> renderUsing: aSelector [ diff --git a/Ride/RideService.class.st b/Ride/RideService.class.st index d42c33a..72a099c 100644 --- a/Ride/RideService.class.st +++ b/Ride/RideService.class.st @@ -193,13 +193,6 @@ RideService >> initializeCache [ ^ cache := TTLCache new beThreadSafe ] -{ #category : #initialization } -RideService >> initializeLocator [ - - self deprecated: 'use Ride resource instead'. - ^ locator := RideViewPresenterLocator new -] - { #category : #initialization } RideService >> initializeMaitre [ @@ -263,12 +256,6 @@ RideService >> invalidateSessionId: aRideSessionId [ sessions removeKey: aRideSessionId ifAbsent: [ ] ] -{ #category : #accessing } -RideService >> locator [ - self deprecated: 'use Ride resource instead'. - ^ locator ifNil: [ self initializeLocator ] -] - { #category : #accessing } RideService >> locator: anObject [ diff --git a/Ride/RideSession.class.st b/Ride/RideSession.class.st index b2b0f20..d15b256 100644 --- a/Ride/RideSession.class.st +++ b/Ride/RideSession.class.st @@ -53,12 +53,6 @@ RideSession class >> newWith: anId request: aRequest [ ^ self new initializeWith: anId request: aRequest ] -{ #category : #'instance creation' } -RideSession class >> newWith: anId url: anUrl [ - self deprecated: 'not used'. - ^ self new initializeWith: anId url: anUrl -] - { #category : #actions } RideSession class >> nextAuthenticityTokenValue [ @@ -79,12 +73,6 @@ RideSession class >> sessionDuration [ ifAbsent: [ 20 years asSeconds ]) asInteger seconds ] -{ #category : #actions } -RideSession >> add: routeKey presenter: aRidePresenter [ -self deprecated: ' not used'. - ^ self presenters at: routeKey put: aRidePresenter -] - { #category : #accessing } RideSession >> authenticityTokens [ @@ -194,18 +182,6 @@ RideSession >> initializeWith: anId request: aRequest [ self initialUrl: aRequest url ] -{ #category : #initialization } -RideSession >> initializeWith: anId url: anUrl [ - self deprecated: 'not in use'. - super initialize. - - id := anId. - self initializeCookie. - self initializeCache. - self initializeAuthenticityTokens. - self initialUrl: anUrl -] - { #category : #actions } RideSession >> invalidateAndRedirectTo: url [ diff --git a/Ride/RideViewPresenterLocator.class.st b/Ride/RideViewPresenterLocator.class.st deleted file mode 100644 index 591343c..0000000 --- a/Ride/RideViewPresenterLocator.class.st +++ /dev/null @@ -1,338 +0,0 @@ -" -I help locating the templates that are meant to be views. -" -Class { - #name : #RideViewPresenterLocator, - #superclass : #Object, - #instVars : [ - 'templates', - 'presenters', - 'javaScriptAssets', - 'assetsMap' - ], - #category : #'Ride-Core' -} - -{ #category : #accessing } -RideViewPresenterLocator >> appPath [ - self deprecated: 'using resources'. - self halt. - ^ self projectRootDirectory / 'app' -] - -{ #category : #accessing } -RideViewPresenterLocator >> assetsFilePath [ - self deprecated: 'using resources'. - self halt. - ^ Path from: (Smalltalk os environment - at: #RIDE_ASSETS_FILE_PATH - ifAbsent: [ self defaultAssetsFilePathString ]) -] - -{ #category : #accessing } -RideViewPresenterLocator >> assetsMap [ -self flag: #deprecated. -self halt. - ^ assetsMap ifNil: [ self initializeAssetsMap ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> assetsMapFile [ -self deprecated: 'use locator'. -self halt. - ^ self assetsMapPath / 'assets.json' -] - -{ #category : #accessing } -RideViewPresenterLocator >> assetsMapPath [ - self deprecated: 'using resources'. - self halt. - ^ (self appPath / 'maps') asFileReference ensureCreateDirectory -] - -{ #category : #accessing } -RideViewPresenterLocator >> defaultAssetsFilePathString [ - self deprecated: 'using resources'. - self halt. - ^ (self appPath / 'assets') pathString -] - -{ #category : #accessing } -RideViewPresenterLocator >> getJavaScriptAssets [ - - "Returns a dictionary with keys being view names (views/ dsubirectory names) - and as value, a dictionary with the .js file names as keys and their content as value" - - | assets jsFiles presenterJavaScript | - self deprecated: 'using resources'. - self halt. - assets := Dictionary new. - RideDirectoryResolver viewTemplatesDirectory directories do: [ :path | - jsFiles := path files select: [ :e | e extension = 'js' ]. - presenterJavaScript := Dictionary new. - jsFiles do: [ :jsFile | - presenterJavaScript at: jsFile basenameWithoutExtension put: jsFile ]. - assets at: path basename put: presenterJavaScript ]. - ^ assets -] - -{ #category : #accessing } -RideViewPresenterLocator >> getMustacheTemplatesIn: aPath [ - - "Returns only the .mustache template files in aPath" - - | accepted | - self deprecated: 'use resources'. -self halt. - accepted := #( mustache mst ms tmpl ). - ^ aPath files select: [ :file | accepted includes: file extension ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> getPresenters [ - - "Returns a dictionary with keys being view names (views/ subdirectory names) - and as value, the corresponding presenter classes expected to be found in the image." - - | newPresenters | - self deprecated: 'using resources'. - self halt. - newPresenters := Dictionary new. - self viewTemplates keys do: [ :routeName | - newPresenters at: routeName put: (Smalltalk - at: - (RideNameNormalizer presenterNameFromURISegment: routeName) - asSymbol - ifAbsent: [ - RideMissingPresenterError signal: ('{1} not found' format: - { (RideNameNormalizer presenterNameFromURISegment: routeName) }) ]) ]. - ^ newPresenters -] - -{ #category : #accessing } -RideViewPresenterLocator >> getTemplates [ - - "Returns a dictionary with keys being view names (views/ dsubirectory names) - and as value, a dictionary with mustache templates for every file found." - - | newTemplates newViewTemplates newEmailTemplates | - self deprecated: 'use resources'. -self halt. - newTemplates := JsonObject new. - newViewTemplates := JsonObject new. - RideDirectoryResolver viewTemplatesDirectory directories do: [ :path | - newViewTemplates - at: path basenameWithoutExtension - put: (self getTemplatesFrom: path) ]. - newTemplates - at: - RideDirectoryResolver viewTemplatesDirectory - basenameWithoutExtension - put: newViewTemplates. - RideDirectoryResolver layoutTemplatesDirectory files do: [ :file | - (newTemplates - at: RideDirectoryResolver layoutTemplatesDirectory - basenameWithoutExtension - ifAbsentPut: [ JsonObject new ]) - at: file basenameWithoutExtension - put: file contents asMustacheTemplate ]. - RideDirectoryResolver sharedTemplatesDirectory files do: [ :file | - (newTemplates - at: RideDirectoryResolver sharedTemplatesDirectory - basenameWithoutExtension - ifAbsentPut: [ JsonObject new ]) - at: file basenameWithoutExtension - put: file contents asMustacheTemplate ]. - newEmailTemplates := JsonObject new. - RideDirectoryResolver emailTemplatesDirectory directories do: [ :path | - newEmailTemplates - at: path basenameWithoutExtension - put: (self getTemplatesFrom: path) ]. - newTemplates - at: - RideDirectoryResolver emailTemplatesDirectory - basenameWithoutExtension - put: newEmailTemplates. - ^ newTemplates -] - -{ #category : #accessing } -RideViewPresenterLocator >> getTemplatesFrom: aPath [ - - "Returns a dictionary with keys being the filenames (without extension) of aPath - and as value, the mustache template based on its content." - - | newTemplates | - self deprecated: 'using resources'. - self halt. - newTemplates := JsonObject new. - (self getMustacheTemplatesIn: aPath) do: [ :file | - newTemplates - at: file basenameWithoutExtension - put: file contents asMustacheTemplate ]. - - ^ newTemplates -] - -{ #category : #initialization } -RideViewPresenterLocator >> initializeAssetsMap [ - self deprecated: 'using resources'. - self halt. - ^ assetsMap := self readAssetsMap -] - -{ #category : #initialization } -RideViewPresenterLocator >> initializeJavaScriptAssets [ - self deprecated: 'using resources'. - self halt. - ^ javaScriptAssets := self getJavaScriptAssets -] - -{ #category : #initialization } -RideViewPresenterLocator >> initializePresenters [ - self deprecated: 'using resources'. - self halt. - ^ presenters := self getPresenters -] - -{ #category : #initialization } -RideViewPresenterLocator >> initializeTemplates [ - self deprecated: 'using resources'. - self halt. - ^ templates := self getTemplates -] - -{ #category : #accessing } -RideViewPresenterLocator >> javaScriptAssets [ -self deprecated: 'use resources'. -self halt. - ^ javaScriptAssets ifNil: [ self initializeJavaScriptAssets ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> layoutTemplates [ - self deprecated: 'using resources'. - self halt. - - ^ self templates - at: #layouts - ifAbsent: [ - RideMissingTemplateError signal: 'No layout templates' ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> presenterNameFor: routeName [ - self deprecated: 'using resources'. - self halt. - ^ '{1}Presenter' format: { ('' join: - ((routeName substrings: '_') collect: [ :e | e capitalized ])) } -] - -{ #category : #accessing } -RideViewPresenterLocator >> presenters [ - self deprecated: 'using resources'. - self halt. - ^ presenters ifNil: [ self initializePresenters ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> projectRootDirectory [ - self deprecated: 'using resources'. - self halt. - - ^ Path from: (Smalltalk os environment - at: #PROJECT_ROOT_PATH - ifAbsent: [ Smalltalk imageDirectory pathString ]) -] - -{ #category : #actions } -RideViewPresenterLocator >> readAssetsMap [ - - "Answers the assets cache as read from cache/assets.json" - - | file | - self deprecated: 'use locator'. - self halt. - file := self assetsMapFile. - ^ file exists - ifTrue: [ file readStreamDo: [ :stream | Json readFrom: stream ] ] - ifFalse: [ Dictionary new ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> sharedTemplates [ - self deprecated: 'using resources'. - ^ self templates - at: #shared - ifAbsent: [ - RideMissingTemplateError signal: 'No shared templates' ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> templates [ - self deprecated: 'use Ride resource'. - self halt. - ^ templates ifNil: [ self initializeTemplates ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> templatesFor: aPresenter [ - - "Answers the mustache templates that correspond to aPresenter. - The convention that is followed is to find the presenter's - model name in snake_case or kebab-case on disk." - - | views modelName kebabized found | - self deprecated: 'using resources'. - self halt. - views := self templates at: #views. - modelName := aPresenter class getModelName. - kebabized := '-' join: (modelName asSnakeCase substrings: '_'). - found := views at: kebabized. - ^ found - ifNil: [ views at: modelName asSnakeCase ] - ifNotNil: [ found ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> templatesPath [ - self deprecated: 'using resources'. - self halt. - ^ self appPath / 'templates' -] - -{ #category : #accessing } -RideViewPresenterLocator >> viewTemplates [ - self deprecated: 'use Ride resource'. - self halt. - - - ^ self templates - at: #views - ifAbsent: [ RideMissingTemplateError signal: 'No templates for the views?' ] -] - -{ #category : #accessing } -RideViewPresenterLocator >> viewsPath [ - self deprecated: 'use Ride resource'. - self halt. - - ^ self templatesPath / 'views' -] - -{ #category : #actions } -RideViewPresenterLocator >> writeAssetsMap [ - - "Writes the assets map in maps/assets.json" - - | file | - self deprecated: 'use Ride resource'. - self halt. - file := self assetsMapFile. - - file exists ifTrue: [ - file writeStreamDo: [ :stream | stream truncate ] ]. - - file writeStreamDo: [ :stream | - stream nextPutAll: self assetsMap asJsonString ] -]