Forum Index  ViceVersa HOME         FAQ and Knowledge Base

 FAQForum FAQ   SearchSearch Forum  RegisterRegister 
 ProfileProfile   Log inLog in 

Folder Variable that increments a version number

 
Post new topic   Reply to topic     Forum Index -> Wish List
Author Message
Wollrabe



Joined: 26 Aug 2010
Posts: 35

PostPosted: Tue Dec 07, 2010 1:34 am    Post subject: Folder Variable that increments a version number Reply with quote

In my Target folder, I create a build folder using folder environment variables, ex. build<year>_<month>_<day>

This works great, except if you have multiple builds for the same day. I don't want to use Time, or Hours, Minutes, Seconds. I wish there was a folder variable that would increment a number. ex. build<year>_<month>_<day>_V<incr>

So the results could look like:
build2010_12_06_V1
build2010_12_06_V2
build2010_12_06_V3
build2010_12_06_V4
Back to top
TGRMN Software
Site Admin


Joined: 10 Jan 2005
Posts: 8769

PostPosted: Tue Dec 07, 2010 4:48 am    Post subject: Reply with quote

Hi, I think this could be done already with a script to run before the profile starts (profile settings -> advanced settings): the script should increment a registry value and set an environment variable (e.g. mybuildnumber) which can then be used in ViceVersa with:

build<year>_<month>_<day>_V<mybuildnumber>
_________________
--
TGRMN Software Support
http://www.tgrmn.com
http://www.compareandmerge.com
Back to top
Wollrabe



Joined: 26 Aug 2010
Posts: 35

PostPosted: Thu Dec 09, 2010 2:02 am    Post subject: Folder Variable that increments a version number Reply with quote

I tried you suggestion, and i see the System Environment Variable created with the correct value in the My Computer> Properties >Advanced > Environment Variables, but when calling the environment value in the target folder name <buildfolder>, i keep getting an error "invalid parameter syntax, unknown parameter <buildfolder>. It's like in the vv profile session, it is not seeing the environment variable that was created by the vbs script prior to the compare.
Back to top
Wollrabe



Joined: 26 Aug 2010
Posts: 35

PostPosted: Thu Dec 09, 2010 2:12 am    Post subject: Folder Variable that increments a version number Reply with quote

When I completely got out of my vvprofile, closed the profile, then got back in, it then prompted to create the new folder. So it does catch the environment variable, but not if you already have the profile open and run compare. Is there somehow a way to refresh the profile to catch the newly created environment variable without closing the profile and reopening it? Because the environment variable could change everytime the script is run.
Back to top
TGRMN Software
Site Admin


Joined: 10 Jan 2005
Posts: 8769

PostPosted: Thu Dec 09, 2010 11:55 am    Post subject: Reply with quote

Can you try running the script outside ViceVersa (before starting ViceVersa) from a batch file, eg

- run your custom script
- start ViceVersa profile

is VV picking up the env variable in this configuration ?
_________________
--
TGRMN Software Support
http://www.tgrmn.com
http://www.compareandmerge.com
Back to top
Wollrabe



Joined: 26 Aug 2010
Posts: 35

PostPosted: Thu Dec 09, 2010 8:11 pm    Post subject: Folder Variable that increments a version number Reply with quote

Yes in the scenario you describe, VV does pickup the environment variable and created the build folder in the target location using the <buildfolder> environment variable.

So my take is that VV reads in the Environment variables when the profile is launched.

It would be better if the Evironment variables were either read or re-read at the time the Compare button was executed. Here's why:

I'm the Build Master for BPA Bonneville Power Administration (Department of Energy). We have hundreds of applications that we build and deploy. Vice Versa works excellent for deployments. I have written several vbscripts that run prior to the compare execution and after the execution. We have a VV profile setup for each application, one for Test environments and one for Production environments. When we move an application build into the Test environment, we copy to a DFS Share for that application. I create a Build folder using 'build<year>_<month>_<day> format. In a vbScript I set an environment variable 'buildfolder' and i use that environment variable to build the Target path. Ex: SourceControl\Deployment_Test\xxxxx\xxxxxx\<buildfolder>\

This works as you say, if you run the script first (which builds the environment variable for buildfolder). And then open up the VV profile.
But the next thing we need to consider is this: What if you have multiple builds for the same application on the same day! We don't want to copy the second build into the same build2010_12_09 build folder! So we need to write a vbScript that runs when you click on Compare, it creates the buildfolder environment variable, checks to see if the folder already exists in the DFS share, if it does it checks to see what the last incremental folder was for that day, and then updates the environment variable for the next incremental version, and then the target is updated and creates the next sequenced folder.

build2010_12_09.01
build2010_12_09.02 (buildfolder environment variable now contains this!)

The vbs script would run for every vv profile that we have for every application. Some will only have one build folder for the day, but some may have multiple builds in one day. So running the script prior to opening the vv profile will not work. It needs to run the script at the time of the Compare click, and create the updated environment variable at that time.

Clear as mud? The best scenario would be to have a VV environment variable called <incr> that is just an incremental number. Then you could code agains that value and see if the folder already exists or not, and if so, create the next incremental folder....

Do you have any better ideas for this?

Email me here and maybe I can giveyou my phone# and talk to you on the phone: wrwollrabe@bpa.gov
Back to top
Wollrabe



Joined: 26 Aug 2010
Posts: 35

PostPosted: Fri Dec 10, 2010 1:25 am    Post subject: Folder Variable that increments a version number Reply with quote

In the mean time we are appending <time> to the target folder path. That will work, it just makes for longer file names. Next I want to create some code that captures the folder that was created, so that when we move from Test to Production, it can automatically build the Source path with the latest folder that was created. Otherwise you are always needing to edit the profile and change the Source path to point to the correct build folder.
Back to top
TGRMN Software
Site Admin


Joined: 10 Jan 2005
Posts: 8769

PostPosted: Fri Dec 10, 2010 5:02 am    Post subject: Reply with quote

Yes, you are right: custom scripts run after source and target folder variables are expanded. The reason behind this is that you often need to access the expanded folder from your scripts, via the VV_SOURCE_FOLDER or VV_TARGET_FOLDER variables, which are set by ViceVersa as env. variables.
What's probably needed is an option to run scripts before the folders are expanded....
_________________
--
TGRMN Software Support
http://www.tgrmn.com
http://www.compareandmerge.com
Back to top
Wollrabe



Joined: 26 Aug 2010
Posts: 35

PostPosted: Fri Dec 10, 2010 4:37 pm    Post subject: Folder Variable that increments a version number Reply with quote

Yes exactly! Put that on my wish list! Need an option to run scripts before the folders are expanded....

Thanks!
Waldo
Back to top
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group
Copyright © TGRMN Software. TGRMN Software products: