MooseMetacelloWizard code review

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

MooseMetacelloWizard code review

Simon Denier-3
Hi Dale

I would be very glad if you could take a look at the current implementation of class MooseMetacelloWizard in package Moose-Wizard and tell us if you notice any wrong doing with Metacello API.

I still have two more minor questions:
- how do I programmatically set a description for a version from MetacelloVersionConstructor?
- how can I force-revert to the non-dirty Configuration if I want to discard a version method I just created (say, the developer aborts the commit at the last minute)?


--
 Simon



To unsubscribe from this group, send email to metacello+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: MooseMetacelloWizard code review

Dale
Simon,

Everything looks just fine.

I would suggest that you change your algorithm for packagesNeedSaving: to be based on using #record: sent a version instead of #packagesNeedSaving: sent to a project. This is new to 1.0-beta.25, but allows you to find nested dirty packages. I will be deprecating #packagesNeedSaving: sooner or later.

See OBCmdMetacelloNestedSavePackages>>packagesNeedSaving: for an example.

| - how do I programmatically set a description for a version from
| MetacelloVersionConstructor?

If you've got the version then you use:

  version spec description: 'description'

Or are you asking a different question?

| - how can I force-revert to the non-dirty Configuration if I want to
| discard a version method I just created (say, the developer aborts the
| commit at the last minute)?

Hmmm, you could remove the method. Or something like the following would work:

  | pkg loader |
  pkg := ConfigurationOfXXX project projectPackage.
  loader := pkg loader fetchingSpecLoader.
  loader
    explicitLoadPackageSpecs: (Array with: pkg)
    repositories: (loader repositoriesFrom: pkg repositorySpecs).

which will do an updateProject but bypass the dirty check. Or I could add a #revert message to MetacelloPackageSpec to complement the #load.

Dale
----- "Simon Denier" <[hidden email]> wrote:

| Hi Dale
|
| I would be very glad if you could take a look at the current
| implementation of class MooseMetacelloWizard in package Moose-Wizard
| and tell us if you notice any wrong doing with Metacello API.
|
| I still have two more minor questions:
| - how do I programmatically set a description for a version from
| MetacelloVersionConstructor?
| - how can I force-revert to the non-dirty Configuration if I want to
| discard a version method I just created (say, the developer aborts the
| commit at the last minute)?
|
|
| --
|  Simon
|
|
|
| To unsubscribe from this group, send email to
| metacello+unsubscribegooglegroups.com or reply to this email with the
| words "REMOVE ME" as the subject.

To unsubscribe from this group, send email to metacello+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: MooseMetacelloWizard code review

Simon Denier-3

On 24 mars 2010, at 20:01, Dale Henrichs wrote:

> Simon,
>
> Everything looks just fine.
>
> I would suggest that you change your algorithm for packagesNeedSaving: to be based on using #record: sent a version instead of #packagesNeedSaving: sent to a project. This is new to 1.0-beta.25, but allows you to find nested dirty packages. I will be deprecating #packagesNeedSaving: sooner or later.


I am not sure I understand how record: works from the sample I saw.


>
> See OBCmdMetacelloNestedSavePackages>>packagesNeedSaving: for an example.
>
> | - how do I programmatically set a description for a version from
> | MetacelloVersionConstructor?
>
> If you've got the version then you use:
>
>  version spec description: 'description'
>
> Or are you asking a different question?


Yes, I am wondering how to add the description when we spawn the method in the configuration class.


--
 Simon



To unsubscribe from this group, send email to metacello+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: MooseMetacelloWizard code review

Dale
In reply to this post by Simon Denier-3
What #record: gives is the structure of your entire nested project/version stack.

  (version record: 'ALL') loadDirective
    versionDirectivesDo: [:loaderDirective | | coll |
      coll := OrderedCollection new.
      loaderDirective packagesDo: [:packageDirective |
        "answers true if working copy of package is dirty"
        (self packageNeedsSaving: packageDirective spec)
          ifTrue: [ coll add: packageDirective ]].
      coll notEmpty
        ifTrue: [ "col contains list of dirty packages in the version"]].

#vesionDirectivesDo: hits the versionSpec of each configuration (depth first).
#packagesDo: traverses all of the packageSpecs within the versionSpec

The versionSpec is wrapped by a MetacelloVersionLoadDirective and the packageSpec is wrapped by a MetacelloPackageLoadDirective.

The old algorithm for finding dirty packages, didn't recurse through project/versions.

#record: gives you a cleaner way to traverse the nested structure and it is not restricted to a single purpose ...  

Regarding the #description, I will have to add it to the api ... I think at this point it is probably time to stop adding an arg for every attribute and possibly use something like an initialization block that fives you access to the freshly spawned versionSpec and then you will be able to set any of the attributes that you want before the new method is created and compiled...

Dale

----- "Simon Denier" <[hidden email]> wrote:

| On 24 mars 2010, at 20:01, Dale Henrichs wrote:
|
| > Simon,
| >
| > Everything looks just fine.
| >
| > I would suggest that you change your algorithm for
| packagesNeedSaving: to be based on using #record: sent a version
| instead of #packagesNeedSaving: sent to a project. This is new to
| 1.0-beta.25, but allows you to find nested dirty packages. I will be
| deprecating #packagesNeedSaving: sooner or later.
|
|
| I am not sure I understand how record: works from the sample I saw.
|
|
| >
| > See OBCmdMetacelloNestedSavePackages>>packagesNeedSaving: for an
| example.
| >
| > | - how do I programmatically set a description for a version from
| > | MetacelloVersionConstructor?
| >
| > If you've got the version then you use:
| >
| >  version spec description: 'description'
| >
| > Or are you asking a different question?
|
|
| Yes, I am wondering how to add the description when we spawn the
| method in the configuration class.
|
|
| --
|  Simon
|
|
|
| To unsubscribe from this group, send email to
| metacello+unsubscribegooglegroups.com or reply to this email with the
| words "REMOVE ME" as the subject.

To unsubscribe from this group, send email to metacello+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.