Second article in the Best = Free Drupal IDE series
This article follows last week’s article Best = Free: Drupal IDE based on latest Eclipse release (Kepler), in which we established Eclipse as a premier Drupal IDE. This article demonstrates Eclipse (Kepler) as a Drupal Team Project Management tool also.
Our projects consist of deliverables, and our project deliverables live in repositories. Git repositories. For AWebFactory and a good number of developers and organizations, that means GitHub.
If you followed the first article in this series, you already have a powerful Drupal IDE to work on your Drupal based projects, both locally on your laptop or at your workstation, and remotely, directly on your server. In either case, assuming the code is cloned from a repository and incremental improvements and deliverables are pushed there, the version control cammands are often carried out in a terminal (inside of Eclipse, hopefully!) or else with a GUI of some kind, again, working with either local or remote cloned codebases.
Wouldn’t it be great if these tasks could be carried out in the same IDE environment where the actual editing of the code takes place. And if that repo is on GitHub, and the IDE could integrate with GitHub issues (and even gists), our IDE would not only be capable of managing the codebase, it would be capable of managing the entire project and team also, via GitHub Issues 2 (https://github.com/blog/831-issues-2-0-the-next-generation).
That’s exactly what EGit and the GitHub Mylyn Connector can do. So we need to:
1. Install EGit
2. Install the GitHub Mylyn Connector
3. Start managing Drupal Team Projects and issue tracking right from your Kepler based Drupal IDE
What software do I have installed in my Eclipse IDE?
If you have followed the instructions in Best = Free: Drupal IDE based on latest Eclipse release (Kepler), then you already have EGit (and its dependency JGit) installed.
To confirm what software has been installed, select Eclipse > About Eclipse from the main menu, then click on the Installation Details button, then on the Installed Software and the individual Features tabs. Under Features, you should see that Git Team Provider (EGit) and JGit Core are present.
If this is not the case, install EGit now.
The EGit page at http://eclipse.github.com/ (see Bibliography below) gives full instructions for downloading and installing both EGit and the GitHub Mylyn Connector. The recommended way is as follows:
* Go to Help > Install New Software…
* Work with the main update site: http://download.eclipse.org/egit/updates
* Install as you would any software from its update site
Study the Egit User Guide. Now.
Hitting Help > Welcome from the main menu will now offer a link to the EGit User Guide, because the Classic Eclipse Kepler download includes it off the shelf, or else you have just installed EGit. Stop reading this article now and work your way through the tutorial guide before continuing. It covers using Eclipse to create, clone browse and fully manage local and remote repositories, and how to carry out Git operations (cloning, branching, merging, synchronizing) on these without using the command line. It also recommends my favorite, the online Pro Git book at http://git-scm.com/book for fuller background and details on Git itself.
The Guide is available online here: http://wiki.eclipse.org/EGit/User_Guide
The Guide also covers GitHub operations, for which you will need to install the GitHub Mylyn Connector.
* GitHub Mylyn Connector
* Go to Help > Install New Software…
* Work with the main update site: http://download.eclipse.org/egit/github/updates
* Select the Collaboration item (which includes Eclipse GitHub integration with task focused interface) and install by clicking on the Next button, etc.
Now, when you bring up the Git Repository Exploring perspective (from the toolbar icon, or else from the main menu via Window > Open perspective > Other > Git Repository Exploring) and click on the Clone a Git repository link, the Clone URI option is still there, but the additional GitHub option is present.
Cloning Public Repos
Click on the GitHub option and hit the Next button. This will allow you to search for public repositories on GitHub and to clone them.
Cloning Private GitHub Repos
First make sure your Eclipse ssh configuration is properly set up (Eclipse > Preferences > Network Connections > SSH2). Your SSH2 home directory should be visible. on Mac this is /Users/myname/.ssh.
Then, choose the Git Repository Exploring perspective, and click on the Clone a Git repository link, but instead of the GitHub option, choose Clone URI and click Next. From your private GitHub repo page, grab the copy to clipboard ssh clone url, and specify that in the URI field. The Host and Repository path fields will be automatically filled in, the connection Protocol and Port fields can be left blank, the Authentication User field will be filled in with “git” (leave that alone) and the other fields left blank. Click on the Next button and Eclipse will fetch the list of available branches. Check all or whichever branches you are interested in, and hit the Next button. This will take you to the Local Destination configuration. I left the suggested local Directory and left master as the initial branch, and left the Remote name as origin, and hit the Finish button. The repo was cloned, and permanently listed in the Git Repositories Exploring perspective. I can open it up and edit the files in the Working directory with Eclipse editors. It’s just another perspective that lets you edit off of a local working copy of the codebase.
In the bottom right hand corner you can see more Views attached to the Git Repository Exploring perspective apart from the Git Repositories view: Git Staging allows you to view unstaged changes, staged changes, write a commit message and either commit or commit and push at the same time. Git Reflog lists commits.
Working with the Task Repositories view
What about getting GitHub issues in here and working with them? Go to Window > Show View > Other and under Mylyn, click on Task Repositories. Under Tasks you should see Local, but let’s add the issues from the repo we are working with in the Git Repositories view. Right-click on the yellow Tasks folder in the Task Repositories view, and select Add Task Repository. You can choose from GitHub Gists, Issues, or Pull Requests (and even Install more connectors like Trac and Mingle or whatever!); let’s go with GitHub Issues. After clicking on this choice, we click on the Next button and simple edit the Server field, for example I put in http://github.com/victorkane/reponame. If you are using ssh, put in just the GitHub username (victorkane in my case) in the User ID field (otherwise you will have to add your GitHub password in the Password field), and hit the Finish button. Answer Yes to the question “Would you like to add a query to the Task List for this repository?”. Enter parameters, a title, and manage Status, Labels, Milestone, Assigned To and Mentioning criteria for the query, and hit Finish. Victorkane/reponame issues now appears in the Task Repositories view.
Working with the Task List view
Now open the Task List view (Window > Show View > Other, under Mylyn, select Task List view), and you should see the query you just created. Mousing over any issue listed there (in conformance to the query) will allow a preview, and double clicking brings up viewing and editing in the editing pane. From the drop down menu (first icon in the view toolbar) you can create additional queries, new tasks, etc.
“Develop with Git in Eclipse, share and discuss on GitHub, Branch, merge, clone, and synchronize repositories from Eclipse with EGit. Work with issues, pull requests, and Gists from Eclipse with the GitHub Mylyn Connector.”
EGit can be installed in the following ways:
Main Update Site: http://download.eclipse.org/egit/updates (Recommended)
Kepler Update Site (Kepler contains EGit 3.0.3 at the moment): http://download.eclipse.org/releases/kepler
Via the Eclipse Marketplace
GitHub Mylyn Connector can be installed in the following ways:
Main Update Site: http://download.eclipse.org/egit/github/updates (Recommended)
Kepler Update Site: http://download.eclipse.org/releases/kepler
Via the Eclipse Marketplace
EGit User’s Guide
GitHub Issues 2
Ian Bull, Tips and Tricks: Using Eclipse with GitHub