The Inbox: Installer-Core-cmm.429.mcz

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

The Inbox: Installer-Core-cmm.429.mcz

commits-2
Chris Muller uploaded a new version of Installer-Core to project The Inbox:
http://source.squeak.org/inbox/Installer-Core-cmm.429.mcz

==================== Summary ====================

Name: Installer-Core-cmm.429
Author: cmm
Time: 8 April 2019, 2:01:23.400753 pm
UUID: 12e11ef9-421b-4e4c-88b0-a4921fe4d4a8
Ancestors: Installer-Core-tcj.426

Allow installation of github projects via the scripts at the top of their readme files, without first having to manually ensure Metacello is installed.

        Metacello new
                baseline: 'NameOfTheProject';
                repository: 'github://...';
                load

=============== Diff against Installer-Core-tcj.426 ===============

Item was changed:
  ----- Method: Installer class>>ensureRecentMetacello (in category 'scripts') -----
  ensureRecentMetacello
  "Copied and adapted from https://github.com/Metacello/metacello/blob/master/README.md"
 
  | metacello |
  ((Smalltalk classNamed: #WebClient)
  ifNil: [ false ]
  ifNotNil: [ :webClient |
  [ (webClient httpHead: 'https://github.com') isSuccess ]
  on: Error
  do: [ false ] ])
  ifFalse: [ ^self inform: 'Could not connect to "https://github.com".\\You need an internet connection and SSL support\to install (or update) Metacello.\\Please fix those issues and try again.' translated withCRs ].
 
+ "Squeak is shipped with the global #Metacello referring to lightweight MetacelloStub.  After the first message is sent, the latest Metacello is installed, replacing the stub."
+ metacello := Smalltalk at: #Metacello.
+ metacello = MetacelloStub ifTrue: [
- metacello := (Smalltalk classNamed: #Metacello) ifNil: [
  "Get the Metacello configuration (for Squeak users)"
  Installer gemsource
  project: 'metacello';
  addPackage: 'ConfigurationOfMetacello';
  install.
 
  "Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"
  ((Smalltalk classNamed: #ConfigurationOfMetacello) project
  version: #'previewBootstrap') load.
 
  Smalltalk classNamed: #Metacello ].
 
  "Now load latest version of Metacello"
  metacello new
  baseline: 'Metacello';
  repository: 'github://Metacello/metacello:master/repository';
  get.
  metacello new
  baseline: 'Metacello';
  repository: 'github://Metacello/metacello:master/repository';
  load: #('default' 'Metacello-Help').
  !

Item was added:
+ Object subclass: #MetacelloStub
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Installer-Core'!
+
+ !MetacelloStub commentStamp: 'cmm 4/8/2019 14:00' prior: 0!
+ MetacelloStub is a loose reference to the class Metacello in its host repository.  It's kept at both its real name, #MetacelloStub, as well as the name #Metacello.  This is done to allow Squeak to respond to messages sent to Metacello (e.g., as referenced in external installation scripts), without the need to ship with Metacello pre-installed.!

Item was added:
+ ----- Method: MetacelloStub class>>doesNotUnderstand: (in category 'overriding') -----
+ doesNotUnderstand: aMessage
+ (UIManager confirm: 'This action requires Metacello, but it''s not installed.  Download and install it now?') ifTrue:
+ [ Installer ensureRecentMetacello.
+ ^ aMessage sentTo: (Smalltalk classNamed: #Metacello) ]!

Item was added:
+ ----- Method: MetacelloStub class>>initialize (in category 'initialize-release') -----
+ initialize
+ Smalltalk
+ at: #Metacello
+ ifAbsentPut: [ self ]!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Installer-Core-cmm.429.mcz

fniephaus
On Mon, 8 Apr 2019 at 9:01 pm, <[hidden email]> wrote:
Chris Muller uploaded a new version of Installer-Core to project The Inbox:
http://source.squeak.org/inbox/Installer-Core-cmm.429.mcz

==================== Summary ====================

Name: Installer-Core-cmm.429
Author: cmm
Time: 8 April 2019, 2:01:23.400753 pm
UUID: 12e11ef9-421b-4e4c-88b0-a4921fe4d4a8
Ancestors: Installer-Core-tcj.426

Allow installation of github projects via the scripts at the top of their readme files, without first having to manually ensure Metacello is installed.

        Metacello new
                baseline: 'NameOfTheProject';
                repository: 'github://...';
                load

=============== Diff against Installer-Core-tcj.426 ===============

Item was changed:
  ----- Method: Installer class>>ensureRecentMetacello (in category 'scripts') -----
  ensureRecentMetacello
        "Copied and adapted from https://github.com/Metacello/metacello/blob/master/README.md"

        | metacello |
        ((Smalltalk classNamed: #WebClient)
                ifNil: [ false ]
                ifNotNil: [ :webClient |
                        [ (webClient httpHead: 'https://github.com') isSuccess ]
                                on: Error
                                do: [ false ] ])
                ifFalse: [ ^self inform: 'Could not connect to "https://github.com".\\You need an internet connection and SSL support\to install (or update) Metacello.\\Please fix those issues and try again.' translated withCRs ].

+       "Squeak is shipped with the global #Metacello referring to lightweight MetacelloStub.  After the first message is sent, the latest Metacello is installed, replacing the stub."
+       metacello := Smalltalk at: #Metacello.
+       metacello = MetacelloStub ifTrue: [
-       metacello := (Smalltalk classNamed: #Metacello) ifNil: [
                "Get the Metacello configuration (for Squeak users)"
                Installer gemsource
                        project: 'metacello';
                        addPackage: 'ConfigurationOfMetacello';
                        install.

                "Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"
                ((Smalltalk classNamed: #ConfigurationOfMetacello) project
                        version: #'previewBootstrap') load.

                Smalltalk classNamed: #Metacello ].

        "Now load latest version of Metacello"
        metacello new
                baseline: 'Metacello';
                repository: 'github://Metacello/metacello:master/repository';
                get.
        metacello new
                baseline: 'Metacello';
                repository: 'github://Metacello/metacello:master/repository';
                load: #('default' 'Metacello-Help').
  !

Item was added:
+ Object subclass: #MetacelloStub
+       instanceVariableNames: ''
+       classVariableNames: ''
+       poolDictionaries: ''
+       category: 'Installer-Core'!
+
+ !MetacelloStub commentStamp: 'cmm 4/8/2019 14:00' prior: 0!
+ MetacelloStub is a loose reference to the class Metacello in its host repository.  It's kept at both its real name, #MetacelloStub, as well as the name #Metacello.  This is done to allow Squeak to respond to messages sent to Metacello (e.g., as referenced in external installation scripts), without the need to ship with Metacello pre-installed.!

Item was added:
+ ----- Method: MetacelloStub class>>doesNotUnderstand: (in category 'overriding') -----
+ doesNotUnderstand: aMessage
+       (UIManager confirm: 'This action requires Metacello, but it''s not installed.  Download and install it now?') ifTrue:
+               [ Installer ensureRecentMetacello.
+               ^ aMessage sentTo: (Smalltalk classNamed: #Metacello) ]!

Item was added:
+ ----- Method: MetacelloStub class>>initialize (in category 'initialize-release') -----
+ initialize
+       Smalltalk
+               at: #Metacello
+               ifAbsentPut: [ self ]!


Great, that's /exactly/ what I meant! Will give this implementation a try tomorrow.

Do we have a clever way to do the same within a GitBrowser menu item? Maybe show an item "Install GitBrowser..." at the end of the Tools menu iif it's main class is not found in the image. Jakob?



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Installer-Core-cmm.429.mcz

Chris Muller-3
In reply to this post by commits-2
Thanks for the review guys.  Here's take two.

I actually did not test it, would someone please try it out with one
of your normal use-cases?  (Fabio's note just arrived, cool thanks!)

I'm glad we found a solution we like, thanks!


 - Chris

On Mon, Apr 8, 2019 at 2:01 PM <[hidden email]> wrote:

>
> Chris Muller uploaded a new version of Installer-Core to project The Inbox:
> http://source.squeak.org/inbox/Installer-Core-cmm.429.mcz
>
> ==================== Summary ====================
>
> Name: Installer-Core-cmm.429
> Author: cmm
> Time: 8 April 2019, 2:01:23.400753 pm
> UUID: 12e11ef9-421b-4e4c-88b0-a4921fe4d4a8
> Ancestors: Installer-Core-tcj.426
>
> Allow installation of github projects via the scripts at the top of their readme files, without first having to manually ensure Metacello is installed.
>
>         Metacello new
>                 baseline: 'NameOfTheProject';
>                 repository: 'github://...';
>                 load
>
> =============== Diff against Installer-Core-tcj.426 ===============
>
> Item was changed:
>   ----- Method: Installer class>>ensureRecentMetacello (in category 'scripts') -----
>   ensureRecentMetacello
>         "Copied and adapted from https://github.com/Metacello/metacello/blob/master/README.md"
>
>         | metacello |
>         ((Smalltalk classNamed: #WebClient)
>                 ifNil: [ false ]
>                 ifNotNil: [ :webClient |
>                         [ (webClient httpHead: 'https://github.com') isSuccess ]
>                                 on: Error
>                                 do: [ false ] ])
>                 ifFalse: [ ^self inform: 'Could not connect to "https://github.com".\\You need an internet connection and SSL support\to install (or update) Metacello.\\Please fix those issues and try again.' translated withCRs ].
>
> +       "Squeak is shipped with the global #Metacello referring to lightweight MetacelloStub.  After the first message is sent, the latest Metacello is installed, replacing the stub."
> +       metacello := Smalltalk at: #Metacello.
> +       metacello = MetacelloStub ifTrue: [
> -       metacello := (Smalltalk classNamed: #Metacello) ifNil: [
>                 "Get the Metacello configuration (for Squeak users)"
>                 Installer gemsource
>                         project: 'metacello';
>                         addPackage: 'ConfigurationOfMetacello';
>                         install.
>
>                 "Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"
>                 ((Smalltalk classNamed: #ConfigurationOfMetacello) project
>                         version: #'previewBootstrap') load.
>
>                 Smalltalk classNamed: #Metacello ].
>
>         "Now load latest version of Metacello"
>         metacello new
>                 baseline: 'Metacello';
>                 repository: 'github://Metacello/metacello:master/repository';
>                 get.
>         metacello new
>                 baseline: 'Metacello';
>                 repository: 'github://Metacello/metacello:master/repository';
>                 load: #('default' 'Metacello-Help').
>   !
>
> Item was added:
> + Object subclass: #MetacelloStub
> +       instanceVariableNames: ''
> +       classVariableNames: ''
> +       poolDictionaries: ''
> +       category: 'Installer-Core'!
> +
> + !MetacelloStub commentStamp: 'cmm 4/8/2019 14:00' prior: 0!
> + MetacelloStub is a loose reference to the class Metacello in its host repository.  It's kept at both its real name, #MetacelloStub, as well as the name #Metacello.  This is done to allow Squeak to respond to messages sent to Metacello (e.g., as referenced in external installation scripts), without the need to ship with Metacello pre-installed.!
>
> Item was added:
> + ----- Method: MetacelloStub class>>doesNotUnderstand: (in category 'overriding') -----
> + doesNotUnderstand: aMessage
> +       (UIManager confirm: 'This action requires Metacello, but it''s not installed.  Download and install it now?') ifTrue:
> +               [ Installer ensureRecentMetacello.
> +               ^ aMessage sentTo: (Smalltalk classNamed: #Metacello) ]!
>
> Item was added:
> + ----- Method: MetacelloStub class>>initialize (in category 'initialize-release') -----
> + initialize
> +       Smalltalk
> +               at: #Metacello
> +               ifAbsentPut: [ self ]!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Installer-Core-cmm.429.mcz

Jakob Reschke
In reply to this post by fniephaus
Am Mo., 8. Apr. 2019 um 21:08 Uhr schrieb Fabio Niephaus <[hidden email]>:

Do we have a clever way to do the same within a GitBrowser menu item? Maybe show an item "Install GitBrowser..." at the end of the Tools menu iif it's main class is not found in the image. Jakob?


You may pick your favorite parts from Installer-Core-jr.430 and Morphic-jr.1485 in the Inbox. I did not test the install part though...