Searching Envy

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Searching Envy

Postby dmacqueen » Wed Jan 06, 2010 6:18 am

We need to go back and resurrect some code from an older mgr*.dat file. I want to search for classes or apps that were changed by 'hjohnson'.

I want to do something like this: Envy allApplications select: [:each | each developer = 'hjohnson'], but I can't figure out how to do it.

Thanks,

Donald [|]
dmacqueen
[|]
 
Posts: 27
Joined: Fri Nov 02, 2007 3:40 pm

Re: Searching Envy

Postby marten » Wed Jan 06, 2010 8:40 am

dmacqueen wrote:We need to go back and resurrect some code from an older mgr*.dat file. I want to search for classes or apps that were changed by 'hjohnson'.

I want to do something like this: Envy allApplications select: [:each | each developer = 'hjohnson'], but I can't figure out how to do it.

Thanks,

Donald [|]


Here is some code - as an example - but it's not what you really want. Find all loaded applications, where a special user name is a group member ....

Therefore you may specify, what "developer" means in your case .... that's not really that clear ...

Code: Select all
SubApplication currentlyLoaded select: [ :anApplication |
   (anApplication groupMembers
      detect: [ :eachEMUser | eachEMUser fullName = 'Marten Feldtmann' ] ifNone: [ nil ]) notNil ]


2.nd attempt - now we look for changed classes in all loaded applications:

Code: Select all
| emUserWanted |

emUserWanted := EmUser named: 'Marten Feldtmann'.

Transcript cr ; show: 'Searching for applications changed by <',emUserWanted fullName,'>'.
SubApplication currentlyLoaded do: [ :eachApplication |
   | allChangedClasses |   
   allChangedClasses := eachApplication classes select: [ :eachClass |   (eachClass developerIn: eachApplication) = emUserWanted ].                                 
   allChangedClasses notEmpty ifTrue:[
          Transcript cr ; show: 'Application <',eachApplication name,'> changed by <',emUserWanted fullName,'>'.      
     allChangedClasses do: [ :eachClass |   Transcript cr ; show: 'Class <',eachClass name,'> in <',eachApplication name,'> changed by <',emUserWanted fullName,'>' ].      
        ]
].


... and with the help from Adrian (following post) one gets:

Code: Select all
emUserWanted := EmUser named: 'Marten Feldtmann'.

Transcript cr ; show: 'Searching for applications changed by <',emUserWanted fullName,'>'.
Application allNames do: [:name |
     (Application shadowsFor: name asString) do:[:eachApplication |
   | allChangedClasses |
   
   allChangedClasses := eachApplication classes select: [ :eachClass | (eachClass developerIn: eachApplication) = emUserWanted ].
   allChangedClasses notEmpty ifTrue:[
      Transcript cr ; show: 'Application <',eachApplication name,'> (',eachApplication versionName asString,') changed by <',emUserWanted fullName,'>'.      
      allChangedClasses do: [ :eachClass |
         Transcript cr ; show: 'Class <',eachClass name,'> in <',eachApplication name,'> changed by <',emUserWanted fullName,'>'.      
      ].      
   ]
    ].
]
Last edited by marten on Wed Jan 06, 2010 9:21 am, edited 2 times in total.
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

searching in unloaded app versions

Postby a3aan » Wed Jan 06, 2010 8:54 am

Donald,

In case you want to search apps currently not loaded, or even in a different repository, try (something along the lines of) the code below.

You need to connect to that library (and ignore errors) and then run the script.

Code: Select all
| result |

result := OrderedCollection new.

Application allNames do: [:name |
     (Application shadowsFor: name asString) do:[:app |
          app manager uniqueName = 'hjohnson' ifTrue:[ result add: app ]]].

result


Hope this helps,
Adriaan.
Adriaan van Os
a3aan
[|]
 
Posts: 45
Joined: Fri May 25, 2007 1:41 am

Re: Searching Envy

Postby dmacqueen » Wed Jan 06, 2010 1:19 pm

Marten and Adrian,

Thanks very much. It was shadowsFor: that did the trick.

Fortuneatly, we have kept all our old mgr*.dat libraries.

Donald [|]
dmacqueen
[|]
 
Posts: 27
Joined: Fri Nov 02, 2007 3:40 pm


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest