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

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

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

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

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

Name: Installer-Core-cmm.431
Author: cmm
Time: 21 April 2019, 7:54:57.789733 pm
UUID: c241b3df-f0a8-4ed3-b11b-f8975ab292cf
Ancestors: Installer-Core-tcj.426

Auto-install Metacello if necessary when a Metacello load script is executed.

=============== 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 ].
 
+ self isMetacelloInstalled ifFalse: [
+ "Prepare a clean environment for it."
+ Smalltalk globals removeKey: #Metacello.
- 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.
 
+ metacello := Smalltalk classNamed: #Metacello ].
- 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:
+ ----- Method: Installer class>>installAndOpenGitBrowser (in category 'scripts') -----
+ installAndOpenGitBrowser
+ self installGitInfrastructure.
+ (Smalltalk at: #SquitBrowser) open.!

Item was changed:
  ----- Method: Installer class>>installGitInfrastructure (in category 'scripts') -----
  installGitInfrastructure
+ | priorSetting |
+ "for INIFileTest>>#testComplexRead"
+ priorSetting := Scanner allowUnderscoreAsAssignment.
+ Scanner allowUnderscoreAsAssignment: true.
 
- self ensureRecentMetacello.
-
  (Smalltalk at: #Metacello) new
   baseline: 'Squot';
   repository: 'github://hpi-swa/Squot:master/src';
+  load.
+
+ Scanner allowUnderscoreAsAssignment: priorSetting
+ !
-  load.!

Item was added:
+ ----- Method: Installer class>>isMetacelloInstalled (in category 'scripts') -----
+ isMetacelloInstalled
+ "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."
+ ^ (Smalltalk at: #Metacello) ~= MetacelloStub!

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>>confirmMetacello (in category 'overriding') -----
+ confirmMetacello
+ Installer isMetacelloInstalled ifFalse:
+ [ (UIManager confirm: 'This action requires Metacello, but it''s not installed.  Download and install it now?') ifTrue: [ Installer ensureRecentMetacello ] ]!

Item was added:
+ ----- Method: MetacelloStub class>>doesNotUnderstand: (in category 'overriding') -----
+ doesNotUnderstand: aMessage
+ "Handle any messages sent to Metacello class, too."
+ self confirmMetacello.
+ ^ aMessage sendTo: (Smalltalk classNamed: #Metacello)!

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

Item was added:
+ ----- Method: MetacelloStub class>>isMetacelloConfig (in category 'overriding') -----
+ isMetacelloConfig
+ "Sent during Metacello's bootstrap initialization to all classes in the system.  Respond false."
+ ^ false!

Item was added:
+ ----- Method: MetacelloStub class>>new (in category 'overriding') -----
+ new
+ self confirmMetacello.
+ ^ (Smalltalk at: #Metacello) new!


Reply | Threaded
Open this post in threaded view
|

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

Levente Uzonyi
On Mon, 22 Apr 2019, [hidden email] wrote:

snip

> Item was changed:
>  ----- Method: Installer class>>installGitInfrastructure (in category 'scripts') -----
>  installGitInfrastructure
> + | priorSetting |
> + "for INIFileTest>>#testComplexRead"
> + priorSetting := Scanner allowUnderscoreAsAssignment.
> + Scanner allowUnderscoreAsAssignment: true.
>
> - self ensureRecentMetacello.
> -
>   (Smalltalk at: #Metacello) new
>    baseline: 'Squot';
>    repository: 'github://hpi-swa/Squot:master/src';
> +  load.
> +
> + Scanner allowUnderscoreAsAssignment: priorSetting
> + !
> -  load.!

The method above lacks indentation and the setting should be restored with
#ensure:. Also, that comment about INIFileTest doesn't make much sense.

Levente

Reply | Threaded
Open this post in threaded view
|

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

Chris Muller-3
The code is actually intentionally formatted that way, because it
wants to be removed, its only there temporarily for a better UX.
Until FixUnderscores can be run on the mentioned class, I wished to
have that code set apart from the "normal" code.

I had considered using ensure: here, but decided it's not needed in
this context.  If there's an exception the user will have to either
abort the half-configured image or fix and force it through to
completion.


 - Chris



On Sun, Apr 21, 2019 at 9:13 PM Levente Uzonyi <[hidden email]> wrote:

>
> On Mon, 22 Apr 2019, [hidden email] wrote:
>
> snip
>
> > Item was changed:
> >  ----- Method: Installer class>>installGitInfrastructure (in category 'scripts') -----
> >  installGitInfrastructure
> > + | priorSetting |
> > + "for INIFileTest>>#testComplexRead"
> > + priorSetting := Scanner allowUnderscoreAsAssignment.
> > + Scanner allowUnderscoreAsAssignment: true.
> >
> > -     self ensureRecentMetacello.
> > -
> >       (Smalltalk at: #Metacello) new
> >                 baseline: 'Squot';
> >                 repository: 'github://hpi-swa/Squot:master/src';
> > +               load.
> > +
> > + Scanner allowUnderscoreAsAssignment: priorSetting
> > + !
> > -               load.!
>
> The method above lacks indentation and the setting should be restored with
> #ensure:. Also, that comment about INIFileTest doesn't make much sense.
>
> Levente
>