Thursday, October 8, 2015

ISESteroids Version Control

I have little background in programming, code development and best practices.

My skillset in PowerShell developed by playing continually and trying to cover a need.

As a result I have a large folder of trials, tests, failures, terribly filed notes about tests. 

Incredibly painful to use and navigate.

I bet quite a few people have this same thing going on.

Any programmers that look at it probably feel this way:


This directory content will probably look familiar to some folks!


DoSomethingTest.ps1
DoSomethingTest2.2.ps1
DoSomething1.2.ps1
DoSomethingDraftTest.ps1
DoSomethingDraftTestnotes12.txt
Trythis.ps1
Something Do This To A Thing.ps1

So, a folder of junk.


Versioning was a cool idea.

A concept that I never was taught and I never stopped and took the time to learn.

Terrible habits I developed

Deliberately not saving due to just wanting to test something out.
That whole File>SaveAs was just too much work.
Rambling non-descriptive file names.

Installing the trial of ISESteroids changed everything!


Totally a game changer for me.

After a few hours of clicking around I stumbled on...

“Toggle Script File Versioning Management Tool”


I’m sorry….whats this!?


I saved a script and started playing.

Here’s how it works.


Your initial save does not do anything in this pane.


Check off “Auto Mode” for now and change something in your script.


Hit F5 to run the script.


Let’s change another thing, and make another save.


Oh my goodness! What’s this! I’ll go through what I understand.


Automatic


Upper right, this version was created via auto mode (I’ll get to manual in a moment).

Delete


Deletes this version.

Notes


You can add your own notes to the version, these notes are not saved in the script itself.

Open


This opens the version in a new tab within ISE so you don’t lose what you were actually working on. Note that you need to resave this version as a new file and turn versioning on if you want to sort of branch off.


Compare


Big one here!

Click Compare on Version .01 and you jump right into WinMerge!

This isn’t a guide on how to use WinMerge, but it’s pretty intuitive.

If you make a change, go to File > Save and you can commit your change.



Then when you close WinMerge, PowerShell_ISE will prompt you to reload the file.



Note that by reopening the file in this way, it’s now your current saved version.

It doesn’t create another minor version.

Another note. If you have WinMerge open, you cannot interact with the ISE window until it’s closed.
I thought that ISE had gone wonky and I was going to kill the program before it dawned on me.

Version  Development Status




Click on "Unclassified" and you’ll be able to chose the point at which the version is in development. 

Alpha > Beta > Stable > Internal > Release

Please know that is the sequence in which I see development is ordered, that may not be correct.

Manual Mode?



So, we’ve used Auto Mode, and understand what we’re seeing up there in the pane.

Let’s look at manually adding a version.

Click “Add New Version”


Add New Major Version


Notice how all our saves are small increases? (0.1 -> 0.2 -> 0.3)

This will increment the version in full versions (1.x -> 2.x -> 3.x).

Add New Minor Version


Similar to major version, this just adds a non automatic (non triggered by saving) minor version.

I also noticed if you bump past Version 0.9 it neatly goes to Version 0.10, 0.11 and so on.

Very nice! Another neat thing is that if you delete versions along the way, it remembers what they were, and doesn’t try to “fill in the blank” when you make a new version.


Add New Major Version and Remove Minor Versions


This creates a new V x.00 and deletes ALL the 0.xx versions listed.

You can click cancel and it will just create the Major Version.


Open History Archive in Explorer


Now you can discover how ISESteriods is actually performing all this magic!

Hit this and you will be pointed to a ZIP file sitting in the same folder as your saved (current) PS1.

Opening and extracting this zip will give all the versions you have created as plain old PS1 files.

The “index” file is an XML and with all the creation time, username and notes you created!

Side note! If you want a visual tool to help play with XPath searches check out:

(and note that the menu is hidden, hit Alt and you can add an XML to work with)

Final Words


If I possessed a bit of forethought, I would have looked and seen this blog entry was more concisely written in these locations:

Regardless, go get ISESteriods today and start trying it out! 10 day trial is worth it.

No comments:

Post a Comment