Your SlideShare is downloading. ×
Create Drupal patches with Aptana
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Create Drupal patches with Aptana

4,067

Published on

How to check out Drupal from CVS and create patches for it, all without using the command line.

How to check out Drupal from CVS and create patches for it, all without using the command line.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,067
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
30
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • - Download Aptana at http://aptana.org/studio/download (there are many different flavours of IDE, let's not get into comparing them here). - Installation means unpacking the zip file and putting the Aptana folder in your Applications folder.
  • - Launch the Aptana application. Should open with a popup that lets you 'Install additional features'. Yes, we want to do that. - Under the nicely named 'Others', expand the SCM plugins and check the 'CVS' box. - Click the 'Install' button.
  • - Aha! You thought that would start installation of the CVS feature huh? Wrong! Instead: another popup will eh, pop up. - Expand the 'Collaboration Tools' section and check the 'Eclipse CVS Client' box. - Click 'Next'. You might see a couple of flashing progress bars. Don't worry.
  • Yes, that’s indeed what we want to install. Next please!
  • - 'Review the items to be installed'. Well yes, we want to install the Eclipse CVS Client, so let's click'Next>' once more and accept the license agreement.
  • Should really be installing now! Once finished, let's do the suggested restart of Aptana. The 'Customize Aptana Studio' popup will show again, close it for now. Congratulations, you’ve just installed your IDE and added CVS support to it!
  • Alright then, ready to get down to business! We'll download the latest version of Drupal HEAD from drupal.org’s CVS repository into a new project.
  • Let's take a look at the home screen: - Top left a browser for your file system, click the second 'Project' tab, we'll be working from there most of the time. - Bottom left has the getting started videos. Maybe later, ok? Let's close it for now.
  • - Right- or Control-Click somewhere in the empty project listing and select "Import…"
  • - Expand the 'CVS' section, select 'Projects from CVS' and click 'Next >'.
  • Now we have to supply the info needed to connect with the CVS repository on drupal.org. This is documented on http://drupal.org/node/320, though it took me some trial and error to find where some of the slashed are meant to be. This should work: Host: cvs.drupal.org Repository path: /cvs/drupal User: anonymous Password: anonymous Leave the Connection type settings as is. It's handy to check the 'Save password' box, you'll have to set a master password then. Click ‘Next>’
  • Fill out 'drupal' in the text field for 'Use specified module name'. Click 'Next >'…
  • Do *not* use the first option that uses the 'New Project Wizard', somehow that starts over the whole process… Instead, use the second 'Check out as a project in the workspace'. Choose a (slightly sensible) name for your project and click 'Next >' again.
  • Attention! You'll probably *not* want to check out (download) into the default workspace location. Instead, you want to download to the place where you keep all your local sites. I keep mine in the 'Sites' folder in my Home directory. I'm such a rebel… 'Next >'…
  • Yes, we want to check out from the 'HEAD' tag. No more 'Next >' clicks available, let's hit 'Finish' then!
  • You should see the download in progress now. When finished, you'll see a fresh new project in the left sidebar. If not, double check your Documents/Aptana workspace folder to see if you didn't check out into the default location after all.
  • That's it. If all went well, you now have a fresh CVS checkout of the latest Drupal HEAD on your system. Applause for yourself!
  • I'm skipping the part of setting up a virtual host, MySQL database and all that to actually get this Drupal installation up and running for now. Awww, really? Yes, really. There's quite a few tutorials out there that explain this quite well. http://drupal.org/node/128752 describes the process for Drupal version 6, which should get you on your way.
  • We’ll take a very simple example of making one change to just one file in the Drupal code. This could be a piece of interface text, code documentation, CSS or (gasp!) some actual PHP. We’ll do a very simple change to some CSS here…
  • You've been scanning the Drupal core CSS files and found this in aggregator.css: #aggregator .categorize-item h3 { margin-bottom: 1em; margin-top: 0; } This is of course an absolute travesty! You care about code optimization and rightfully think that this should be rewritten using CSS short-hand notation, like so: #aggregator .categorize-item h3 { margin: 0 0 1em 0; } This doesn't change any actual layout (I'm assuming there's no left or right margins defined elsewhere, it's an example ok?), so there's not that much to preview in this case.
  • Great! Let's assume that this is all you want to change to aggregator.css and you want to see this change added to the central Drupal code base (remember, you have only changed your local copy of Drupal now). To do so, you want to export this change in a format that can be easily applied to the central Drupal code repository. This now is what is called a patch. A patch sums up the changes in your local Drupal installation compared to the central repository. Yup, that's 'diff’ and that is exactly what a Version Control System allows you to do. Let's see how it's done in Aptana…
  • Right- or Control-click on your Drupal installation folder, choose ‘Team’ and then ‘Update’. This makes sure we’ll be comparing or changes to the latest version of the code. Right- or Control-click on the aggregator.css file Choose 'Team' > 'Create Patch…'
  • Choose the 'File' radio button, hit 'Browse…', type a name for your patch and select the place to save it to. Make sure you use .patch as the file extentsion. Hit 'Save' in this dialog and 'Next >' in the 'Create Patch' dialog.
  • - Oooh, advanced options… It's important to set the patch root to 'Project' here. - Click 'Finish'!
  • Then, hurry to the location on your file system where you told Aptana to save the patch and open it (in Aptana or your text editor of choice). For our aggregator example it should look something like this.
  • Transcript

    • 1. Creating patches without using the command line. Drupal CVS checkouts etc. Roy Scholten
    • 2. Topics covered:
      • Install the Aptana IDE
      • Install CVS plugin
      • Checkout Drupal HEAD
      • Create a patch
    • 3. 1. Install Aptana And make it work with CVS
    • 4. Download Aptana
    • 5. Install CVS 1
    • 6. Install CVS 2
    • 7. Install CVS 3
    • 8. Install CVS 4
    • 9. Install CVS 5
    • 10. 2. Create a project to hold a Drupal CVS checkout.
    • 11. Aptana view
    • 12. Aptana project
    • 13. Import
    • 14. Repository information
    • 15. Select Module
    • 16. Check out as
    • 17. Location
    • 18. Select tag HEAD
    • 19. Checking out…
    • 20. Succes!
    • 21. 3. Install this copy of Drupal as per usual. (Not covered in this tutorial…)
    • 22. 4. Make a patch Improve a piece of the code, test it, create a patch and post it in the issue tracker.
    • 23. Aggregator.css example 1
    • 24. Aggregator.css example 2
    • 25. Create patch…
    • 26. Save patch as…
    • 27. Advanced options
    • 28. The patch file
    • 29. You have created a patch!
    • 30. Next steps…
      • File an issue on drupal.org
      • Attach the patch
      • Fingers crossed…
    • 31. Good luck! Roy Scholten http://www.yoroy.com

    ×