[Tip] Image init scripts when working with PharoLauncher

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Tip] Image init scripts when working with PharoLauncher

Torsten Bergmann
PharoLauncher [1] allows you to work with many Pharo images.

You can download fresh images, clone existing ones and with its access
to the Pharo CI it allows you to easily reproduce errors in specific Pharo
image versions. I REALLY like this tool when working with Pharo.

There is a customizable hardware key on my laptop that I can just press
to open PharoLauncher, manage and launch the images and dive into the
world of Pharo.


To optimize my Pharo "easy access workflows" further I wanted all the
images that I started with PharoLauncher:
 - to share a common metacello repository cache (where all the mcz
   are stored independent from image location) for faster loading
 - to have the possibility to preset the Squeaksource, SS3 and STHub password already
 - to set my authors name

All this is already explained in Marianos blog posts [2] and [3] and
the PharoEnterprise book [4].

Nonetheless I would like to share the script that I personally use.
Maybe (in an adopted version) it is usefull for other PharoLauncher
users as well:
 
=====================================================================
COMMON SETTINGS FOR ALL PHARO IMAGES WHEN STARTED USING PHAROLAUNCHER
=====================================================================
Open any Pharo 3.0/4.0 image and execute

   StartupPreferencesLoader preferencesGeneralFolder fullName

in a workspace to find out the common preferences folder on your
local machine.

You can put a Smalltalk script into this folder, for instance
"initAllImages.st" that is evaluated each time an image runs.


I've found the following script very useful:

-----------------------------------------------------------------
| sharedPackageCacheDirectory |
"Never apply to PharoLauncher itself"
(SmalltalkImage current imageName includesSubstring: 'Launcher') ifTrue: [ ^self ].

"ask if script should be applied"
(UIManager default confirm: 'Apply init script from ', StartupPreferencesLoader preferencesGeneralFolder fullName,' to image') ifFalse: [^self ].

"Use a shared package cache to store Monticello MCS files for all images"
sharedPackageCacheDirectory := 'C:\Pharo\commonpackage-cache' asFileReference
        ensureCreateDirectory;
        yourself.
MCCacheRepository default directory: sharedPackageCacheDirectory.

"Set password for Squeaksource"
(MCRepositoryGroup default  repositories
        select: [:each | (each isKindOf: MCHttpRepository)
                                                and: [((each locationWithTrailingSlash includesSubstring: 'www.squeaksource.com')
                                                or: [each locationWithTrailingSlash includesSubstring: 'http://ss3.gemstone.com/ss/'])]
                        ])
        do: [:each | each user: 'squeaksourceuser'; password: 'secretsqueaksourcepassword'].

"Set password for SmalltalkHub (hub and HTTP repos)"
(MCRepositoryGroup default  repositories
        select: [:each |
                (each isKindOf: MCSmalltalkhubRepository) and: [each locationWithTrailingSlash includesSubstring: 'smalltalkhub.com']
                ])
        do: [:each | each user: 'PharoUser'; password: 'sthubpassword'].

(MCRepositoryGroup default  repositories
        select: [:each |
                (each isKindOf: MCHttpRepository) and: [each locationWithTrailingSlash includesSubstring: 'smalltalkhub.com']
                ])
        do: [:each | each user: 'PharoUser'; password: 'sthubpassword'].
       
"Set author name"
Author fullName: 'PharoUser'.

UIManager default inform: 'Script applied'.

-----------------------------------------------------------------

Hope it is usefull for others too.

Bye
T.

[1] http://www.smalltalkhub.com/#!/~Pharo/PharoLauncher
[2] http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
[3] http://marianopeck.wordpress.com/2012/05/12/startuploader-running-startup-scripts-in-pharo/
[4] https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/ws/StartupPreferences/

Reply | Threaded
Open this post in threaded view
|

Re: [Tip] Image init scripts when working with PharoLauncher

Ben Coman
Thanks for sharing.  I had an idea to manage these scripts from
PharoLauncher, but it dropped down my priority list.
cheers -ben

Torsten Bergmann wrote:

