If you are working in PHP (or I guess any programming language) and using subversion as your source control, is there a way to take your project (for example):
C:\Projects\test\.svn
C:\Projects\test\docs\
C:\Projects\test\faq.php
C:\Projects\test\guestbook.php
C:\Projects\test\index.php
C:\Projects\test\test.php
and build/copy/whatever it so it weeds out certain files and becomes:
C:\Projects\test\faq.php
C:\Projects\test\guestbook.php
C:\Projects\test\index.php
automatically? I'm getting tired of making a branch, and then going through the branch and deleting all of the ".svn" folders, the docs directory, and my prototyping files.
I know I could probably use a .bat file to only copy the specific files I want, but I was hoping there was some way with subversion to sort of pseudo ignore a file, to where it will still version it, but where you could make a snapshot of the project that ignores the files you told it to pseudo ignore.
I know I read online somewhere about some functionality that at least lets you copy without the .svn folders, but I can't find it now.
If you use TortoiseSVN, you can use the export feature to automatically strip out all of the .svn files. I think other svn things have the same feature.
Right click the root project folder, then select TortoiseSVN > Export
, and tell it where you want the .svn
free directory.
Copy all the files manually or using your existing method for the first time. Then, since I take it you're on a Windows platform, install SyncToy and configure it in the subscribe method, which would effectively one-way copy only the changes made since the last pseudo-commit to production for files already in production. If you want to add a file you can just copy it manually and resume the SyncToy operation.
Ok, so my final solution is this:
Use the export command to export to a folder called "export" in the same directory as a file called "deploy.bat", then I run the deploy script (v1 stands for version 1, which is what version I am currently on in this project) This script utilizes 7-Zip, which I have placed on my system path so I can use it as a command line utility:
rem replace the v1 directory with the export directory
rd /s /q v1
move /y export\newIMS v1
rd /s /q export
rem remove the prepDocs directory from the project
rd /s /q v1\prepDocs
rem remove the scripts directory from the project
rd /s /q v1\scripts
rem remove individual files from project
del v1\.project
rem del v1\inc\testLoad.html
rem del v1\inc\testInc.js
SET /P version=Please enter version number:
rem zip the file up with 7-Zip and name it after whatever version number the user typed in.
7z a -r v%version%.zip v1
rem copy everything to the shared space ready for deployment
xcopy v%version%.zip /s /q /y /i "Z:\IT\IT Security\IT Projects\IMS\v%version%.zip"
xcopy v1 /s /q /y /i "Z:\IT\IT Security\IT Projects\IMS\currentVersion"
rem keep the window open until user presses any key
PAUSE
I didn't have time to check out the SyncToy solution, so don't take this as me rejecting that method. I just knew how to do this, and didn't have time to check that one out (under a time crunch right now).
Sources:
http://commandwindows.com/command2.htm
http://www.ss64.com/nt/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With