Difference between revisions of "Dev Getting Started"

From Dreamwidth Notes
Jump to: navigation, search
(gutting this and replacing it with a differently-structured version for Fu to link and flesh out)
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Welcome to Dreamwidth code development! This page is a guide to how to get started with hacking on the Dreamwidth code. It's intended to cover all steps of the process from the very beginning, but each individual step is a brief overview -- follow the links for more detail. If you're confused about anything here, you can ask us in <dwcomm>dw-dev-training</dwcomm> or come talk to us in the [irc://irc.freenode.org/dreamwidth-dev #dreamwidth-dev] [[IRC]] channel.
+
Welcome to Dreamwidth code development! This page is a guide to how to get started with hacking on the Dreamwidth code. It's intended to cover all steps of the process from the very beginning, but each individual step is a brief overview -- follow the links for more detail. If you're confused about anything here, you can ask us in <dwcomm>dw-dev-training</dwcomm> or come talk to us in the [irc://irc.freenode.org/dreamwidth-dev #dreamwidth-dev] [[IRC]] channel. One-on-one mentorship from [[DevCom]] is available for a limited number of hours most weeks.  
  
 
This is geared at people who have little to no development experience. If you've got more experience and just need the details of how our project differs from other open source projects out there, check out the [[Dev Quick Start]] list.
 
This is geared at people who have little to no development experience. If you've got more experience and just need the details of how our project differs from other open source projects out there, check out the [[Dev Quick Start]] list.
Line 9: Line 9:
 
* [[Routing and Template Toolkit|TT]] (Template Toolkit - better templating language, used for new pages)
 
* [[Routing and Template Toolkit|TT]] (Template Toolkit - better templating language, used for new pages)
 
* [[Styles|S2]] (custom templating language used in journal styles)
 
* [[Styles|S2]] (custom templating language used in journal styles)
* HTML / CSS
+
* HTML / CSS / [[Foundation]]
 
* Javascript / JQuery
 
* Javascript / JQuery
 
* MySQL and DBI (the Perl interface to MySQL and other SQL databases)
 
* MySQL and DBI (the Perl interface to MySQL and other SQL databases)
 +
* Test::More (for writing automated tests)
  
 
You don't need to know them all! Some familiarity with at least one will be helpful, but we welcome people at all levels, and are happy to answer questions and give advice as long as you're willing to learn.
 
You don't need to know them all! Some familiarity with at least one will be helpful, but we welcome people at all levels, and are happy to answer questions and give advice as long as you're willing to learn.
Line 30: Line 31:
 
=== A GitHub account ===
 
=== A GitHub account ===
  
[[Git Getting Started | GitHub]] is the [[Version Control]] system we use. It keeps the "master version" of the Dreamwidth code, keeps track of the changes you make, and allows you to submit those changes to us for us to review and incorporate them.
+
[[Git Getting Started | GitHub]] is the version control system we use. It keeps the "master version" of the Dreamwidth code, keeps track of the changes you make, and allows you to submit those changes to us for us to review and incorporate them.
  
 
* Create a GitHub account with your preferred username.
 
* Create a GitHub account with your preferred username.
  
* Fork the dw-free and dw-nonfree repositories from the Dreamwidth repository.
+
* [https://help.github.com/articles/fork-a-repo/ Fork] the [https://github.com/dreamwidth/dw-free/ dw-free] and [https://github.com/dreamwidth/dw-nonfree/ dw-nonfree] repositories from the Dreamwidth repository.
  
 
===A signed CLA===
 
===A signed CLA===
Line 41: Line 42:
  
 
* Print a copy of the last (signature) page of the CLA and sign it
 
* Print a copy of the last (signature) page of the CLA and sign it
* Scan the signed page or take a photo of it and email it to us, or mail a physical copy of it to us.
+
* Scan the signed page or take a photo of it and [[CLA#How_to_submit_your_CLA|email it to us]], or [[CLA#How_to_submit_your_CLA|mail a physical copy]] of it to us.
  
 
===A basic sense of the code structure and how to find things===
 
===A basic sense of the code structure and how to find things===
Line 62: Line 63:
 
== Finding something to work on ==
 
== Finding something to work on ==
  
Once you've gone through the initial setup, pick an issue to work on. The issues are kept in [https://github.com/dreamwidth/dw-free/issues?q=is%3Aopen GitHub Issues].
+
Once you've gone through the initial setup, pick an issue to work on. The issues are kept in [http://wiki.dreamwidth.net/wiki/index.php/Github_Issues GitHub Issues].
  
 
* Look through the [https://github.com/dreamwidth/dw-free/labels/curated:%20beginner curated:beginner] label for issues that someone thinks would make a good first issue to work on. From time to time, people also post lists of "[http://dw-dev-training.dreamwidth.org/tag/babydev+bait babydev bait]" to <dwcomm>dw_dev_training</dwcomm>, and there is [http://dw-dev-training.dreamwidth.org/45772.html a masterlist].
 
* Look through the [https://github.com/dreamwidth/dw-free/labels/curated:%20beginner curated:beginner] label for issues that someone thinks would make a good first issue to work on. From time to time, people also post lists of "[http://dw-dev-training.dreamwidth.org/tag/babydev+bait babydev bait]" to <dwcomm>dw_dev_training</dwcomm>, and there is [http://dw-dev-training.dreamwidth.org/45772.html a masterlist].
Line 68: Line 69:
 
* Let people know that you're working on the bug by assigning it to yourself. Comment on the issue you've chosen with some variation on the word "claim" ("claim", "claimed" and "claiming" all work, and can be surrounded by any other text). This will trigger our bot to assign the issue to you.
 
* Let people know that you're working on the bug by assigning it to yourself. Comment on the issue you've chosen with some variation on the word "claim" ("claim", "claimed" and "claiming" all work, and can be surrounded by any other text). This will trigger our bot to assign the issue to you.
  
* [[Version_Control#Starting_a_new_branch|Create a new branch in git for this issue]] so you have a place to make your changes.
+
* [[Git How To#How to create a new branch for feature development / bugfixes|Create a new branch in git for this issue]] so you have a place to make your changes.
  
 
== Making your changes ==
 
== Making your changes ==
  
* Make sure your git repository is up to date.
+
* Make sure your git repository is [[Dev_Maintenance#Updating_dw-free|up to date]].
  
* Make your changes, probably in your [[Dreamhacks|Dreamhack]] (editing text files, though the tricky part is [[Dev Finding Things|finding things]]).
+
* Make your changes, probably in your [[Dreamhacks|Dreamhack]] ([[Beginning_dev_checklist#Editors|editing text files]], though the tricky part is [[Dev Finding Things|finding things]]).
  
* Restart Apache and test your changes on the Dreamhack. It's a good idea to test multiple use cases, including logged in/not logged in, community vs personal journal (if applicable), personal journal with different settings, etc.  
+
* [[Dev_Maintenance#Restart_the_server|Restart Apache]] and test your changes on the Dreamhack. It's a good idea to test multiple use cases, including logged in/not logged in, community vs personal journal (if applicable), personal journal with different settings, etc.  
  
* [[Version_Control#Committing_changes|Commit your changes to git.]]
+
* [[Git How To#The_Basics|Commit your changes to git.]]
  
* [[Version_Control#Pushing_your_changes_to_your_repository_on_Github|Push your new git branch to your github account.]]
+
* [[Git How To#The_Basics|Push your new git branch to your github account.]]
  
  
 
== Submitting your changes ==
 
== Submitting your changes ==
  
* Once you're satisfied that your changes fix the issue and don't introduce any new bugs, [[Version_Control#Making_a_pull_request|open a pull request.]] This sends your changes to us for us to look over in [[Code Review|review]].
+
* Once you're satisfied that your changes fix the issue and don't introduce any new bugs, [[Git How To#How to submit a pull request|open a pull request.]] This sends your changes to us for us to look over in [[Code Review|review]].
  
 
* A senior Dreamwidth developer will look over your changes and see if they can be accepted or if there are things you need to change. If there are things that could be improved, the reviewer will comment on the commit and give you notes on what can be improved. Don't worry if your changes don't pass review on the first time -- it's really common for pull requests to go through several versions before they're committed.
 
* A senior Dreamwidth developer will look over your changes and see if they can be accepted or if there are things you need to change. If there are things that could be improved, the reviewer will comment on the commit and give you notes on what can be improved. Don't worry if your changes don't pass review on the first time -- it's really common for pull requests to go through several versions before they're committed.
  
* If your pull request needs more changes, you can go back to the branch you made for the change and make those changes. Once you commit them to your branch, the pull request will update automatically.
+
* If your pull request needs more changes, you can go back to the branch you made for the change and make those changes. Once you commit them to your branch and [[Git How To#The_Basics|push your changes]] to make them public, the pull request will update automatically. However, this doesn't fire off a notification to the folk reviewing the code, so please leave a comment on your pull request to let people know that the requested changes have been made!
  
 
* When your pull request is accepted, the person who accepts it will close the pull request and the issue that the pull request fixed.
 
* When your pull request is accepted, the person who accepts it will close the pull request and the issue that the pull request fixed.
 
  
 
== The next fix! ==
 
== The next fix! ==
Line 98: Line 98:
 
* Once your pull request is accepted and merged into the main branch, you can delete the branch for that issue on your GitHub account.
 
* Once your pull request is accepted and merged into the main branch, you can delete the branch for that issue on your GitHub account.
  
* Switch back to the 'develop' branch on your Dreamhack and update to the most current code.
+
* Switch back to the 'master' branch on your Dreamhack and update to the most current code.
  
* PIck the next issue to work on!
+
* Pick the next issue to work on!
  
 
== Further reading ==
 
== Further reading ==
Line 110: Line 110:
 
* [[Design]] - things to keep in mind when designing features. Developers, please take note of this page!
 
* [[Design]] - things to keep in mind when designing features. Developers, please take note of this page!
 
* [[Dev Maintenance]]  - how to keep your code updated
 
* [[Dev Maintenance]]  - how to keep your code updated
* [[Version Control]] - basic commands for keeping track of your changes using version control. Also includes instructions for submitting those changes via a pull request
+
* [[Git How To]] - basic commands for keeping track of your changes using version control. Also includes instructions for submitting those changes via a pull request
* [[Development]] - another list of stuff that might be useful for you at some point
+
 
* [[Git Getting Started]] - a collection of resources for using Git
 
* [[Git Getting Started]] - a collection of resources for using Git
* [[:Category:Development]] - every page tagged with the Development category on the wiki.
+
* [[Github Issues]] - instructions for filing and claiming bugs to work on
 
+
* [[Development]] - another list of stuff that might be useful for you at some point, in particular [[Development#Customising_Your_Dev_Environment | Customising Your Dev Environment]] (for instructions on setting up the Support Board, enabling Beta Features, and so on)
 +
* [[:Category:Development]] - every page tagged with the Development category on the wiki
  
 
==What'd we miss?==
 
==What'd we miss?==

Revision as of 17:02, 1 July 2019

Welcome to Dreamwidth code development! This page is a guide to how to get started with hacking on the Dreamwidth code. It's intended to cover all steps of the process from the very beginning, but each individual step is a brief overview -- follow the links for more detail. If you're confused about anything here, you can ask us in [info]dw-dev-training or come talk to us in the #dreamwidth-dev IRC channel. One-on-one mentorship from DevCom is available for a limited number of hours most weeks.

This is geared at people who have little to no development experience. If you've got more experience and just need the details of how our project differs from other open source projects out there, check out the Dev Quick Start list.

The languages and skills Dreamwidth development uses are:

  • Perl (the majority of the project)
  • BML (custom templating language inherited from LiveJournal which we are currently phasing out)
  • TT (Template Toolkit - better templating language, used for new pages)
  • S2 (custom templating language used in journal styles)
  • HTML / CSS / Foundation
  • Javascript / JQuery
  • MySQL and DBI (the Perl interface to MySQL and other SQL databases)
  • Test::More (for writing automated tests)

You don't need to know them all! Some familiarity with at least one will be helpful, but we welcome people at all levels, and are happy to answer questions and give advice as long as you're willing to learn.


One time only: Initial setup

What you need:

A working Dreamwidth installation

To hack on the Dreamwidth code, you'll need a development environment: a place where you can install the Dreamwidth code yourself, to make changes and submit them. We offer hosted sandbox development environments where we'll install the code for you. We call them Dreamhacks, and they're available free of charge for anyone who's interested in contributing to the project. (It's possible for you to install the code yourself on your own server, but we don't recommend it for beginners. Even the most experienced Dreamwidth developers mostly work on Dreamhacks.)

  • Apply for a Dreamhack: this will give you a hosted development environment with everything already ready for you to get started.
  • Go through the Beginning dev checklist and follow along with the steps for getting your Dreamhack account set up. Most of these steps are tasks you'll only have to do once to make sure your development environment is set up to hack on.

A GitHub account

GitHub is the version control system we use. It keeps the "master version" of the Dreamwidth code, keeps track of the changes you make, and allows you to submit those changes to us for us to review and incorporate them.

  • Create a GitHub account with your preferred username.

A signed CLA

The contributor licensing agreement is a document that says you allow us to use your changes. You'll need to sign one before we can accept any contributions.

A basic sense of the code structure and how to find things

You aren't going to know everything right up front, of course, but there are a few things you can look through and familiarize yourself with.

  • Familiarize yourself with Perl, the language that the majority of DW development is done in. The best reference that we've found to point people at is Picking Up Perl. You absolutely don't need to be a Perl guru to submit a patch, but you should be familiar with the basic syntax.
  • If you'd like to practice first, check out OpenHatch's Training Missions -- they'll let you practice with some of the tools you might need! (In particular, you might find their Git training mission helpful.)
  • Browse through some of the Dreamwidth source code to get a good sense of where things are and what the setup looks like. The basic directory structure, as well as some guidelines about what goes where, can be found in Directory Structure.
  • Read the Programming Guidelines. (You may not understand all of the items there, but you can familiarize yourself with them, and start noticing when existing code doesn't follow the rules as you read.)
  • If you start to get overwhelmed, don't worry! Go do something else for a bit and come back to this later -- this doesn't all have to be done at once. You can read an old dev pep-talk. Also, have a look through the Epic List of Things Real Dreamwidth Programmers Do if you start feeling a bit of impostor syndrome. Finally, you can always ask for help in irc or in [info]dw-dev-training -- everybody who's working on the project now was in your shoes at one point, and we all remember what it's like to feel overwhelmed and over our heads. We want to help you!
  • If you run into problems following any of these instructions, we also want to know about it so we can fix this documentation. You can let us know in irc or in [info]dw-dev-training, or make a note on the Dev Wanted How-To or Installation Wanted How-To pages to describe what you found confusing.


Finding something to work on

Once you've gone through the initial setup, pick an issue to work on. The issues are kept in GitHub Issues.

  • Let people know that you're working on the bug by assigning it to yourself. Comment on the issue you've chosen with some variation on the word "claim" ("claim", "claimed" and "claiming" all work, and can be surrounded by any other text). This will trigger our bot to assign the issue to you.

Making your changes

  • Restart Apache and test your changes on the Dreamhack. It's a good idea to test multiple use cases, including logged in/not logged in, community vs personal journal (if applicable), personal journal with different settings, etc.


Submitting your changes

  • Once you're satisfied that your changes fix the issue and don't introduce any new bugs, open a pull request. This sends your changes to us for us to look over in review.
  • A senior Dreamwidth developer will look over your changes and see if they can be accepted or if there are things you need to change. If there are things that could be improved, the reviewer will comment on the commit and give you notes on what can be improved. Don't worry if your changes don't pass review on the first time -- it's really common for pull requests to go through several versions before they're committed.
  • If your pull request needs more changes, you can go back to the branch you made for the change and make those changes. Once you commit them to your branch and push your changes to make them public, the pull request will update automatically. However, this doesn't fire off a notification to the folk reviewing the code, so please leave a comment on your pull request to let people know that the requested changes have been made!
  • When your pull request is accepted, the person who accepts it will close the pull request and the issue that the pull request fixed.

The next fix!

  • Once your pull request is accepted and merged into the main branch, you can delete the branch for that issue on your GitHub account.
  • Switch back to the 'master' branch on your Dreamhack and update to the most current code.
  • Pick the next issue to work on!

Further reading

This is a brief overview of the process. There are plenty of places to go for more information. Useful wiki pages include:

  • Dev Finding Things - getting around the code base and figuring out where to start when looking for a specific feature
  • Dev Programming Guidelines - programming style
  • Design - things to keep in mind when designing features. Developers, please take note of this page!
  • Dev Maintenance - how to keep your code updated
  • Git How To - basic commands for keeping track of your changes using version control. Also includes instructions for submitting those changes via a pull request
  • Git Getting Started - a collection of resources for using Git
  • Github Issues - instructions for filing and claiming bugs to work on
  • Development - another list of stuff that might be useful for you at some point, in particular Customising Your Dev Environment (for instructions on setting up the Support Board, enabling Beta Features, and so on)
  • Category:Development - every page tagged with the Development category on the wiki

What'd we miss?

If you run into anything in the process that isn't well-documented, or you have questions, you can ask in the [info]dw_dev_training community or in the #dreamwidth-dev irc channel. You should also make a note on the Dev Wanted How-To or Installation Wanted How-To wiki pages so we can document it better for the next person to come along!