> PharoLauncher [1] allows you to work with many Pharo images.
>
> You can download fresh images, clone existing ones and with its access
> to the Pharo CI it allows you to easily reproduce errors in specific Pharo
> image versions. I REALLY like this tool when working with Pharo.
>
> There is a customizable hardware key on my laptop that I can just press
> to open PharoLauncher, manage and launch the images and dive into the
> world of Pharo.
>
>
> To optimize my Pharo "easy access workflows" further I wanted all the
> images that I started with PharoLauncher:
>  - to share a common metacello repository cache (where all the mcz
>    are stored independent from image location) for faster loading
>  - to have the possibility to preset the Squeaksource, SS3 and STHub password already
>  - to set my authors name
>
> All this is already explained in Marianos blog posts [2] and [3] and
> the PharoEnterprise book [4].
>
> Nonetheless I would like to share the script that I personally use.
> Maybe (in an adopted version) it is usefull for other PharoLauncher
> users as well:
>  
> =====================================================================
> COMMON SETTINGS FOR ALL PHARO IMAGES WHEN STARTED USING PHAROLAUNCHER
> =====================================================================
> Open any Pharo 3.0/4.0 image and execute
>
>    StartupPreferencesLoader preferencesGeneralFolder fullName
>
> in a workspace to find out the common preferences folder on your
> local machine.
>
> You can put a Smalltalk script into this folder, for instance
> "initAllImages.st" that is evaluated each time an image runs.
>
>
> I've found the following script very useful:
>
> -----------------------------------------------------------------
> | sharedPackageCacheDirectory |
> "Never apply to PharoLauncher itself"
> (SmalltalkImage current imageName includesSubstring: 'Launcher') ifTrue: [ ^self ].
>
> "ask if script should be applied"
> (UIManager default confirm: 'Apply init script from ', StartupPreferencesLoader preferencesGeneralFolder fullName,' to image') ifFalse: [^self ].
>
> "Use a shared package cache to store Monticello MCS files for all images"
> sharedPackageCacheDirectory := 'C:\Pharo\commonpackage-cache' asFileReference
> ensureCreateDirectory;
> yourself.
> MCCacheRepository default directory: sharedPackageCacheDirectory.
>
> "Set password for Squeaksource"
> (MCRepositoryGroup default  repositories
> select: [:each | (each isKindOf: MCHttpRepository)
> and: [((each locationWithTrailingSlash includesSubstring: 'www.squeaksource.com')
> or: [each locationWithTrailingSlash includesSubstring: 'http://ss3.gemstone.com/ss/'])]
> ])
> do: [:each | each user: 'squeaksourceuser'; password: 'secretsqueaksourcepassword'].
>
> "Set password for SmalltalkHub (hub and HTTP repos)"
> (MCRepositoryGroup default  repositories
> select: [:each |
> (each isKindOf: MCSmalltalkhubRepository) and: [each locationWithTrailingSlash includesSubstring: 'smalltalkhub.com']
> ])
> do: [:each | each user: 'PharoUser'; password: 'sthubpassword'].
>
> (MCRepositoryGroup default  repositories
> select: [:each |
> (each isKindOf: MCHttpRepository) and: [each locationWithTrailingSlash includesSubstring: 'smalltalkhub.com']
> ])
> do: [:each | each user: 'PharoUser'; password: 'sthubpassword'].
>
> "Set author name"
> Author fullName: 'PharoUser'.
>
> UIManager default inform: 'Script applied'.
>
> -----------------------------------------------------------------
>
> Hope it is usefull for others too.
>
> Bye
> T.
>
> [1] http://www.smalltalkhub.com/#!/~Pharo/PharoLauncher
> [2] http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
> [3] http://marianopeck.wordpress.com/2012/05/12/startuploader-running-startup-scripts-in-pharo/
> [4] https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/ws/StartupPreferences/
>
>
>  


Reply | Threaded
Open this post in threaded view
|

Re: [Tip] Image init scripts when working with PharoLauncher

stepharo
In reply to this post by Torsten Bergmann
Thanks a lot.
What I would like is that PharoLauncher does not get dizzy when I throw
away a folder.
And I would like it to detect the new folders I add. It could be done
explicit (like Sync with DIsc)

Stef

On 25/7/14 13:54, Torsten Bergmann wrote:

