metacello icon indicating copy to clipboard operation
metacello copied to clipboard

Updating an existing project from a baseline

Open codeZeilen opened this issue 9 years ago • 5 comments

For a project (https://github.com/hpi-swa/vivide) we have a baseline with all used dependencies, some also providing a Metacello baseline. If we want to use the project baseline to update the code of the project and its dependencies to the currently available version in the github repositories we have to do the following:

{ Metacello new
  baseline: 'Signals';
  repository: 'github://marceltaeumel/signals:master/repository'.
Metacello new
  baseline: 'Animations';
  repository: 'github://marceltaeumel/animations:master/repository'.
Metacello new
  baseline: 'Widgets';
  repository: 'github://marceltaeumel/widgets:master/repository'.
Metacello new
  baseline: 'Vivide';
  repository: 'github://hpi-swa/vivide/repository'. }
do: [ :baseline | baseline get ];
do: [ :baseline | baseline load].

Now the question is: Is there an easier way to achieve this? :)

codeZeilen avatar May 06 '15 11:05 codeZeilen

Which is the hard part:)? Having to supply a list or doing separate #get, #load?

I'll guess the separate #get and #load.

With the fix for Issue #230 in 1.0.0-beta.32.1 there is no need for separate invocations and the following should be fine:

{ Metacello new
  baseline: 'Signals';
  repository: 'github://marceltaeumel/signals:master/repository'.
Metacello new
  baseline: 'Animations';
  repository: 'github://marceltaeumel/animations:master/repository'.
Metacello new
  baseline: 'Widgets';
  repository: 'github://marceltaeumel/widgets:master/repository'.
Metacello new
  baseline: 'Vivide';
  repository: 'github://hpi-swa/vivide/repository'. }
do: [ :baseline | baseline get; load].

Sorry for taking so long to respond, but I've taken a vacation and then worked single mindedly on the my GemStone 3.3 contributions in the last month and am just now working off my email backlog.

dalehenrich avatar May 28 '15 21:05 dalehenrich

No worries about response times :) This is a minor issue anyway.

I was thinking about the list, as this list is already given in the baseline of Vivide and I currently have to manually restate it. Or is there another way, which I'm currently missing? :)

codeZeilen avatar Jun 02 '15 07:06 codeZeilen

Ah, yes ... since these are github repos, Metacello does not automatically re-download the zip file from github every time ... For one, it can be expensive to re-download every time. For another, you may not want to get a fresh download every time - loading the head of a branch is like loading the bleeding edge, you may or may not like what you get. Finally, if you are not on the network, you want to be able to loads with having to time out and/or ignore network errors.

You can use a coupld of different techniques to force Metacello to download a new copy of the zip file from github:

  1. The get command for a baseline will do a fresh download of the zip file and load a new copy of the baseline into your image. So the following would work:

    Metacello image
     baseline: 'Signals';
     get.
    Metacello image
     baseline: 'Animations';
     get.
    Metacello image
     baseline: 'Widgets';
     get.
    Metacello image
     baseline: 'Vivide';
     get.
    
  2. Do a flushCache on the monticello repositories:

    MCFileBasedRepository flushAllCaches
    

If you think it might be a good idea I could add a flushCache command to Metacello, although Metacello image baseline: 'xxx'; get is about as compact as it can get:).

dalehenrich avatar Jun 02 '15 16:06 dalehenrich

I think the separate get and load calls are fine, as this separation is sometimes quite useful.

Would it also be an option to only flush the caches of the repositories of dependencies of 'Vivide' to avoid writing down the first three calls?

codeZeilen avatar Jun 07 '15 16:06 codeZeilen

Yeah, I guess I could add a flushCache or nestedGet command but as I think about it, the code to do this would parallel the code for doing a load so instead of adding a separate command, I'd be inclined to add flushCaches as an option to the load command (or maybe use a name like reloadBaselines or forceGet which is what we're really looking to do) and the forceGet would apply to all baselines encountered during the load ... what do you think?

dalehenrich avatar Jun 08 '15 23:06 dalehenrich