Skip to content

Commit

Permalink
Do not use PharoLauncherApplication instance when in CLI mode.
Browse files Browse the repository at this point in the history
See issue #630
  • Loading branch information
demarey committed Oct 16, 2023
1 parent 019471b commit b2abc11
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
22 changes: 21 additions & 1 deletion src/PharoLauncher-CLI/PhLNotificationCenter.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"
This represents singleton object for accessing errorStream, outStream in methods used by CLI, that do not have any reference to streams of CLI command (or CLI context) object.
I represent an object to manage notifications to user when ran in CLI mode.
I can act as the PharoLauncher default application (see PharoLauncherApplication class>>#default).
I only have a minimal set of methods to provide some polymorphism with an SpApplication and avoid UI interactions.
"
Class {
#name : #PhLNotificationCenter,
Expand Down Expand Up @@ -54,3 +57,20 @@ PhLNotificationCenter >> outStream [
PhLNotificationCenter >> outStream: anOutStream [
outStream := anOutStream
]

{ #category : #ui }
PhLNotificationCenter >> pushProgress: aString with: aFullBlockClosure [
"do not display progress, only evaluate the block"
aFullBlockClosure value: DummySystemProgressItem new
]

{ #category : #ui }
PhLNotificationCenter >> showError: anError [

self errorStream
nextPutAll: 'Error: ';
nextPutAll: anError name;
nextPutAll: ' - ';
nextPutAll: anError longDescription;
cr
]
2 changes: 0 additions & 2 deletions src/PharoLauncher-Core/PhLDownloadManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ PhLDownloadManager >> basicDownload: url toFile: destinationFile [
{ #category : #private }
PhLDownloadManager >> displayProgress: aTitle during: workBlock [
"Inform user about download progression"
| bar |
bar := ConsoleProgressBar on: PhLNotificationCenter default outStream.

PharoLauncherApplication default
pushProgress: aTitle
Expand Down
7 changes: 5 additions & 2 deletions src/PharoLauncher-Spec2/PhLDeploymentScript.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ PhLDeploymentScript class >> isDeployed [

{ #category : #'system startup' }
PhLDeploymentScript class >> launcherStartUp [
(self isDeployed and: [ Smalltalk isInteractive not ])
ifTrue: [ self closeWindowsAndOpenLauncher ]
self isDeployed ifFalse: [ ^ self ].

Smalltalk isInteractive
ifTrue: [ PharoLauncherApplication default: PhLNotificationCenter default ]
ifFalse: [ self closeWindowsAndOpenLauncher ]
]

{ #category : #'system startup' }
Expand Down

0 comments on commit b2abc11

Please sign in to comment.