Skip to content

Commit

Permalink
Issue #4: giving it one more try .. initial TDShell is a client-side …
Browse files Browse the repository at this point in the history
…class used by todeIt script to execute tode commands, so it will have most if not all of the magic needed to properly login ... then we'll see
  • Loading branch information
dalehenrich committed Jun 5, 2023
1 parent d5a4df9 commit 6d01260
Show file tree
Hide file tree
Showing 160 changed files with 2,019 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
transcript
basicResizeTranscript: transcriptBounds
(World systemWindows
detect: [ :each |
(each model isKindOf: ThreadSafeTranscript)
ifTrue: [
each == Transcript
ifTrue: [ true ]
ifFalse: [
each delete.
false ] ]
ifFalse: [ false ] ]
ifNone: [
Smalltalk
at: #Transcript
ifAbsent: [
| oldTranscript |
oldTranscript := Transcript.
ThreadSafeTranscript install.
self topezClientClass notifier dependents
do: [ :client | client remapTranscriptClientForwarderFrom: oldTranscript to: Transcript ] ].
Transcript open ])
extent: transcriptBounds extent;
position: transcriptBounds origin
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
deployment
cleanForDeploy
"self cleanForDeploy"

| utils block |
utils := MCFileTreeFileUtils current.
block := [ :dir |
(dir exists)
ifTrue: [
utils deleteAll: dir ] ].
(MCCacheRepository respondsTo: #checkCacheDirectory)
ifTrue: [
"Pharo 1.4"
MCCacheRepository checkCacheDirectory ]
ifFalse: [
"Pharo2.0"
MCCacheRepository resetIfInvalid ].
block value: MCCacheRepository cacheDirectory.
block value: MCGitHubRepository cacheDirectory.
MCRepositoryGroup default repositoriesDo: [ :rep | rep flushCache ].
MCDirectoryRepository defaultDirectoryName: nil.
MCGitHubRepository flushDownloadCache.
self resetWorldMenu.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
home
clientScriptsFiles: stoneName
self useTodeSys
ifTrue: [
| map |
map := Dictionary new.
{(self todeSysStonePath: stoneName).
(self todeSysLocalClientScriptsPath).
(self todeSysDefaultClientScriptsPath)}
do: [ :rootPath |
| reference |
reference := rootPath asFileReference.
reference exists
ifTrue: [ reference files do: [ :fileRef | map at: fileRef basename put: fileRef ] ] ].
^ map values ].
^ self todeRoot , '/' , self clientScriptsPath asFileReference files
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
home-private
clientScriptsPath
^ 'client/tode-scripts/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
home-private
clientServerBootstrapScriptsPath
^ 'client/server-bootstrap-scripts/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
currentShell: aTDShell
currentShell := aTDShell
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
currentShell
^ currentShell
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
debugMode: aBool
^ DebugMode := aBool
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
debugMode
DebugMode ifNil: [ DebugMode := false ].
^ DebugMode
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
defaultAdornmentColor
^ Color lightYellow
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
home-private
devKitRoot: aString
DevKitRoot := aString.
TodePath := '/tode/'.
self resetWorldMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
home
devKitRoot
DevKitRoot ifNil: [ DevKitRoot := '/opt/git/gsDevKit' ].
^ DevKitRoot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
enableDebugger: aBool
EnableDebugger := aBool
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
enableDebugger
EnableDebugger ifNil: [ EnableDebugger := false ].
^ EnableDebugger
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
system menu
ensureTranscriptWindow
Smalltalk
at: #TDTopezGemStoneClient
ifPresent: [ :cl |
| bounds |
bounds := cl windowProperties caculateWindowBounds at: #transcript.
self resizeTranscript: bounds ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
instance creation
forSessionNamed: aSessionName
| sessionDescription |
sessionDescription := TDSessionDescription importFrom: self gsDevKitSessionDescriptionPath , aSessionName.
^ self new
sessionDescription: sessionDescription;
batchMode: true;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
home
gsDevKitSessionDescriptionPath
^ (Smalltalk os environment
at: 'GS_SYS_SESSIONS'
ifAbsent: [
| clientDescriptionsPath "allow new client to connect to an old gsDevKitHome structure" |
clientDescriptionsPath := 'client/descriptions/'.
self useTodeSys
ifTrue: [ ^ self todeClientSysLocalPath , clientDescriptionsPath ].
^ self todeRoot , '/' , clientDescriptionsPath ]) , '/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
system menu
importSessionDescriptionFrom: file for: aBuilder
| sessionDescription |
[ sessionDescription := TDSessionDescription importFrom: file fullName ]
on: Error
do: [ :ex |
Transcript
cr;
show: 'Error importing session description from: ' , file fullName printString , ': ' , ex description.
^ self ].
(aBuilder item: sessionDescription name asSymbol)
parent: #'Open Shell';
action: [
| window |
window := TDShell openOnSessionDescription: sessionDescription.
currentShell := window model cliShell.
self ensureTranscriptWindow ].
(aBuilder item: sessionDescription name asSymbol)
parent: #'Project List';
action: [
| window |
window := TDShell openOnSessionDescription: sessionDescription.
currentShell := window model cliShell.
currentShell ifNil: [ ^ self ].
currentShell evaluate: 'project list'.
self ensureTranscriptWindow ].
(aBuilder item: sessionDescription name asSymbol)
parent: #Workspace;
action: [
| window |
window := TDShell openOnSessionDescription: sessionDescription.
currentShell := window model cliShell.
currentShell ifNil: [ ^ self ].
currentShell evaluate: 'ws'.
self ensureTranscriptWindow ].
(aBuilder item: sessionDescription name asSymbol)
parent: #'Edit Description';
action: [ self new openWorkspace: sessionDescription editTemplate styling: true label: sessionDescription name ].
(aBuilder item: sessionDescription name asSymbol)
parent: #'Test Login';
action: [
| answer |
answer := TDShell testLoginForSessionDescription: sessionDescription.
self new openWorkspace: answer label: 'testLogin: ' , sessionDescription name ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
initialization
initialize
"self initialize"

Smalltalk addToStartUpList: self.
false
ifTrue: [ self startUp: true ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
home
lookupClientScripts: scriptFilename stoneName: stoneName
self useTodeSys
ifTrue: [
{(self todeSysStonePath: stoneName).
(self todeSysLocalClientScriptsPath).
(self todeSysDefaultClientScriptsPath)}
do: [ :rootPath |
| path |
path := rootPath , scriptFilename.
path asFileReference exists
ifTrue: [ ^ path ] ].
self
error:
'The script ' , scriptFilename printString , ' was not found in the stone|local|default/client/scripts directories' ].
^ self todeRoot , '/' , self clientScriptsPath , scriptFilename
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
home
lookupPharoScript: scriptFilename
{(self todeSysLocalPharoPath).
(self todeSysDefaultPharoPath)}
do: [ :rootPath |
| path |
path := rootPath , scriptFilename.
path asFileReference exists
ifTrue: [ ^ path ] ].
self error: 'The script ' , scriptFilename printString , ' was not found in the local|default/pharo directories'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
home
lookupServerScripts: scriptFilename
self useTodeSys
ifTrue: [
{(self todeSysLocalServerScriptsPath).
(self todeSysDefaultServerScriptsPath)}
do: [ :rootPath |
| path |
path := rootPath , scriptFilename.
path asFileReference exists
ifTrue: [ ^ path ] ].
self
error: 'The script ' , scriptFilename printString , ' was not found in the local|default/server/scripts directories' ].
^ self todeRoot , '/' , self serverScriptsPath , scriptFilename
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
home
lookupWindowLayout: windowLayoutFilename
self useTodeSys
ifTrue: [
{(self todeSysLocalWindowLayoutPath).
(self todeSysDefaultWindowLayoutPath)}
do: [ :rootPath |
| path |
path := rootPath , windowLayoutFilename.
path asFileReference exists
ifTrue: [ ^ path ] ].
self
error:
'The window layout ' , windowLayoutFilename printString
, ' was not found in the local|default/client/windowLayout directories' ].
^ self todeRoot , '/' , self windowLayoutPath , windowLayoutFilename
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
server blocks
onServer: sessionName do: aBlock
| shell |
shell := (Smalltalk at: #TDShell) forSessionNamed: sessionName.
[ shell onServerDo: aBlock ]
ensure: [ shell windowIsClosing ]
3 changes: 3 additions & 0 deletions src/GsDevKit_stones-Tode.package/TDShell.class/class/open..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
open: aSessionName
^ self openFrom: self gsDevKitSessionDescriptionPath, aSessionName
5 changes: 5 additions & 0 deletions src/GsDevKit_stones-Tode.package/TDShell.class/class/open.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instance creation
open
| sessionDescription |
sessionDescription := TDSessionDescription seaside.
^ self new openOnSessionDescription: sessionDescription
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instance creation
openFrom: filepath
| sessionDescription |
sessionDescription := TDSessionDescription importFrom: filepath.
^ self openOnSessionDescription: sessionDescription
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
openOnSessionDescription: sessionDescription
^ self new openOnSessionDescription: sessionDescription
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
instance creation
openSessionDescription: sessionDescription evaluate: aCommand
| shell console |
shell := self new.
shell openOnSessionDescription: sessionDescription.
console := shell console.
console
nextPutAll: aCommand;
cr;
flush;
processCommand: aCommand.
^ shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
home-private
pharoPath
^ 'pharo/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
system menu
pharoWorldMenuOn: aBuilder
<todeWorldMenu>
(aBuilder item: #'Pharo World Menu')
parent: #Pharo;
order: 2;
target: self;
icon: (Smalltalk ui icons pharoIcon scaledToSize: 16 @ 16);
action: [ self restorePharoWorldMenu ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
system menu
resetWorldMenu
"self resetWorldMenu"

WorldState
desktopMenuTitle: nil;
desktopMenuPragmaKeyword: nil.
WorldState
desktopMenuTitle: 'tODE';
desktopMenuPragmaKeyword: 'todeWorldMenu'.
World resetWorldMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
transcript
resizeTranscript: transcriptBounds
NonInteractiveTranscript isInstalled
ifTrue: [ ^ self ].
self basicResizeTranscript: transcriptBounds
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
system menu
restorePharoWorldMenu
"self restorePharoWorldMenu"

WorldState
desktopMenuTitle: nil;
desktopMenuPragmaKeyword: nil.
World resetWorldMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
home-private
serverScriptsPath
^ 'server/scripts/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
sessionDescription: sessionDescription
^ self new sessionDescription: sessionDescription
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
instance creation
sessionDescription: sessionDescription debugMode: aBool
| shell |
shell := self sessionDescription: sessionDescription.
shell debugMode: aBool.
^ shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
sessionDescription: sessionDescription evaluate: script
^ self sessionDescription: sessionDescription evaluate: script debugMode: true
Loading

0 comments on commit 6d01260

Please sign in to comment.