> PharoLauncher [1] allows you to work with many Pharo images.
>
> You can download fresh images, clone existing ones and with its access
> to the Pharo CI it allows you to easily reproduce errors in specific Pharo
> image versions. I REALLY like this tool when working with Pharo.
>
> There is a customizable hardware key on my laptop that I can just press
> to open PharoLauncher, manage and launch the images and dive into the
> world of Pharo.
>
>
> To optimize my Pharo "easy access workflows" further I wanted all the
> images that I started with PharoLauncher:
>   - to share a common metacello repository cache (where all the mcz
>     are stored independent from image location) for faster loading
>   - to have the possibility to preset the Squeaksource, SS3 and STHub password already
>   - to set my authors name
>
> All this is already explained in Marianos blog posts [2] and [3] and
> the PharoEnterprise book [4].
>
> Nonetheless I would like to share the script that I personally use.
> Maybe (in an adopted version) it is usefull for other PharoLauncher
> users as well:
>  
> =====================================================================
> COMMON SETTINGS FOR ALL PHARO IMAGES WHEN STARTED USING PHAROLAUNCHER
> =====================================================================
> Open any Pharo 3.0/4.0 image and execute
>
>     StartupPreferencesLoader preferencesGeneralFolder fullName
>
> in a workspace to find out the common preferences folder on your
> local machine.
>
> You can put a Smalltalk script into this folder, for instance
> "initAllImages.st" that is evaluated each time an image runs.
>
>
> I've found the following script very useful:
>
> -----------------------------------------------------------------
> | sharedPackageCacheDirectory |
> "Never apply to PharoLauncher itself"
> (SmalltalkImage current imageName includesSubstring: 'Launcher') ifTrue: [ ^self ].
>
> "ask if script should be applied"
> (UIManager default confirm: 'Apply init script from ', StartupPreferencesLoader preferencesGeneralFolder fullName,' to image') ifFalse: [^self ].
>
> "Use a shared package cache to store Monticello MCS files for all images"
> sharedPackageCacheDirectory := 'C:\Pharo\commonpackage-cache' asFileReference
> ensureCreateDirectory;
> yourself.
> MCCacheRepository default directory: sharedPackageCacheDirectory.
>
> "Set password for Squeaksource"
> (MCRepositoryGroup default  repositories
> select: [:each | (each isKindOf: MCHttpRepository)
> and: [((each locationWithTrailingSlash includesSubstring: 'www.squeaksource.com')
> or: [each locationWithTrailingSlash includesSubstring: 'http://ss3.gemstone.com/ss/'])]
> ])
> do: [:each | each user: 'squeaksourceuser'; password: 'secretsqueaksourcepassword'].
>
> "Set password for SmalltalkHub (hub and HTTP repos)"
> (MCRepositoryGroup default  repositories
> select: [:each |
> (each isKindOf: MCSmalltalkhubRepository) and: [each locationWithTrailingSlash includesSubstring: 'smalltalkhub.com']
> ])
> do: [:each | each user: 'PharoUser'; password: 'sthubpassword'].
>
> (MCRepositoryGroup default  repositories
> select: [:each |
> (each isKindOf: MCHttpRepository) and: [each locationWithTrailingSlash includesSubstring: 'smalltalkhub.com']
> ])
> do: [:each | each user: 'PharoUser'; password: 'sthubpassword'].
>
> "Set author name"
> Author fullName: 'PharoUser'.
>
> UIManager default inform: 'Script applied'.
>
> -----------------------------------------------------------------
>
> Hope it is usefull for others too.
>
> Bye
> T.
>
> [1] http://www.smalltalkhub.com/#!/~Pharo/PharoLauncher
> [2] http://marianopeck.wordpress.com/2012/05/19/pharo-tips-and-tricks/
> [3] http://marianopeck.wordpress.com/2012/05/12/startuploader-running-startup-scripts-in-pharo/
> [4] https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/ws/StartupPreferences/
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] [Tip] Image init scripts when working with PharoLauncher

Damien Cassou
In reply to this post by Torsten Bergmann

On Fri, Jul 25, 2014 at 1:54 PM, Torsten Bergmann <[hidden email]> wrote:
> I've found the following script very useful:


here is what I do for MC credentials:

    credentials := Dictionary new.
    MCRepository classVarNamed: 'Settings' put: credentials.
    credentials at: 'account smalltalkhub'  put: '*smalltalkhub.com*  DamienCassou:mypassword'.
    credentials at: 'account squeaksource'  put: '*squeaksource.com* dc:mypassword'.
    credentials at: 'account ss3'           put: '*ss3.gemstone.com* dc:mypassword'.
    credentials at: 'account source.squeak' put: '*source.squeak.org* DamienCassou:mypassword'.



--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without losing enthusiasm."
Winston Churchill