[squeak-dev] The Inbox: Installer-Core-cmm.378.mcz

Frank Shearar frank.shearar at gmail.com
Tue Aug 13 20:58:06 UTC 2013


Hi Chris,

So if I understand this correctly, you'd set up the overrides before
any calls to Installer, right? If you like, the scoping is temporal -
"from now on, override with Foo" - as opposed to lexical.

frank

On 9 August 2013 23:39, Chris Muller <asqueaker at gmail.com> wrote:
> Hi Frank, I know you're interested in being able to override the
> repositories.  This is a simple solution for that which meets at least
> three use-cases.
>
> Example 1
> Installer
>      preemptRepositoryFor: 'htmlcssparser'
>      with: (MCDirectoryRepository directory: (FileDirectory default /
> 'my-projects' / 'mc'))
>
> Example 2
> "I'm on the train with slow Wi-Fi, look in my package-cache first for
> anything before going to remote repositories."
> #(squeak ss ss3) do:
>      [ : each | Installer
>           preemptRepositoryFor: each
>           with: MCCacheRepository default ]
>
> Example 3
> "I want to make a new system.  Use the default repository, ss3, but if
> its down fall back to the original SqueakSource."
> Installer
>      fallbackRepositoryFor: #ss3
>      is: #ss
>
> On Fri, Aug 9, 2013 at 5:36 PM,  <commits at source.squeak.org> wrote:
>> A new version of Installer-Core was added to project The Inbox:
>> http://source.squeak.org/inbox/Installer-Core-cmm.378.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Installer-Core-cmm.378
>> Author: cmm
>> Time: 9 August 2013, 5:04:23.858 pm
>> UUID: 79285e19-2913-476e-b396-b1a01a652edc
>> Ancestors: Installer-Core-cmm.377
>>
>> Allow the default repositories for external-packages to be preempted or reinforced.
>>
>> =============== Diff against Installer-Core-cmm.377 ===============
>>
>> Item was changed:
>>   Object subclass: #Installer
>>         instanceVariableNames: 'answers packages messagesToSuppress useFileIn noiseLevel currentRepository'
>> +       classVariableNames: 'InstallerBindings IsSetToTrapErrors Remembered Repositories SkipLoadingTests ValidationBlock'
>> -       classVariableNames: 'InstallerBindings IsSetToTrapErrors Remembered SkipLoadingTests ValidationBlock'
>>         poolDictionaries: ''
>>         category: 'Installer-Core'!
>>
>>   !Installer commentStamp: 'kph 3/30/2009 01:29' prior: 0!
>>   Documentation now available at http://installer.pbwiki.com/Installer
>>
>>   useFileIn - flag to load source.st rather than using Monticello!
>>
>> Item was added:
>> + ----- Method: Installer class>>defaultRepositoryFor: (in category 'repositories') -----
>> + defaultRepositoryFor: anAssociation
>> +       ^ (self perform: anAssociation key)
>> +                project: anAssociation value ;
>> +                mc!
>>
>> Item was added:
>> + ----- Method: Installer class>>fallbackRepositoryFor:is: (in category 'repositories') -----
>> + fallbackRepositoryFor: scope is: anMCRepository
>> +       self
>> +               overrideRepositoryFor: scope
>> +               with:
>> +                       (MCRepositoryGroup new
>> +                                addRepository: (self defaultRepositoryFor: scope) ;
>> +                                addRepository: anMCRepository ;
>> +                                yourself)!
>>
>> Item was added:
>> + ----- Method: Installer class>>overrideRepository:with: (in category 'repositories') -----
>> + overrideRepository: scope with: anMCRepository
>> +       "Override the standard repository specified by scope with anMCRepository.  To override an entire repository, specify scope as the repository selector.  To override a single project within a repository, scope should be an Association whose key is the repository selector and value is the project name."
>> +       self repositories
>> +               at: scope
>> +               put: anMCRepository!
>>
>> Item was added:
>> + ----- Method: Installer class>>packageCache (in category 'repositories') -----
>> + packageCache
>> +       ^ MCCacheRepository default!
>>
>> Item was added:
>> + ----- Method: Installer class>>preemptRepository:with: (in category 'repositories') -----
>> + preemptRepository: scope with: anMCRepository
>> +       self
>> +               overrideRepositoryFor: scope
>> +               with:
>> +                       (MCRepositoryGroup new
>> +                                addRepository: anMCRepository ;
>> +                                addRepository: (self defaultRepositoryFor: scope) ;
>> +                                yourself)!
>>
>> Item was added:
>> + ----- Method: Installer class>>removeOverride: (in category 'repositories') -----
>> + removeOverride: scope
>> +       "Remove override specified by scope and return to using the default repository for packages within that scope."
>> +       ^ self repositories
>> +               removeKey: scope
>> +               ifAbsent: [  ]!
>>
>> Item was changed:
>> + ----- Method: Installer class>>repositories (in category 'repositories') -----
>> - ----- Method: Installer class>>repositories (in category 'instanciation') -----
>>   repositories
>> +       ^ Repositories ifNil: [ Repositories := Dictionary new ]!
>> -
>> -       ^ self class organization listAtCategoryNamed: 'repositories'.
>> - !
>>
>> Item was added:
>> + ----- Method: Installer class>>repositoryFor: (in category 'repositories') -----
>> + repositoryFor: anAssociation
>> +       | rep |
>> +       rep := self repositories
>> +               at: anAssociation
>> +               ifAbsent:
>> +                       [ self repositories
>> +                               at: anAssociation value
>> +                               ifAbsent:
>> +                                       [ self repositories
>> +                                               at: anAssociation key
>> +                                               ifAbsent: [ ^ self defaultRepositoryFor: anAssociation ] ] ].
>> +       ^ rep isSymbol
>> +               ifTrue: [ self defaultRepositoryFor: rep -> anAssociation value ]
>> +               ifFalse: [ rep ]!
>>
>> Item was changed:
>>   ----- Method: Installer>>htmlValidator (in category 'external-packages') -----
>>   htmlValidator
>>         "Validates HTML and CSS pages against W3C DTD."
>> +       ^ { #ss3 -> 'htmlcssparser'.
>> +       'HTML' }!
>> -       ^ { #ss -> 'htmlcssparser'.
>> -       'HTML-tb.37' }!
>>
>> Item was changed:
>>   ----- Method: Installer>>setRepository: (in category 'private') -----
>>   setRepository: anAssociation
>> +       currentRepository := self class repositoryFor: anAssociation!
>> -       currentRepository := (self class perform: anAssociation key)
>> -                project: anAssociation value ;
>> -                mc!
>>
>>
>


More information about the Squeak-dev mailing list