constantly contributing pretty patches flcd

48
Constantly Contributing Pretty Patches

Upload: mark-casias

Post on 21-Feb-2017

164 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Constantly Contributing Pretty Patches FLCD

Constantly ContributingPretty Patches

Page 2: Constantly Contributing Pretty Patches FLCD

@teampoop

/in/markieslideshare.net/teampoop

Mark brings a fifteen year programming background and six years of Drupal experience to his role as Senior Drupal Developer at Mediacurrent. Highly involved in his local web community, Mark runs the ABQ Webgeeks Group and started the Albuquerque Drupal Users group.

Senior Drupal Developer - Mediacurrent

Shameless Self Promotion 1

Page 3: Constantly Contributing Pretty Patches FLCD

Mediacurrent Dropcasthttps://www.mediacurrent.com/[email protected]

@kepford@imariohernandez@ryanissampson

Shameless Self Promotion 2

Page 4: Constantly Contributing Pretty Patches FLCD

Mediacurrent Friday 55 things5 ways5 minutes on various topics.

Video (sorry)

Shameless Self Promotion 3

Page 5: Constantly Contributing Pretty Patches FLCD

Hey come work with me!

Mediacurrent helps organizations build highly impactful, elegantly designed Drupal websites that achieve the strategic results they need.

● Single-source provider● Specializing in Drupal since 2007● Headquartered in Atlanta, GA● Team of 60+ Drupal Experts

including development, design and strategy

● Clients include: Large Enterprise and high-profile global brands

Page 6: Constantly Contributing Pretty Patches FLCD

She’s my pal

This is DruLast thing about me.

Page 7: Constantly Contributing Pretty Patches FLCD

Why We Contribute

Why a Good Patch

Create a Good Patch

Know your Module Maintainer

4

3

2

1

Use a Good Patch5

Living in the Future6

Page 8: Constantly Contributing Pretty Patches FLCD

Why We Contribute

Page 9: Constantly Contributing Pretty Patches FLCD

Come for the software,Stay for the community

~Drupal Project Motto

Why We Contribute

Page 10: Constantly Contributing Pretty Patches FLCD

Every complaint is a contributor who needs guidance.

~Total misquote from @gregglesor was it @greggles who told me about it?

Why We Contribute

Page 11: Constantly Contributing Pretty Patches FLCD

Know your Module Maintainer

Page 12: Constantly Contributing Pretty Patches FLCD

• Probably not doing this full-time Probably working on something that puts food on the

table May not remember creating the project. May not exist (but that’s a different problem)

Know your Module Maintainer

Your module maintainer

Page 13: Constantly Contributing Pretty Patches FLCD

Short story long:Not at your beck and

call!

Know your Module Maintainer

Page 14: Constantly Contributing Pretty Patches FLCD

This does not apply to support requests. Thats

a different talk.

Know your Module Maintainer

Page 15: Constantly Contributing Pretty Patches FLCD

Why a Good Patch

Page 16: Constantly Contributing Pretty Patches FLCD

• Easier to review whats changed.Easy to apply to project.

Why make good patchesWhy a Good Patch

Page 17: Constantly Contributing Pretty Patches FLCD

Things that make a module maintainer sad.

Why a Good Patch

Page 18: Constantly Contributing Pretty Patches FLCD

Writing out requested code changes in the comments.

Why a Good Patch

Page 19: Constantly Contributing Pretty Patches FLCD

Zipping up a changed project and uploading it to issue.

Why a Good Patch

Page 20: Constantly Contributing Pretty Patches FLCD

Forking the project to Github or someplace and saying “check out my changes here”.

@Mediacurrent

Why a Good Patch

Page 21: Constantly Contributing Pretty Patches FLCD

• No distinct code changes.

Can’t easily integrate into project.

More work for maintainer.

#Why are these bad?

Why a Good Patch

Page 22: Constantly Contributing Pretty Patches FLCD

