1. Trang chủ
  2. » Công Nghệ Thông Tin

Publishing PHP eclipse - part 17 pdf

10 202 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 352,49 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

When you type the location path, or use the Browse button to specify the location, CVSNT will automatically populate the name of the repository.. In UNIX, to refer to a repository, we us

Trang 1

1 Go to http://www.march-hare.com/cvsnt to download this package After you download CVSNT, run the installer The installer will guide you through the

installation process Accept the recommended installation suggestions and

recommended location Make a note of where the software was installed because we might need to access this in the next step You will have to restart your machine after the installation

2 Launch the CVSNT Control Panel The installer should have created a shortcut to the CVSNT Control Panel in your Start menu and Desktop Double-click on this If these shortcuts were not installed, go to the folder where CVSNT was installed and

double-click on the file named cvsnt.cpl You will be greeted with the CVSNT welcome screen:

Immediately we can see that the CVSNT service is up and running In future, to start or stop CVSNT, you can come back to this screen and use the Start and Stop buttons

3 Create a repository Click on the Repository configuration tab This tab lists all the repositories on your machine Unless you have special needs for security and

permissions, you typically need just one repository All your applications will reside

as projects underneath that repository

Trang 2

Click on the Add button to add a repository This will take you to a dialog box to enter your repository settings

4 Enter your repository settings Most importantly, you will specify a location for the repository In this example we place it on the C: drive, but you can place it just about anywhere that is not being used for anything else When you type the location path,

or use the Browse button to specify the location, CVSNT will automatically populate the name of the repository Notice that the name is basically the path to the

repository, but without the drive letter This is because CVS was originally a UNIX program, where drive letters do not exist In UNIX, to refer to a repository, we use the directory path For compatibility with client programs and the CVS protocol, we use the name to refer to the repository in CVSNT

Trang 3

Enter a description for the directory If this repository is the only repository on this workstation, click the Default Repository checkbox Otherwise, you can accept the default settings

5 Create the repository directory if necessary After you click the OK button, CVSNT will try to create the CVSROOT directory and all necessary meta-files in the repository directory If the repository directory does not exist, CVSNT will prompt you on

whether it should create the directory Click Yes to accept the option:

Once this is done, you can see that the repository has been added to the list of available repositories Click OK to exit this screen:

6 Add yourself as a pserver user In CVS, we have several options to connect to the

server pserver was one of the first methods and still commonly used SSH is very popular due to the need for security For CVSNT, we will use pserver to connect to the server because we would have to do additional installations and configurations under Windows for SSH If you do decide to eventually set up a CVS server, be aware of the security issues with pserver While very flexible and compatible, it does not offer very tough security One example is that it keeps its own user and password list While this can give you better control, it's also not hard to decrypt To add

Trang 4

yourself as a pserver user, drop into the command prompt in Windows Use the passwd

command to enter yourself You must have a real Windows account on the machine, and you must use this name after the –r flag This –r flag denotes an alias to a real system user name This is very important, especially if your login name is just an alias to the administrator account The –a flag tells CVS to add the user name For simplicity, we keep this the same as what we entered for the –r flag

C:\Documents and Settings\Shu> cvs passwd –r shu –a shu

Adding user shu

New Password:

Verify Password:

C:\Documents and Settings\Shu>

After you enter a user name, you will be prompted to enter and verify a password That's it for installing and configuring a CVS server under Windows You can go ahead and skip

to the discussion on The CVS Repository Perspective

Macintosh Installation

The easiest way to install and configure CVS on a Macintosh is to install the Apple XCode

Developer Tools These tools include a CVS server When XCode is installed, the CVS package

is automatically configured and runs at startup To get XCode, visit http://developer.apple.com You will have to register as an Apple developer The free, basic level of membership allows you

to download XCode for free

After you download XCode, just run the installation package to install the CVS Server The installation also includes goodies not part of the standard OS X installation, including the XCode IDE for Mac OS X development, Ruby, and Python

The drawback to this method is that the version of CVS shipped before Tiger (Mac OS X 10.4) is

a bit dated Some of the more advanced features of Eclipse's version synchronization tools do not work However, this version is more than adequate to do basic check-in/check-out of files If you want all the team synchronization features, you will need to compile your own version of CVS or use Mac OS X 10.4 or later

Linux Installation

CVS was originally a UNIX software package Thus, it runs natively and is common in the Linux world Your distribution should include an option to install and configure CVS automatically If your distribution classifies the types of software it has available, check under development tools for CVS If it does not include CVS, consult the CVS site or a book on CVS to install from source

Macintosh and Linux Configuration

Under Macintosh and Linux, we have the luxury of using the SSH protocol to connect to CVS This gives us better security with less user configuration The drawback is that we do not have a GUI to create and initialize the server for us We will have to do this by hand

Trang 5

Drop into the command line and enter the following commands We are assuming that you have root privileges when you enter these commands

1 Decide on a cvsroot directory location First and foremost, we need to specify a

location for our repository Often, this will be a place that can be a mount point in its own partition or drive, but it can be any location as long as the directory is not used for anything else If necessary, create this directory:

Buttercup:/Users/shuchow root# mkdir /var/lib/cvsroot

2 Initialize the repository directory Next, we need to initialize the cvsroot This

marks the directory as an official CVS repository and places the CVSROOT directory under it Be aware that you definitely need to have root privileges for this command

to work It is not enough just to have write permissions on the directory

Buttercup:/Users/shuchow root# cvs -d /var/lib/cvsroot init

The –d parameter tells CVS where the cvsroot repository is Sometimes you'll see

documentation telling you to set an environment variable called CVSROOT with the value of the path to cvsroot This is to let you skip the –d flag when entering command-line commands Since we did not set the environment variable, we will have to pass the directory path The

init command tells CVS to initialize this directory as a cvsroot directory

CVS will send you a confirmation message that the directory has been initialized

cvs init: Repository /var/lib/cvsroot initialized

3 Change the owner of the repository directories to yourself We are now going to pass ownership of the cvsroot directory back to ourselves, and make sure all

subdirectories have the same permissions Note that this is a shortcut we're taking so that our login can access cvsroot Replace 'shuchow' with your account name

Buttercup:/Users/shuchow root# chown -R shuchow cvsroot

Buttercup:/Users/shuchow root# chmod u+s cvsroot

CVS is now set up and we're ready to store some source code

The CVS Repository Perspective

Eclipse manages CVS functionality in the CVS Repository perspective The perspective is made

up of four views:

• CVS Repositories manages all the repositories you use

• CVS Annotate gives you information about a file

• CVS Resource History shows you when a version of a file was added, who added it, and the changes that were made

• CVS Editors shows you who saved, or committed, the file to the repository and when

it was done

To get a better understanding of what these views do, we should have an example to work with in the repository To do this, let's configure Eclipse to use the local repository we just initialized, and

Trang 6

Adding a Repository

To add a repository, open the CVS Repositories view of the CVS Repository perspective By default, it should appear where the Navigator is on the left side of the Workbench

Right-click in the CVS Repositories pane and select New | Repository Location… You can also click the Add CVS Repository icon ( ) in the toolbar You will be presented with the Add CVS Repository wizard This screenshot is that of an SSH-type connection:

Trang 7

The first section asks about location We're going to put localhost in the Host field and the path we declared to be cvsroot in the Repository path field If you are using a remote CVS server, ask the server administrator what these settings are

If you look further down to Connection, you'll see that we're using extssh as the Connection Type This is an SSH-style connection This means that we will basically log into the machine using our regular account We will need to enter our account details in the User and Password fields If you are using the pserver connection method, you may have a separate login account for CVS

If you have been following along with our example under Windows, your dialog box should look like the one above Note that we use the name of the repository, not the path to the repository itself (C:/cvsroot), in the Repository pathfield Remember this is because CVSNT creates an alias from the UNIX-style directory path (which does not have a drive letter) to the Windows-style directory path for compatibility

Click on the Finish button to add this repository Your repository should now be added under the CVS Repositories view If you expand the directory tree, you will see all of the available projects underneath the repository The directory tree is separated into the Head trunk and Branches

Trang 8

Expand the Head trunk to see the available projects in Head So far, there should be only one— CVSROOT, and that is because by default, it is a directory underneath C:/cvsroot Expand CVSROOT and you'll see the files available underneath the project:

Adding a Project to CVS

CVSROOT is interesting, but we really shouldn't play with these files We should add our own project, ShelterSite, into CVS and use it as part of our development process

Remember, CVSROOT (all uppercase) is the project's CVS metadata directory T cvsroot (all lowercase) is the root directory for CVS, where all the source files are stored

To do this, we must first create a directory under cvsroot for our project This will register our application as a project when Eclipse connects to it You can name this directory anything you wish, but for simplicity's sake, it should at least be related to the project name in Eclipse, if not exactly the same

Next, go back into the PHP perspective or Resource perspective In the Navigator view, right-click

on the name of the project, ShelterSite, and select Team | Share Project…; you will be taken to the first part of the Share Project wizard The Team menu item is where Eclipse keeps all of the CVS commands This option will be used frequently in this chapter

Trang 9

Select CVS from the options available and click on the Next button If you have any other

versioning system plug-ins installed, such as the Subversion plug-in that comes with PHPEclipse, they will be available here

Next, select the repository that you wish to use This list is populated from your list of repositories

in the CVS Repositories view You can select one of the repositories available here, or you can select Create a new repository location to drop into the Add Repository wizard

Select the repository that we have set up Click on the Next button to continue

In this step, we select the name with which we want to store the application in CVS If you named

Trang 10

this existing directory To browse through the available projects in CVS, select Use an existing module You will be presented with a list of available directories under cvsroot

Eclipse will then ask you whether you want to check this into the Head trunk or a branch Since this is the only copy of the source code right now, it will act as the master copy Merge it into the Head

Click Next to do a final preview of your source code

Ngày đăng: 04/07/2014, 17:20

TỪ KHÓA LIÊN QUAN