what is the MooseMonticelloImporter exactly?

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

what is the MooseMonticelloImporter exactly?

Stéphane Ducasse
I discovered MooseMonticelloImporter…. :)
and some methods cannot compile :)

I would merge MooseMonticelloPopulator and MooseMonticelloVisitor (because this is about only 3 stupid accessors).


scope is undeclared. :(
sad it means that there are not tests :(





importFileNamed: name
        | version definitions visitor progressBar step |
        self setMooseModel.
       
        [ version := self repository versionFromFileNamed: name. ]
                on: Error
                do: [:ex | self inform: 'Package ', name, ' not accessible from the file system?'. ^ self targetModel].
               
        definitions := version snapshot definitions.
       
       
        MooseCustomTask runWithProgress: [:bar |
                visitor := MooseMonticelloClassPopulator new importer: self.
                definitions do: [ :def | def accept: visitor.
                        bar increment].
        ] description: 'Importing classes' length: (definitions size).

        self setSuperclassesAndCreateStubs.

        "create a scope, this is necessary for the method visitor which is VW aware"
        scope := Dictionary new.
        self targetModel allClasses do: [:famixClass |
                famixClass attributes do: [:famixAttribute |
                        (self scopeOfClass: famixClass) at: famixAttribute name bind: famixAttribute]].


        MooseCustomTask runWithProgress: [:bar |
                "import methods"
                definitions do: [ :def |
                        (def isKindOf: MCMethodDefinition)
                        ifTrue: [
                                visitor := MooseMonticelloMethodPopulator new importer: self.
                                def accept: visitor.
                                self targetModel addAll: visitor entities]].
                        bar increment.
                ] description: 'Importing methods' length: (definitions size).


        ^ self targetModel
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the MooseMonticelloImporter exactly?

Stéphane Ducasse
I would merge MooseMonticelloPopulator and MooseMonticelloVisitor (because this is about only 3 stupid accessors).

=> Done and published.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the MooseMonticelloImporter exactly?

abergel
In reply to this post by Stéphane Ducasse
> I discovered MooseMonticelloImporter…. :)
> and some methods cannot compile :)
>
> I would merge MooseMonticelloPopulator and MooseMonticelloVisitor (because this is about only 3 stupid accessors).
>
>
> scope is undeclared. :(
> sad it means that there are not tests :(

There is a test called MooseMonticelloImporterTest.
The test is not extensive, this is a pity, but writing tests for Monticello or Metacello is difficult and extremely time consuming.

I spent some times now on improving the code and the tests.

'scope' is indeed undeclared, but it was unnecessary. I cleaned the class a bit.

Moose-MonticelloImporter-AlexandreBergel.25
Moose-Tests-MonticelloImporter-AlexandreBergel.3
are in da box!

Cheers,
Alexandre



>
>
>
>
>
> importFileNamed: name
> | version definitions visitor progressBar step |
> self setMooseModel.
>
> [ version := self repository versionFromFileNamed: name. ]
> on: Error
> do: [:ex | self inform: 'Package ', name, ' not accessible from the file system?'. ^ self targetModel].
>
> definitions := version snapshot definitions.
>
>
> MooseCustomTask runWithProgress: [:bar |
> visitor := MooseMonticelloClassPopulator new importer: self.
> definitions do: [ :def | def accept: visitor.
> bar increment].
> ] description: 'Importing classes' length: (definitions size).
>
> self setSuperclassesAndCreateStubs.
>
> "create a scope, this is necessary for the method visitor which is VW aware"
> scope := Dictionary new.
> self targetModel allClasses do: [:famixClass |
> famixClass attributes do: [:famixAttribute |
> (self scopeOfClass: famixClass) at: famixAttribute name bind: famixAttribute]].
>
>
> MooseCustomTask runWithProgress: [:bar |
> "import methods"
> definitions do: [ :def |
> (def isKindOf: MCMethodDefinition)
> ifTrue: [
> visitor := MooseMonticelloMethodPopulator new importer: self.
> def accept: visitor.
> self targetModel addAll: visitor entities]].
> bar increment.
> ] description: 'Importing methods' length: (definitions size).
>
>
> ^ self targetModel
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the MooseMonticelloImporter exactly?

abergel
In reply to this post by Stéphane Ducasse

When I wrote this I was maybe inspired from something else.
But yes, your new version makes sense.

Alexandre


On 13 Nov 2011, at 19:57, Stéphane Ducasse wrote:

> I would merge MooseMonticelloPopulator and MooseMonticelloVisitor (because this is about only 3 stupid accessors).
>
> => Done and published.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the MooseMonticelloImporter exactly?

Stéphane Ducasse
Thanks.
Did you merge my version?

> When I wrote this I was maybe inspired from something else.
> But yes, your new version makes sense.
>
> Alexandre
>
>
>> I would merge MooseMonticelloPopulator and MooseMonticelloVisitor (because this is about only 3 stupid accessors).
>>
>> => Done and published.
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: what is the MooseMonticelloImporter exactly?

abergel
> Thanks.
> Did you merge my version?

Yes

Alexandre

>
>> When I wrote this I was maybe inspired from something else.
>> But yes, your new version makes sense.
>>
>> Alexandre
>>
>>
>>> I would merge MooseMonticelloPopulator and MooseMonticelloVisitor (because this is about only 3 stupid accessors).
>>>
>>> => Done and published.
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev