Author: Manuel Lemos
Viewers: 17
Last month viewers: 4
Categories: New site features
This article talks about this new feature and presents a video that gives you a step by step tutorial on how to import classes from Git, SubVersion and CVS repositories.
Read this article to learn how to import or update class files very quickly without the pain of the traditional method of uploading class files one at a time.
Contents
Importing Class Files from Git Repositories
Tutorial Video on How to Import or Update Packages from Remote Repositories
Conclusion
Tutorial Video Transcript
Importing Class Files from Git Repositories
Git is a version control system that has been growing a lot in popularity since it was created in 2005 by Linus Torvalds, the creator of Linux, along with other Linux contributors.
Since earlier this year, PHPClasses supports importing files from CVS and SubVersion repositories. The good news is that not it also supports Git repositories.
Git is supported by several project hosting sites like GitHub, GoogleCode, SourceForge, etc.. So if you have class projects Git repositories hosted in these sites, now it is easy to import or update your class packages in the PHPClasses site.
Currently it only supports Git repositories available via the HTTP protocol. This includes those available via SSL (HTTPS).
Still, supporting Git over HTTP was not a trivial effort because some Git servers only support cloning repositories, which is something that requires parsing a lot of binary structures that are not well explained in the available Git documentation.
Therefore, despite it currently works well to import files from Git repositories hosted in sites like GitHub, it does not yet work well with all Git repositories hosted in Gitorious, Google Code and BitBucket.
If you are willing to import packages available on these and other repository sites that are not yet completely support, please send an e-mail message telling the URL of the repository from which you would like to import your package files.
Tutorial Video on How to Import or Update Packages from Remote Repositories
The process of importing package files from Git repositories is quite simple. As a matter of fact it is very similar to import packages from CVS and SubVersion repositories explained before.
There are a few differences though. One is that Git, as well SubVersion, do not support the concept of modules like in CVS. So in the form for adding a new repository, the module parameter is translated into repository sub-directories in Git and SubVersion.
This means that if you leave the module option empty, the site will import all files in your Git or SubVersion repository. If you enter the path of a sub-directory in the repository server, it will import only the files contained in that sub-directory.
Another difference is that in Git and SubVersion files do not have descriptions like in CVS. So, unless you enter the file descriptions manually, the site will use the file role names as descriptions for each file.
Anyway, these details will be much easier to understand after you watch this tutorial video. If for some reason you do not understand something that was said in the video, you may want to read the video transcript that follows below at the end of this article.
Conclusion
Tutorial Video Transcript
Contents
Introduction (0:00)
Adding a New Repository (1:02)
Importing Files from a Repository (3:04)
Updating Files previously Imported from a Repository (7:50)
Conclusion (8:43)
Introduction (0:00)
Hello I am Manuel Lemos from the PHPClasses and JSClasses sites.
And I am here presenting this video which is a demonstration of how to use a relatively new feature of these sites for importing packages with many files from version control repositories based on CVS, SubVersion and GIT.
As you may be aware, using version control repositories you can keep track of the history of changes that you do to your project files.
Usually those repositories are hosted in a server somewhere. Now it is possible to import whole sets of files from version control repositories into packages published in the PHPClasses and JSClasses sites.
Lets see what you need to do to take advantage of this feature to import or update your packages from version control repositories.
Adding a New Repository (1:02)
First, you need to go to the page of the package into which you want to import the files. You can import files into new packages or an existing package that may even have already been published.
At the top of your package page, there is a link named Import files from a CVS, SubVersion or Git repository.
Click that link to go to the page for managing the repositories of your package. You can import files from one more repositories. Lets add a new repository.
You can set the repository name to something meaningful to you. Set the type of repository accordingly. It can be either CVS, SubVersion and Git. In the future, other types of repositories may be supported.
Then set the repository location. The location format depends on the type of repository. For Git only HTTP protocol repositories are supported for now. This includes secure locations using HTTPS.
The module is only mandatory for CVS repositories. For SubVersion and GIT, do not enter a repository name unless you want to import only files inside a sub-directory of your repository. In that case, the module should be set to the sub-directory path.
Importing Files from a Repository (3:04)
Now that we just added the repository, lets import the files into this project. This can be done by using the Import link.
In the repository import page we see a small form to setup options that will define how the import procedure will be done. I will comment ahead a bit more on these options.
First, lets retrieve the list of files available in the repository using the "Retrieve the updated files list" button.
It may take a while depending on how large is the data in the remote repository. Please be patient if it starts taking some time.
Once the files list is retrieved, you can see it on the page. So far, no files were imported from the repository yet.
First you need to set a few options to determine how a file should be imported or not.
The listing shows the original file name, the version of the file in the repository and the original file size.
The current version and size are not yet set here because in this case the files are being imported for the first time.
The Analysis column show some information that lets you understand the current state of the files. In this case all files are new because the package is still empty. So the Analysis column will show "New file".
The Action column has some buttons to let you tell the site what to do with the file.
In this case the default is to import all files, but you may change it to ignore any files in case you do not want some files be imported ever.
The description field lets you tell what is the purpose of this file. In this case the description is empty because Git (and also SubVersion) do not support file descriptions.
In the case of CVS, the description is retrieved automatically from the repository server.
You are recommended to enter meaningful descriptions when these are not retrieved from the server.
But if you are importing a large package, it may be tedious to enter descriptions for all files.
In this case you can leave it empty, so the site can use the assigned file role name as description.
You can change this behavior of assigning the file description to the role name in this form. If you change it to "Leave it empty" you are required to enter descriptions for all files that do not a description for it.
The role and type columns are meant for you to set the role and content type for each file.
The site tries to assume reasonable defaults for these files, analyzing the file name and contents.
So you just need to review the default values and change them when they are not set to something that you consider to be correct.
When you are done, just use the "Import the selected files" button. Hang on a moment and wait for the results.
In this case all files were imported successfully. Now you can go back to the package page and verify that all files were imported correctly with much less effort than having to upload each file individually.
Updating Files previously Imported from a Repository (7:50)
If you update your project files in the remote repository afterwards, you can just repeat the procedure and the site will import and update the files again without much effort.
The only difference is that the site then will recognize that some files were changed, and it will retrieve the updated file contents, as well the log of changes done to each file.
The log of changes is important because it is used to include in the e-mail message alert that is sent to your package users every time the package is updated.
This procedure will also work if you have previously uploaded the package files manually.
The site will automatically figure the log of changes done to each file in the repository since the date of the upload.
Conclusion (8:43)
As you may have seen, importing packages from repositories is much easier now and takes you much less time to do than with the traditional file upload method.
This makes it viable to import more complex packages without pain.
So go ahead and share your greatest packages with this new method.
You need to be a registered user or login to post a comment
Login Immediately with your account on:
Comments:
1. Missing Import Link - Daniel (2011-12-22 08:58)
Missing Import Link... - 2 replies
Read the whole comment and replies