Hi!
Is there a way to make Configuration load locally? I tried the following but it does not work -=-=-=-=-=-=-=-=-=-=-=-= baseline100: spec <version: '1.0-baseline'> spec for: #common do: [ spec blessing: #baseline. spec repository: '/Users/alexandrebergel/Desktop/metaspy/package-cache'. spec package: 'Mondrian-Tests-AlexandreBergel.19' ]. -=-=-=-=-=-=-=-=-=-=-=-= I need this to write some unit test of MetacelloBrowser Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
On 01/21/2011 06:50 AM, Alexandre Bergel wrote:
> Hi! > > Is there a way to make Configuration load locally? > > I tried the following but it does not work > -=-=-=-=-=-=-=-=-=-=-=-= > baseline100: spec > <version: '1.0-baseline'> > > spec for: #common do: [ > spec blessing: #baseline. > spec repository: '/Users/alexandrebergel/Desktop/metaspy/package-cache'. > spec > package: 'Mondrian-Tests-AlexandreBergel.19' ]. > -=-=-=-=-=-=-=-=-=-=-=-= > > I need this to write some unit test of MetacelloBrowser > > Cheers, > Alexandre That looks like it should work ... what does the stack look like when you try it ... I've seen "odd behavior" when the package-cache is involved when I try to commit to the package-cache, because the system unconditionally puts a copy into the package-cache before doing the commit and I'd get an error about the version already exists... Dale |
Hi Dale,
Sorry for the late reply, I was away this week end. I wrote a test that reproduce the problem. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= testLoadAndSaveLocally "This test first save the package BitBltPen. This package is present on every Pharo platform. It create a configuration that load the saved that is saved. It then loads the configuration. The test succeeds if no error are raised." | className configCls path mcPackage workingCopy rep version packageName | "We save BitBltPen" mcPackage := (MCPackage named: 'BitBltPen'). workingCopy := mcPackage workingCopy. rep := MCCacheRepository default. version := workingCopy newVersionWithMessage: 'foobar'. rep storeVersion: version. packageName := version info name. "We create the configuration" className := #ConfigurationOfMyProject. Smalltalk globals at: className ifPresent: [ :cls | cls removeFromSystem ]. (MetacelloConfigTemplate duplicateClassWithNewName: className) category: className asString. path := FileDirectory on: (FileDirectory default pathName, '/package-cache'). configCls := Smalltalk globals at: className. configCls compile: 'baseline100: spec <version: ''1.0-baseline''> spec for: #common do: [ spec blessing: #baseline. spec repository: ''', path pathName ,'''. spec package: ''', packageName ,''' ]'. "We load the baseline of the configuration" (configCls project version: '1.0-baseline') load -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Apparently a configuration cannot load packages locally stored. Am i doing something wrong in my test? Cheers, Alexandre On 21 Jan 2011, at 14:24, Dale Henrichs wrote: > On 01/21/2011 06:50 AM, Alexandre Bergel wrote: >> Hi! >> >> Is there a way to make Configuration load locally? >> >> I tried the following but it does not work >> -=-=-=-=-=-=-=-=-=-=-=-= >> baseline100: spec >> <version: '1.0-baseline'> >> >> spec for: #common do: [ >> spec blessing: #baseline. >> spec repository: '/Users/alexandrebergel/Desktop/metaspy/package-cache'. >> spec >> package: 'Mondrian-Tests-AlexandreBergel.19' ]. >> -=-=-=-=-=-=-=-=-=-=-=-= >> >> I need this to write some unit test of MetacelloBrowser >> >> Cheers, >> Alexandre > > That looks like it should work ... what does the stack look like when you try it ... I've seen "odd behavior" when the package-cache is involved when I try to commit to the package-cache, because the system unconditionally puts a copy into the package-cache before doing the commit and I'd get an error about the version already exists... > > Dale > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
can you check if repositoriesOverride: does the job?
On Mon, Jan 24, 2011 at 6:26 PM, Alexandre Bergel <[hidden email]> wrote: Hi Dale, |
There is no implementor of it. I also checked #repositoryOverride:
Alexandre On 24 Jan 2011, at 14:54, Mariano Martinez Peck wrote: > can you check if repositoriesOverride: does the job? > > > On Mon, Jan 24, 2011 at 6:26 PM, Alexandre Bergel <[hidden email]> wrote: > Hi Dale, > > Sorry for the late reply, I was away this week end. > > I wrote a test that reproduce the problem. > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > testLoadAndSaveLocally > "This test first save the package BitBltPen. This package is present on every Pharo platform. > It create a configuration that load the saved that is saved. It then loads the configuration. > The test succeeds if no error are raised." > > | className configCls path mcPackage workingCopy rep version packageName | > > "We save BitBltPen" > mcPackage := (MCPackage named: 'BitBltPen'). > workingCopy := mcPackage workingCopy. > rep := MCCacheRepository default. > version := workingCopy newVersionWithMessage: 'foobar'. > rep storeVersion: version. > packageName := version info name. > > "We create the configuration" > className := #ConfigurationOfMyProject. > Smalltalk globals at: className ifPresent: [ :cls | cls removeFromSystem ]. > > (MetacelloConfigTemplate duplicateClassWithNewName: className) category: className asString. > > path := FileDirectory on: (FileDirectory default pathName, '/package-cache'). > > configCls := Smalltalk globals at: className. > configCls compile: 'baseline100: spec > <version: ''1.0-baseline''> > > spec for: #common do: [ > spec blessing: #baseline. > spec repository: ''', path pathName ,'''. > spec > package: ''', packageName ,''' ]'. > > "We load the baseline of the configuration" > (configCls project version: '1.0-baseline') load > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > Apparently a configuration cannot load packages locally stored. > Am i doing something wrong in my test? > > Cheers, > Alexandre > > > On 21 Jan 2011, at 14:24, Dale Henrichs wrote: > > > On 01/21/2011 06:50 AM, Alexandre Bergel wrote: > >> Hi! > >> > >> Is there a way to make Configuration load locally? > >> > >> I tried the following but it does not work > >> -=-=-=-=-=-=-=-=-=-=-=-= > >> baseline100: spec > >> <version: '1.0-baseline'> > >> > >> spec for: #common do: [ > >> spec blessing: #baseline. > >> spec repository: '/Users/alexandrebergel/Desktop/metaspy/package-cache'. > >> spec > >> package: 'Mondrian-Tests-AlexandreBergel.19' ]. > >> -=-=-=-=-=-=-=-=-=-=-=-= > >> > >> I need this to write some unit test of MetacelloBrowser > >> > >> Cheers, > >> Alexandre > > > > That looks like it should work ... what does the stack look like when you try it ... I've seen "odd behavior" when the package-cache is involved when I try to commit to the package-cache, because the system unconditionally puts a copy into the package-cache before doing the commit and I'd get an error about the version already exists... > > > > Dale > > > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
In reply to this post by Alexandre Bergel-5
Hey Alexandre,
I haven't tried to reproduce your problem (yet), but I'm going to guess that the problem is due to the fact that at times Metacello turns off the package-cache in an attempt to discover which repository the package is being loaded from ... I don't know about you, but I think that it is a mistake to try to use the package-cache as a repository ... if you try to commit a package to the package-cache, you get an error that the file already exists, because Pharo automatically sticks a copy of the package into the repository ... I have run into those kinds of problems using the package-cache in my unit tests and I recommend that you avoid using it... For unit tests, I suggest that you use a Dictionary repository...that's what Gofer does and that's what I have been doing .... You can specify a dictionary repository in Metacllo witht he following expresion: spec repository: 'dictionary://Metacello_Gofer_Test_Repository'. You are specifying that the global name #Metacello_Gofer_Test_Repository will resolve to a dictionary repository (note that one will be created there if it doesn't already exist) See Metacello-TestsMC-Resources for examples of creating complete sets of packages/configurations for tests ... you might even consider using those resources in your tests... You should look at the Metacello tests for examples of writing the unit tests ... there are around 400 tests now, so if you have a specific type of test you want to write, ask me and I'll try to find something similar that you can use as an example... Dale On 01/24/2011 09:26 AM, Alexandre Bergel wrote: > Hi Dale, > > Sorry for the late reply, I was away this week end. > > I wrote a test that reproduce the problem. > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > testLoadAndSaveLocally > "This test first save the package BitBltPen. This package is present on every Pharo platform. > It create a configuration that load the saved that is saved. It then loads the configuration. > The test succeeds if no error are raised." > > | className configCls path mcPackage workingCopy rep version packageName | > > "We save BitBltPen" > mcPackage := (MCPackage named: 'BitBltPen'). > workingCopy := mcPackage workingCopy. > rep := MCCacheRepository default. > version := workingCopy newVersionWithMessage: 'foobar'. > rep storeVersion: version. > packageName := version info name. > > "We create the configuration" > className := #ConfigurationOfMyProject. > Smalltalk globals at: className ifPresent: [ :cls | cls removeFromSystem ]. > > (MetacelloConfigTemplate duplicateClassWithNewName: className) category: className asString. > > path := FileDirectory on: (FileDirectory default pathName, '/package-cache'). > > configCls := Smalltalk globals at: className. > configCls compile: 'baseline100: spec > <version: ''1.0-baseline''> > > spec for: #common do: [ > spec blessing: #baseline. > spec repository: ''', path pathName ,'''. > spec > package: ''', packageName ,''' ]'. > > "We load the baseline of the configuration" > (configCls project version: '1.0-baseline') load > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > > Apparently a configuration cannot load packages locally stored. > Am i doing something wrong in my test? > > Cheers, > Alexandre > > > On 21 Jan 2011, at 14:24, Dale Henrichs wrote: > >> On 01/21/2011 06:50 AM, Alexandre Bergel wrote: >>> Hi! >>> >>> Is there a way to make Configuration load locally? >>> >>> I tried the following but it does not work >>> -=-=-=-=-=-=-=-=-=-=-=-= >>> baseline100: spec >>> <version: '1.0-baseline'> >>> >>> spec for: #common do: [ >>> spec blessing: #baseline. >>> spec repository: '/Users/alexandrebergel/Desktop/metaspy/package-cache'. >>> spec >>> package: 'Mondrian-Tests-AlexandreBergel.19' ]. >>> -=-=-=-=-=-=-=-=-=-=-=-= >>> >>> I need this to write some unit test of MetacelloBrowser >>> >>> Cheers, >>> Alexandre >> >> That looks like it should work ... what does the stack look like when you try it ... I've seen "odd behavior" when the package-cache is involved when I try to commit to the package-cache, because the system unconditionally puts a copy into the package-cache before doing the commit and I'd get an error about the version already exists... >> >> Dale >> > |
In reply to this post by Alexandre Bergel-5
The selector is MetacelloMCVersion>>repositoryOverrides: .. it might
work, but I have grown tired of fighting problems with trying to use the package-cache in unit tests and I recommend to take another route:) Dale On 01/24/2011 10:20 AM, Alexandre Bergel wrote: > There is no implementor of it. I also checked #repositoryOverride: > > Alexandre > > On 24 Jan 2011, at 14:54, Mariano Martinez Peck wrote: > >> can you check if repositoriesOverride: does the job? >> >> >> On Mon, Jan 24, 2011 at 6:26 PM, Alexandre Bergel<[hidden email]> wrote: >> Hi Dale, >> >> Sorry for the late reply, I was away this week end. >> >> I wrote a test that reproduce the problem. >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> testLoadAndSaveLocally >> "This test first save the package BitBltPen. This package is present on every Pharo platform. >> It create a configuration that load the saved that is saved. It then loads the configuration. >> The test succeeds if no error are raised." >> >> | className configCls path mcPackage workingCopy rep version packageName | >> >> "We save BitBltPen" >> mcPackage := (MCPackage named: 'BitBltPen'). >> workingCopy := mcPackage workingCopy. >> rep := MCCacheRepository default. >> version := workingCopy newVersionWithMessage: 'foobar'. >> rep storeVersion: version. >> packageName := version info name. >> >> "We create the configuration" >> className := #ConfigurationOfMyProject. >> Smalltalk globals at: className ifPresent: [ :cls | cls removeFromSystem ]. >> >> (MetacelloConfigTemplate duplicateClassWithNewName: className) category: className asString. >> >> path := FileDirectory on: (FileDirectory default pathName, '/package-cache'). >> >> configCls := Smalltalk globals at: className. >> configCls compile: 'baseline100: spec >> <version: ''1.0-baseline''> >> >> spec for: #common do: [ >> spec blessing: #baseline. >> spec repository: ''', path pathName ,'''. >> spec >> package: ''', packageName ,''' ]'. >> >> "We load the baseline of the configuration" >> (configCls project version: '1.0-baseline') load >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> >> Apparently a configuration cannot load packages locally stored. >> Am i doing something wrong in my test? >> >> Cheers, >> Alexandre >> >> >> On 21 Jan 2011, at 14:24, Dale Henrichs wrote: >> >>> On 01/21/2011 06:50 AM, Alexandre Bergel wrote: >>>> Hi! >>>> >>>> Is there a way to make Configuration load locally? >>>> >>>> I tried the following but it does not work >>>> -=-=-=-=-=-=-=-=-=-=-=-= >>>> baseline100: spec >>>> <version: '1.0-baseline'> >>>> >>>> spec for: #common do: [ >>>> spec blessing: #baseline. >>>> spec repository: '/Users/alexandrebergel/Desktop/metaspy/package-cache'. >>>> spec >>>> package: 'Mondrian-Tests-AlexandreBergel.19' ]. >>>> -=-=-=-=-=-=-=-=-=-=-=-= >>>> >>>> I need this to write some unit test of MetacelloBrowser >>>> >>>> Cheers, >>>> Alexandre >>> >>> That looks like it should work ... what does the stack look like when you try it ... I've seen "odd behavior" when the package-cache is involved when I try to commit to the package-cache, because the system unconditionally puts a copy into the package-cache before doing the commit and I'd get an error about the version already exists... >>> >>> Dale >>> >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> > |
In reply to this post by Dale Henrichs
Ok, looks good!
I will try. Thanks! Cheers, Alexandre On 24 Jan 2011, at 15:22, Dale Henrichs wrote: > Hey Alexandre, > > I haven't tried to reproduce your problem (yet), but I'm going to guess that the problem is due to the fact that at times Metacello turns off the package-cache in an attempt to discover which repository the package is being loaded from ... > > I don't know about you, but I think that it is a mistake to try to use the package-cache as a repository ... if you try to commit a package to the package-cache, you get an error that the file already exists, because Pharo automatically sticks a copy of the package into the repository ... I have run into those kinds of problems using the package-cache in my unit tests and I recommend that you avoid using it... > > For unit tests, I suggest that you use a Dictionary repository...that's what Gofer does and that's what I have been doing .... You can specify a dictionary repository in Metacllo witht he following expresion: > > spec repository: 'dictionary://Metacello_Gofer_Test_Repository'. > > You are specifying that the global name #Metacello_Gofer_Test_Repository will resolve to a dictionary repository (note that one will be created there if it doesn't already exist) > > See Metacello-TestsMC-Resources for examples of creating complete sets of packages/configurations for tests ... you might even consider using those resources in your tests... > > You should look at the Metacello tests for examples of writing the unit tests ... there are around 400 tests now, so if you have a specific type of test you want to write, ask me and I'll try to find something similar that you can use as an example... > > Dale > > > On 01/24/2011 09:26 AM, Alexandre Bergel wrote: >> Hi Dale, >> >> Sorry for the late reply, I was away this week end. >> >> I wrote a test that reproduce the problem. >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> testLoadAndSaveLocally >> "This test first save the package BitBltPen. This package is present on every Pharo platform. >> It create a configuration that load the saved that is saved. It then loads the configuration. >> The test succeeds if no error are raised." >> >> | className configCls path mcPackage workingCopy rep version packageName | >> >> "We save BitBltPen" >> mcPackage := (MCPackage named: 'BitBltPen'). >> workingCopy := mcPackage workingCopy. >> rep := MCCacheRepository default. >> version := workingCopy newVersionWithMessage: 'foobar'. >> rep storeVersion: version. >> packageName := version info name. >> >> "We create the configuration" >> className := #ConfigurationOfMyProject. >> Smalltalk globals at: className ifPresent: [ :cls | cls removeFromSystem ]. >> >> (MetacelloConfigTemplate duplicateClassWithNewName: className) category: className asString. >> >> path := FileDirectory on: (FileDirectory default pathName, '/package-cache'). >> >> configCls := Smalltalk globals at: className. >> configCls compile: 'baseline100: spec >> <version: ''1.0-baseline''> >> >> spec for: #common do: [ >> spec blessing: #baseline. >> spec repository: ''', path pathName ,'''. >> spec >> package: ''', packageName ,''' ]'. >> >> "We load the baseline of the configuration" >> (configCls project version: '1.0-baseline') load >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> >> Apparently a configuration cannot load packages locally stored. >> Am i doing something wrong in my test? >> >> Cheers, >> Alexandre >> >> >> On 21 Jan 2011, at 14:24, Dale Henrichs wrote: >> >>> On 01/21/2011 06:50 AM, Alexandre Bergel wrote: >>>> Hi! >>>> >>>> Is there a way to make Configuration load locally? >>>> >>>> I tried the following but it does not work >>>> -=-=-=-=-=-=-=-=-=-=-=-= >>>> baseline100: spec >>>> <version: '1.0-baseline'> >>>> >>>> spec for: #common do: [ >>>> spec blessing: #baseline. >>>> spec repository: '/Users/alexandrebergel/Desktop/metaspy/package-cache'. >>>> spec >>>> package: 'Mondrian-Tests-AlexandreBergel.19' ]. >>>> -=-=-=-=-=-=-=-=-=-=-=-= >>>> >>>> I need this to write some unit test of MetacelloBrowser >>>> >>>> Cheers, >>>> Alexandre >>> >>> That looks like it should work ... what does the stack look like when you try it ... I've seen "odd behavior" when the package-cache is involved when I try to commit to the package-cache, because the system unconditionally puts a copy into the package-cache before doing the commit and I'd get an error about the version already exists... >>> >>> Dale >>> >> > > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
Free forum by Nabble | Edit this page |