Many developers have the need to work collaboratively on the same ASPRunnerPro or PHPRunner project. In this tutorial I’ll show how to make this happen with almost no effort.
We are going to utilize the power of version control system (VCS). Version or revision control systems track and provide control over the changes to the source code. The most popular VCS systems nowadays are Subversion, Git, Mercurial and Bazaar. We plan to use Subversion (SVN) which is easy to get started with.
I’ll cover the bare minimum you need to know about SVN in order to start. For in-depth tutorial check SVN book.
We are going to need some additional software.
1. Server software
You need to install SVN server software on some server machine. We recommend to check VisualSVN. It is easy to install and configure.
Another option is to use a hosted SVN solution. There are quite a few of them like Unfuddle and CodeSpaces. Besides SVN they provide project management tools, bug tracking and more. In this tutorial we’ll open a free basic account with Unfuddle which is easier than managing your own SVN repository. You can upgrade to a paid plan at any moment.
2. Client software
We recommend TortoiseSVN client. It installs as a Windows explorer extension and available via context menu in all explorer windows.
Before we proceed with step by step tutorial lets consider a typical scenario that involves two developers working on the same PHPRunner project.
- Developer 1 creates the project and makes some changes
- Developer 2 gets the copy of project, adds a new table, makes a few changes in visual templates
- Developer 1 gets the updated copy of the project and sees all changes made by Developer 2
And here is the picture that tells it all.
Step by step tutorial
Lets get started.
1. Create a repository
Create an Unfuddle account. Create admin user. Proceed to ‘Repositories’ to create a new repository.
Note the URL of your repository (http://xlinesoft.unfuddle.com/svn/xlinesoft_cars/ in our example).
2. First checkout
Create a new PHPRunner project. Open project directory in Windows explorer (i.e. C:\Users\Sergey\Documents\PHPRunnerProjects\Cars). Right click anywhere on blank space in Windows Explorer and choose SVN Checkout ….
Enter the URL of your repository. Checkout directory needs to be the same as your project drectory (C:\Users\Sergey\Documents\PHPRunnerProjects\Cars). Click Ok. Enter username and password.
If checkout is successful you will see a hidden .svn folder created in your project directory.
3. Developer 1: Adding PHPRunner project to SVN
Make changes to your PHPRunner project. Add a few tables, make some changes in Visual Editor. Save your project.
In Windows explorer select the all folders except visual, tmp and .svn and project file (.phpr). Right-click on selected files and choose Tortoise SVN->Add. Make sure all files and directories are selected.
Once files are added – right-click in the same folder and choose SVN Commit …. Make sure to add some comment.
Congratulations! Your files are one the server now. You can logon to Unfuddle account and view your files there.
5. Developer 2: Checkout
Now second developer comes into the game. We want her to get a copy of the same project on her machine and make a few changes.
Once TortoiseSVN is installed we need to create a folder where this project will be stored. Once created, open this folder in Windows Explorer and right-click anywhere. Choose SVN Checkout ….
Enter repository URL and checkout folder. Enter username and password when prompted.
Note: we recommend to create a different user account for each user. This way you can track changes made by each developer.
6. Developer 2: Committing changes
Second developer makes a few changes in the Visual Editor and adds a new table to the project. Once project is saved she needs to add new files (if any) to repository.
In Windows Explorer make visual folder and PHPRunner project file selected and choose SVN Commit. Check off new visual files if any. Add a meaningful comment listing changes you have made. Commit.
Note the icons that TortoiseSVN adds to each file. The blue question icon means ‘not under source control’. The red exclamation point icon means ‘this file was modified’. The green check box icon means ‘normal’ status.
If you proceed to your repository at Unfuddle you can see that current revision number is 2. Each commit is associated with a new revision number.
7. Developer 1: Update
Developer 1 runs SVN Update in the project directory to get new files and updated project file.
Developer 1 opens updated project file to see changes made by Developer 2. Mission accomplished.
Additional notes and questions
There are a few things that may require some extra setup.
We need to make sure that database connection points to the same database on all machines. If you use a file-based database like MS Access the best approach is to put database file to the server and specify file to the database as \\server\share\database1.mdb.
In case of SQL Server, MySQL, Postgre or Oracle having a centralized development database makes even more sense.
The same story – you want output directory to point to the same directory on all machines. Something like C:\Projects\ProjectX will work just fine for this purpose.
I’m the only developer, should I still use SVN?
Yes, we strongly recommend to use SVN or any other source control system even if you are a one person shop. It gives you both backups and ability to rollback any change made to the project. What else do you need?
What’s the difference between Checkout, Commit and Update?
Checkout – first step to get project files on a new machine. In most cases you only need to do this once.
Update – perform an Update every time before starting your work. You can run Update as many times as you want
Commit – commit changes you made. Commit at the end of the day or once you completed a large chunk of work. Run Update after Commit to incorporate changes made by other developers.
This is all you need to know in order to start using SVN with PHPRunner or ASPRunnerPro.