Skip to content

Commit

Permalink
Ride has development mode now for deciding if the template model shou…
Browse files Browse the repository at this point in the history
…ld render a walkback or not
  • Loading branch information
sebastianconcept committed Dec 22, 2023
1 parent f792ff6 commit c496117
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
13 changes: 9 additions & 4 deletions Ride-Pharo/Error.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Error >> htmlDescribeOn: aJsonObjectToRespond [

{ #category : #'*Ride-Pharo' }
Error >> renderHtmlWith: aJsonObject on: aMustacheTemplate [

"Answers the rendered template using the given aJsonObject as model and
loading it with the properties of the walkback and error message."

Expand All @@ -49,10 +50,14 @@ Error >> renderHtmlWith: aJsonObject on: aMustacheTemplate [
readStream.
lines := OrderedCollection new.
[ walkback atEnd ] whileFalse: [ lines add: walkback nextLine ].
aJsonObject
at: #walkback
put: (lines collect: [ :line | { (#step -> line) } asDictionary ]).
^ aMustacheTemplate value: aJsonObject ].
Ride isDevelopment ifTrue: [
aJsonObject
at: #isDevelopment put: true;
at: #walkback
put: (lines collect: [ :line | { (#step -> line) } asDictionary ]) ].
^ aMustacheTemplate
value: aJsonObject
partials: Ride service locate sharedTemplates ].

^ aMustacheTemplate value: (aJsonObject
at: #message put: self messageText;
Expand Down
10 changes: 9 additions & 1 deletion Ride/Ride.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Ride class >> isDebugMode [
^ RideServer debugMode
]

{ #category : #testing }
Ride class >> isDevelopment [

^ self mode asLowercase = 'development'
]

{ #category : #testing }
Ride class >> isProduction [

Expand Down Expand Up @@ -98,7 +104,9 @@ Ride class >> logLevelSymbols: anObject [
{ #category : #accessing }
Ride class >> mode [

^ OSEnvironment current at: 'RIDE_MODE'
^ OSEnvironment current at: #MODE ifAbsent: [
RideError signal:
'The environment needs to have defined the MODE env var as production, development or debug' ]
]

{ #category : #actions }
Expand Down

0 comments on commit c496117

Please sign in to comment.