Tuesday, September 3, 2013

How to integrate VisualSVN, TortoiseSVN and Aptana to create a PHP development environment?

In setting up my PHP development environment, I have made use of the software listed below :-  
- Aptana Studio 3 (IDE)
- VisualSVN Server Manager version 2.6.4 (Source control application)
- TortoiseSVN 1.8.1 (SVN client)

Note: Assume both Aptana and VisualSVN, TortoiseSVN have been installed on the same or different machine.

Below are the details to get the environment up:-
1. Open VisualSVN Server Manager, right click "Repositories" and select "Create New Repository..." menu.

2. Enter "Repository Name", for example "efront", click on "Next" button.
3. Select "Single-project repository (with the top-level 'trunk', branches' and 'tags' folders)" radio button, click on "Next" button.
4. Select "All Subversion users have Read/Write access" radio button, click on "Create" button.
5. "Repository Name" and "Repository URL" will be displayed, click on "Finish" button.

Note: SVN administrator will be responsible to create the repository for the team lead/developer. [REPOSITORY_URL] will be provided by administrator to team leader/developer.

6. Assume you are team leader/developer now, you have a new project, you are going to check in your source code into the new repository. Create a new folder and check out the source code using the repository url ([REPOSITORY_URL]\trunk) using TortoiseSVN client.

7. Copy the source code into the checkout folder, right click on the "efront" folder, select TortoiseSVN -> Add. Click on "Ok" button.

8. Right click on the "efront" folder, select "SVN Commit" menu, a dialogue box will be popup. Enter some comment and click on "Ok" button. The source code will be committed to the SVN server.

Note: Team leader will provide the [REPOSITORY_URL]  to developer. Developer will launch Aptana Studio to check out the source code. Assume developer account creation has been completed by SVN administrator.

9. Developer launch Aptana Studio, click on File -> Import to import project from SVN.

10. Enter the repository url and authentication details. Click "Next" button.

Note: If you wish to checkout those source code in trunk for development, please enter URL as "[REPOSITORY_URL]\[PROJECT_NAME]\trunk". When the message "Do you wish to normalize URL by cutting its last segment off?" just select "No" because you are intended to checkout source code from trunk folder.

11. In "Select Resource" screen, just click "Finish" button.
12. In "Check Out As" screen, click on "Finish" button.
13. In "Select a wizard" screen, select "PHP Project" and click on "Next" button.
14. In "New PHP Project" screen, enter your "Project name" and the location of the source code. Click on "Finish" button.

Up till now, developer should be able to get their environment up in Aptana Studio for development.

15. When source code committing is required, right click on the "Project name" in Aptana Studio and select "Team" menu. All the SVN features will be displayed.

Why "Syntax error" message is prompted on Aptana Studio 3.0 when "trait" is using on the php class?

Discover that Aptana Studio 3.0 don't support new syntax from PHP version 5.4, it supports only up to  PHP version 5.3. This is really inconvenient to see a red "X" mark or "Syntax error" messages that appear everywhere in all the classes in my project. I just turn off the PHP Project Natures from the project to clean up those unnecessarily errors prompt.

Steps to turn off PHP as the "Project Natures"
1. Right click project name, select "Properties" menu
2. Select "Project Natures" and unckeck "PHP" checkbox, click on "Ok" button.
3. Close on reopen project dialogue box will be prompted, just follow the instruction.
4. Select "Project" -> "Clean..." menu to refresh the project, all the red "X" marks and "Syntax error" messages will be cleared.

Just a workaround for me who easily getting confused by the error prompt in the IDE. Still waiting for Aptana to support PHP version 5.4.

No comments: