PHPBuilder - The Power of CVS Page 3

RSS Twitter
Articles Site Operation

The Power of CVS - Page 3

by: Tim Perdue
July 30, 2000

Now I want to blow out my local directory and start checking out from the tree (back up first).
[tperdue@db] $ cd ..
[tperdue@db docs] $ rm -rf
[tperdue@db docs] $ cvs -d checkout
Now the tree is recreated on my local drive and I can begin editing and committing changes. I want to create a 1.0 version of the entire site and commit that to the tree. I no longer have to use the -d option, since the server info is stored within my local tree.
[tperdue@db docs] $ cd
[tperdue@db] $ cvs update   #not really necessary here
[tperdue@db] $ cvs commit -r 1.0
Now if you make changes, commit them, and then regret it, you can always come back to version 1.0.
[tperdue@db] $ cvs update -r 1.0 #or use "cvs checkout -r 1.0"
How's that for cool? You're all set up, and you even have the building blocks to allow multiple developers to work safely against the same cvs tree.
Updating the web server
Now what if you want to automate the updating of your website? I wrote a script that does this. Once you have committed all of your code and you're confident that everything works fine, you can run a script to automate the process.
First, of course you need to know where the DOCUMENT_ROOT of your server is. Mine is at: /fireball/share/ I then created a directory next to share, called share-update. I keep a checked-out version of my site in that directory.
[tperdue@mybox] $ mkdir /fireball/share-update/
[tperdue@mybox] $ cd /fireball/share-update/
[tperdue@mybox share-update] $ cvs -d /fireball/cvs checkout
So now I have a directory on my webserver that is similar to my "real" web server directory, and I can update it using CVS, then move it over to the live server directory.
#    go to the update directory
cd /fireball/share-update/
#    use CVS to update that directory with the latest code
cvs update
#    clear out the "real" web server directory
rm -rf /fireball/share/*
#    move the updated files over to the "real" web server directory
cp -R /fireball/share-update/* /fireball/share/
#    go to the live web server directory
cd /fireball/share/
#    recursively delete all the directories called CVS
find . -type d -name CVS -exec rm -fr {} \;
#    make sure it's all readable by the server
chmod -R 755 *

« Previous Page
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Tim Perdue



(Maximum characters: 1200). You have characters left.