In the course of a year with ST701 (2009 to 2010), I had quite a bit of fun creating up a framework for PHP Content Management from scratch rather than using the familiar Joomla or WordPress. Didn’t quite manage to use Drupal in the end since I wasn’t involved in the project. Got to cover quite a bit of jQuery and front-end work with some very talented web designers and developers. Parenting and Spree was more enjoyable (looking back) as it involved more product planning and discussions.
Recent projects and deployment method made it difficult to simply publish changes to a web server. Had been doing it manually (check for modified files, copy and transfer) and thought it was wasting too much time each day when change requests occur. After some quick research, I realized that the simplest method would just be to use the good old “xcopy” command in windows. (this is why command prompt tools should be taught in schools). For a quick refresher on batch commands, read http://www.computerhope.com/batch.htm.
I realize that a proper source control (like Git or Subversion) would be nicer but in my case, a simple batch file is just easier to work with.
Copy and paste the following code in your deployment folder that will create a patch folder based on last modified dates of working files.
REM – http://www.computerhope.com/batch.htm
ECHO Usage : events [patch-num] [m-d-y]
IF (%1)==() GOTO END
IF (%2)==() GOTO TODAYDATE
ECHO Copying files modified on %2
xcopy %SRC% %DEST%%1 /D:%2 /S /C /I /Y
FOR /F “tokens=1-5 delims=/ ” %%a in (“%date%”) DO SET year=%%c
FOR /F “tokens=1-5 delims=/ ” %%a in (“%date%”) DO SET month=%%b
FOR /F “tokens=1-5 delims=/ ” %%a in (“%date%”) DO SET day=%%a
ECHO Copying files modified on %TODAY%