<div>On Mon, 8 Apr 2019 at 9:01 pm, <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris Muller uploaded a new version of Installer-Core to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Installer-Core-cmm.429.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Installer-Core-cmm.429.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Installer-Core-cmm.429<br>
Author: cmm<br>
Time: 8 April 2019, 2:01:23.400753 pm<br>
UUID: 12e11ef9-421b-4e4c-88b0-a4921fe4d4a8<br>
Ancestors: Installer-Core-tcj.426<br>
<br>
Allow installation of github projects via the scripts at the top of their readme files, without first having to manually ensure Metacello is installed.<br>
<br>
        Metacello new<br>
                baseline: 'NameOfTheProject';<br>
                repository: 'github://...';<br>
                load<br>
<br>
=============== Diff against Installer-Core-tcj.426 ===============<br>
<br>
Item was changed:<br>
  ----- Method: Installer class>>ensureRecentMetacello (in category 'scripts') -----<br>
  ensureRecentMetacello<br>
        "Copied and adapted from <a href="https://github.com/Metacello/metacello/blob/master/README.md" rel="noreferrer" target="_blank">https://github.com/Metacello/metacello/blob/master/README.md</a>"<br>
<br>
        | metacello |<br>
        ((Smalltalk classNamed: #WebClient)<br>
                ifNil: [ false ]<br>
                ifNotNil: [ :webClient | <br>
                        [ (webClient httpHead: '<a href="https://github.com" rel="noreferrer" target="_blank">https://github.com</a>') isSuccess ] <br>
                                on: Error<br>
                                do: [ false ] ])<br>
                ifFalse: [ ^self inform: 'Could not connect to "<a href="https://github.com" rel="noreferrer" target="_blank">https://github.com</a>".\\You need an internet connection and SSL support\to install (or update) Metacello.\\Please fix those issues and try again.' translated withCRs ].<br>
<br>
+       "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."<br>
+       metacello := Smalltalk at: #Metacello.<br>
+       metacello = MetacelloStub ifTrue: [<br>
-       metacello := (Smalltalk classNamed: #Metacello) ifNil: [<br>
                "Get the Metacello configuration (for Squeak users)"<br>
                Installer gemsource<br>
                        project: 'metacello';<br>
                        addPackage: 'ConfigurationOfMetacello';<br>
                        install.<br>
<br>
                "Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"<br>
                ((Smalltalk classNamed: #ConfigurationOfMetacello) project <br>
                        version: #'previewBootstrap') load.<br>
<br>
                Smalltalk classNamed: #Metacello ].<br>
<br>
        "Now load latest version of Metacello"<br>
        metacello new<br>
                baseline: 'Metacello';<br>
                repository: 'github://Metacello/metacello:master/repository';<br>
                get.<br>
        metacello new<br>
                baseline: 'Metacello';<br>
                repository: 'github://Metacello/metacello:master/repository';<br>
                load: #('default' 'Metacello-Help').<br>
  !<br>
<br>
Item was added:<br>
+ Object subclass: #MetacelloStub<br>
+       instanceVariableNames: ''<br>
+       classVariableNames: ''<br>
+       poolDictionaries: ''<br>
+       category: 'Installer-Core'!<br>
+ <br>
+ !MetacelloStub commentStamp: 'cmm 4/8/2019 14:00' prior: 0!<br>
+ 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.!<br>
<br>
Item was added:<br>
+ ----- Method: MetacelloStub class>>doesNotUnderstand: (in category 'overriding') -----<br>
+ doesNotUnderstand: aMessage <br>
+       (UIManager confirm: 'This action requires Metacello, but it''s not installed.  Download and install it now?') ifTrue:<br>
+               [ Installer ensureRecentMetacello.<br>
+               ^ aMessage sentTo: (Smalltalk classNamed: #Metacello) ]!<br>
<br>
Item was added:<br>
+ ----- Method: MetacelloStub class>>initialize (in category 'initialize-release') -----<br>
+ initialize<br>
+       Smalltalk<br>
+               at: #Metacello<br>
+               ifAbsentPut: [ self ]!<br>
<br>
<br>
</blockquote></div></div><div dir="auto">Great, that's /exactly/ what I meant! Will give this implementation a try tomorrow.</div><div dir="auto"><br></div><div dir="auto">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?</div><div dir="auto"><br></div>