Author Topic: One step project creation  (Read 5202 times)

davew

  • Senior Community Member
  • Posts: 224
  • Hero Points: 6
One step project creation
« on: September 26, 2008, 01:22:33 am »
I often create projects in which I must specify about 5 folder trees (using Add Tree). It takes a while to navigate to all of these folders and I would like to be able to do this in one step.

I have managed to get it pretty close by doing the following:
- Created a text file which contains the list of folders I want to add files from.
- Wrote a Perl script which takes a ClearCase view as an argument, opens this file and adds the path to the folder names and stores in another file.
- Wrote a Slick-C macro that takes the same view name and calls the Perl script, then calls workspace_new_project.

Now I run the macro and with the Project Properties dialog displayed, I do the following:
- Click on Import... and specify the Perl script resulting file.
- Check "Recurse directories" and "File types" and specify the types that I want.
- I then click OK and the files are added to the project.
- Click OK again to tag the files.

The next time I create a project and click on Import..., the info is filled in, so all I have to do is click OK.

Not too bad, but it would be great to be able to create a project by just specifying a macro name followed by my view name and all the magic happens from there.

I've looked at the Slick-C involved in project creation and it appears that I would have to do some significant modification to get what I want. I don't like to modify the provided scripts (although I've done it several times), because I have to merge my changes into each new release.

Anyone know a better way?

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: One step project creation
« Reply #1 on: September 26, 2008, 02:05:10 am »
Check out the macro in this topic.

davew

  • Senior Community Member
  • Posts: 224
  • Hero Points: 6
Re: One step project creation
« Reply #2 on: September 26, 2008, 08:03:32 pm »
Thanks chrisant. I'll check this out more closely this weekend to see if it works for me.

davew

  • Senior Community Member
  • Posts: 224
  • Hero Points: 6
Re: One step project creation
« Reply #3 on: September 28, 2008, 06:33:56 pm »
Nice macro, bu that's not quite what I was talking about. Here is how I work. I work from multiple ClearCase views and I need to have a project for each. The view names change frequently. As new releases are done (at least every week), I get a new view with a new name.

My issue is that I want to type a command, specify the view name, and a project is created automatically that includes all files from a list of folders that I always work with. The macro that you indicate assumes the existence of the project beforehand.

As I said, I have it to the point that I can type a macro name followed by a view name. Then the Project Properties dialog is popped up with the info filled in. Then I just click on Import... and click OK twice and I'm done. Maybe I'm a little too lazy, but I would like to do this in one step.

I could possibly use your macro or something similar if there was a way of renaming a project, but I don't think this is possible.

Command line project creation in which all values can be specified instead of having to go through the gui would be great. It's too bad SlickEdit is not designed such that all gui options could also be specified on the command line.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: One step project creation
« Reply #4 on: September 28, 2008, 08:26:39 pm »
The macro I pointed to shows how to populate the files in the project.  If you already wrote a macro that does that, then you probably are set, on that end of things.

A project file (.vpj) is just an XML file.
You can copy a .vpj file, change properties inside it, etc.
You can even create a new .vpj file by writing out the XML properties.

Does that help?

You could also look through the .e macro code for creating a new project and/or workspace, and either do similar things yourself, or call those functions.

hs2

  • Senior Community Member
  • Posts: 2752
  • Hero Points: 291
Re: One step project creation
« Reply #5 on: September 28, 2008, 10:01:56 pm »
I'm frequently adjusting/cloning exitisting SE projects/workspaces by directly editing the vpj/vpw files. It's quite easy to do and fast and could even be done in Slick-C w/o too much effort.
SE provides GUI only implementations for functions e.g. dealing with lists/trees of items. That's hard to do on the commandline and would require a generic but sophisticated selection list/tree support. In addtion you'd probably need mult. commands to execute complex tasks like creating a project.
And I afraid these functions would be used by <1% of all SE users. So it wont get a hi prio to implement them...
Just my 2ct, HS2

davew

  • Senior Community Member
  • Posts: 224
  • Hero Points: 6
Re: One step project creation
« Reply #6 on: September 29, 2008, 12:28:58 pm »
Thanks for the response guys. I have thought about modifying the SE macros or calling existing ones. However, I don't want to modify and have to port my changes every release. Copying/calling existing code might be an option. I would just have to find the time to do this. I have also thought about creating the XML project files which may be the easiest method. I guess later versions of SE will have to continue to read old XML versions for a while.

If I can come up with something shareable, I'll post it.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: One step project creation
« Reply #7 on: September 29, 2008, 05:48:23 pm »
I can understand being concerned that the Slick team will change their XML APIs such that it breaks all macros that use the XML APIs, but that seems highly unlikely...

Anyway, that's what my first suggestion was about:  you can create a template .vpj file that is set up the way you like, minus the files.  Simply copy and rename it, then programmatically add the files, using the sync_project_with_scm.e macro as example code for how to do it (there is no XML processing involved at all).

I recommend opening a .vpj file and peeking inside it to see what's there (and what isn't there -- for example the project name is the filename; the name is not embedded anywhere inside the project file).  I think what you want may be a lot easier than you're fearing.