30 December 2014

In this time of year when attention is often turned to closing the book on the year that is finishing and starting a new one with a fresh start and the intention to improve, I wanted to talk about something simple, but not as automatic as it should be.  It is a common mantra among the laziest of software persons that if you do something a third time, you need to automate it.  If you listen to Ari Meisel (and you should – his live event in New York in May 2015 is going to be epic – I’ll be there and you should too), you hear a lot about simplifying life and optimizing the flow of what you do – and then automating it.  Of course, as a software professional, automation is the core part of my being and I have a giddy feeling inside every time I get in my van and look at the climate control setting by which I have just set a temperature and never have to think again about changing the blowing of heating and cooling to try to find a comfortable temperature.  Automation is the 4th best thing about life (behind only playing with children, having sex, and eating – in that order).

Creating a new solution using Visual Studio is pretty straightforward, but we can do better.  I have created a video illustrating what it is like to go through the process of creating a solution complete with source control.  This is not incredibly cumbersome and painful, but we can do better.  Please watch the video and consider the effort and time taken here in doing something that will be repeated any time you create a new solution.

Now consider the alternative I am presenting here.  I have a script function that will create a new solution.

The function I have created is in a PowerShell script.  It is available in my Setup repository on Bitbucket to use as you see fit.  Note that this is a Mercurial repository and my script for creating repositories and solutions creates Git repositories.  I am fond of both of these Distributed Version Control Systems and use them both at different times.  Perhaps I’ll write another post on what I like about each of them and what I view as their relative strengths, including hosts such as Github and Bitbucket, at another time.  I might also add Mercurial support to my new repository automation scripts at some point as well.

My Setup repository has several things I find useful and use in my daily life.  Among these things are several Powershell scripts,functions, and aliases intended to make my day nicer and a script to put these conveniences into my profile so I never have to hunt for them.

In essence, instead of having to use git init to create a repository, manually create an ignore file, use git add and git commit to add the ignore file to the repository, and wrestle with Visual Studio to get my paths right (which I never get right on the first try – and you’ll note if you look closely in the video that I created a solution called NewWeb.sln when I intended to create NewSolution.sln), I just run a script and give it a name as a parameter.



blog comments powered by Disqus