diff --git a/includes/jplayer.theme.inc b/includes/jplayer.theme.incindex 44a40c6..cb28394 100644--- a/includes/jplayer.theme.inc+++ b/includes/jplayer.theme.inc@@ -236,6 +236,7 @@ function jplayer_sort_files($raw_files = array(), $player_id = 0, $type = 'singl 'tabindex' => 1, 'onclick' => 'return(false);', ),+ 'html' => TRUE, ); if (isset($file) && $file['type'] == 'audio') { $files[][$file['ext']] = $file['url'];diff --git a/includes/jplayer_style_plugin.inc b/includes/jplayer_style_plugin.incindex b0b367b..329cb16 100644--- a/includes/jplayer_style_plugin.inc+++ b/includes/jplayer_style_plugin.inc@@ -112,7 +112,8 @@ class jplayer_style_plugin extends views_plugin_style { } $this->view->row_index = $row_index;- $label = trim(strip_tags($this->row_plugin->render($row)));+ $allowed_tags = array('a', 'em', 'strong', 'cite', 'blockquote', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'span', 'div');+ $label = trim(filter_xss($this->row_plugin->render($row), $allowed_tags)); if (empty($label)) { $label = basename($filepath); }https://www.drupal.org/files/issues/allow_html_tags_in_playlist-1649102-4.patch

Why a Good Patch

Page 23: Constantly Contributing Pretty Patches FLCD

• Distinct code changes.Can easily integrate into

project.Forever accessible to

the rest of the world.

#Why this is good?

Why a Good Patch

Page 24: Constantly Contributing Pretty Patches FLCD

Creating a good Patch

Page 25: Constantly Contributing Pretty Patches FLCD

Not an original thought!https://www.drupal.org/patch

Creating a Good Patch

Page 26: Constantly Contributing Pretty Patches FLCD

Checkout the project.

Creating a Good Patch

Page 27: Constantly Contributing Pretty Patches FLCD

git clone --branch 7.x-1.x http://git.drupal.org/project/colorbox.git

*branch and project name may vary

Creating a Good Patch

Check Out the Project

Page 28: Constantly Contributing Pretty Patches FLCD

Create a new, feature branch.git checkout -b [issue-number]-[issue-description]

Why?

Creating a Good Patch

Page 29: Constantly Contributing Pretty Patches FLCD

Make your awesome changes.

work /commit work / commit       work /commit

Creating a Good Patch

Page 30: Constantly Contributing Pretty Patches FLCD

Create patch from differences between your branch and the

development branch.git diff 7.x-1-x > [PROJECT]-[DESCRIPTION]-[ISSUE#]-[COMMENT].patch

*Development branch name may vary*Patch name format should NOT.

Creating a Good Patch

Page 31: Constantly Contributing Pretty Patches FLCD

Seriously. Name your patches properly.

Creating a Good Patch

Page 32: Constantly Contributing Pretty Patches FLCD

Present your awesome back to the project.

Creating a Good Patch

●Update issue to “Needs Review”.

●Document your changes.●Sometimes you gotta nag.

Page 33: Constantly Contributing Pretty Patches FLCD

Using Patches

Page 34: Constantly Contributing Pretty Patches FLCD

Still not an original thought!

https://www.drupal.org/patch/apply

Using a Patch

Page 35: Constantly Contributing Pretty Patches FLCD

Checkout the project

Using a Patch

git clone --branch 7.x-1.x http://git.drupal.org/project/colorbox.git Didn’t we just see this?

Page 36: Constantly Contributing Pretty Patches FLCD

Download Patch to folder.

Using a Patch

Page 37: Constantly Contributing Pretty Patches FLCD

Apply the happy patches

Using a Patch

git apply -v path/file.patch

Page 38: Constantly Contributing Pretty Patches FLCD

Damien says:

Using a Patch

patch -p1 path/file.patch

Note to self: get link to blogpost from Damien

Page 39: Constantly Contributing Pretty Patches FLCD

Wait. Don’t Download!

Creating a Good Patch

curl https://www.drupal.org/files/issues/1307166-42.patch | patch -p1

Page 40: Constantly Contributing Pretty Patches FLCD

Living in the Future

Page 41: Constantly Contributing Pretty Patches FLCD

• Inline comments.

• Easier to pull from forked repos.

• Single button to merge changes.

Living in the Future

Pull requests instead of patches.

Page 42: Constantly Contributing Pretty Patches FLCD

Hot-fix Security Updates

Living in the Future

Page 43: Constantly Contributing Pretty Patches FLCD

Hot-fix Security UpdatesLiving in the Future

Page 44: Constantly Contributing Pretty Patches FLCD

Living in the Future

Hot-fix security fixes

Page 45: Constantly Contributing Pretty Patches FLCD

Living in the Future

Hot-fix security fixes

Page 46: Constantly Contributing Pretty Patches FLCD

@Mediacurrent Mediacurrent.com

Thank you!

slideshare.net/mediacurrent

Page 47: Constantly Contributing Pretty Patches FLCD

Constantly ContributingPretty Patches

Page 48: Constantly Contributing Pretty Patches FLCD

Constantly ContributingPretty Patches