how to contribute to open source - zenspider.com€¦ · how to contribute to open source...

101
Madison Ruby 2012, Madison, WI Ryan Davis, Seattle.rb How to Contribute to Open Source How to Contribute to Open Source Extensibility from Simplicity

Upload: others

Post on 18-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Madison Ruby 2012, Madison, WI

Ryan Davis, Seattle.rbHow to Contribute to Open Source

How to Contribute to Open Source

Extensibility from Simplicity

Page 2: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Madison!

Page 3: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Don’t touch“Montecello”

Page 4: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Lake Monona

Page 5: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Lake mono-Na

Page 6: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

As in: one “na”

Page 7: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Bi-na

Sha-na-naBa-na-na

Page 8: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Dodeca-na

na na na nana na na nana na na na

http://en.wikipedia.org/wiki/Na_Na_Na_(Na_Na_Na_Na_Na_Na_Na_Na_Na)

Page 9: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Double Dodeca-na

na na na na na nana na na na na nana na na na na nana na na na na na

Page 10: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Page 11: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

I Lied

Page 12: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Aaron Patterson

talked about how to get

started contributing

to OSS.

Giving BackA practical guide to OSS contributions

Page 13: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

I won't be talking about getting started.

Page 14: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

He did a better job than I could.

Page 15: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

The video will be up on confreaks.

…Eventually.

Page 16: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

http://juliepagano.com/blog/2012/08/05/steel-city-ruby-conf-2012-sketchnotes/

Page 17: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Madison Ruby 2012, Madison, WI

Ryan Davis, Seattle.rbHow to Contribute to Open Source

How to Contribute to Open Source

Holy crap, Communicate!

Page 18: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

As a Sidenote…

Page 19: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Aaron sucks and you never want to work

with him.

Page 20: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

It is embarrassing to go out to lunch with

him.

Page 21: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Embarrassing to work in public with

him.

Page 22: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

All he talks about is his fugly cat.

Page 23: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Who ran into a brick wall as a

kitten.

Page 24: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

…and his sausage.

Page 25: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

A Typical Day…

Page 26: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Why are you meowing?

Page 27: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Thinking about cats.

Page 28: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Why are you meowing Journey's

“Don't Stop Believing”?

Page 29: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Thinking about cats...

singing.

Page 30: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Thinking about cats...

singing.

Page 31: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Grrr…

Page 32: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

That said...

Page 33: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

He's brilliant and working with him is

fun and rewarding.

Page 34: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

My Talk

Later stages of open source contribution,both the developer and contributor standpoints.

Page 35: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

What are contributors?

Page 36: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Consumers

Developers

Consumers

Developers

Contributors

ProprietarySoftware

OSSSoftware

Page 37: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

What are contributions?

Page 38: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Bugs

Page 39: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Feature Requests

Page 40: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Documentation

Page 41: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Feedback

Page 42: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Ye OldeOpen Source

Page 43: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Started with smoke signals…

http://efuse.com/Grow/www-smoke-signals-rob-colvin-artville.jpg

Page 44: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Check out project CVS or SVN

Page 45: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Work your changes.

Page 46: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Submit diffs back to developer.

Page 47: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Hopefully there was sourceforge.

Page 48: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Most of the burden was on the user to

get it right.

Page 49: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Nowadays…

Page 50: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Being a contributor is easier than ever!

Page 51: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Now we use git.(or hg or darcs or ...)

Page 52: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

On github…

Page 53: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Pull Requestsinstead of patch sets.

Page 54: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

You don't even need a local checkout

anymore!

Page 55: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Forked projects and Pull requests have

scaled up dramatically.

Page 56: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

This is good, but it also means that the project

developers are massively outnumbered.

Page 57: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

http://www.imdb.com/title/tt0098546/

Page 58: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

http://www.jwz.org/blog/2008/03/you-get-to-drink-from-the-firehose/

Page 59: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Most of the burden goes back to the

developer.

Page 60: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

When should someone try to

contribute?

Page 61: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Early and often!

Page 62: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

How to handle a contribution?

Page 63: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Developer has roughly 3 options:

Page 64: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Accept As-Is

0

25

50

75

100

Accept As-Is

ComplexityDramaEffort

Page 65: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Reject

0

25

50

75

100

Reject

ComplexityDramaEffort

Page 66: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Rewrite/Distill

0

25

50

75

100

Rewrite

ComplexityDramaEffort

Page 67: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Distillation Example

Page 68: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

minitest has a flexible but “simple” runner

Page 69: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

“Simple”MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args send plugin run_tests _run_anything :test _run_suites suites, type _run_suite suite, type tc.run self before_setup setup after_setup run_test __name__ __send__ __name__ before_teardown teardown after_teardown

Page 70: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Allows for:

Page 71: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Running tests.

Page 72: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Running n×m benchmarks

w/ curve fitting.

Page 73: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

It has hooks for various phases of a

test run.

Page 74: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Aaron helped me generalize the hook

system.

Page 75: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

To meet his needs for testing rails with

mocks.

Page 76: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

He has the benefit of sitting next to me.

Page 77: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Most otherdevelopers don’t.

Page 78: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Mocha, turn,CI systems...

Page 79: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Number of bugs filed?

Page 80: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

0

Page 81: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

copy/paste/munge./lib/mocha/integration/mini_test/assertion_counter.rb./lib/mocha/integration/mini_test/exception_translation.rb./lib/mocha/integration/mini_test/version_13.rb./lib/mocha/integration/mini_test/version_140.rb./lib/mocha/integration/mini_test/version_141.rb./lib/mocha/integration/mini_test/version_142_to_172.rb./lib/mocha/integration/mini_test/version_200.rb./lib/mocha/integration/mini_test/version_201_to_222.rb./lib/mocha/integration/mini_test/version_2110_to_2111.rb./lib/mocha/integration/mini_test/version_2112_to_320.rb./lib/mocha/integration/mini_test/version_230_to_2101.rb./lib/mocha/integration/mini_test/version_330.rb./lib/mocha/integration/mini_test.rb

Page 82: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

complexity = #frameworks × #releases

Page 83: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Every time minitest’s internals change, they (can) break.

Page 84: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Untenable

Page 85: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Happy Example

Page 86: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

IRC Dialog

co-worker: I was trying to make something similar to this: http://caldersphere.rubyforge.org/ci_reporter/...zenspider: unfamiliar... seczenspider: oh godzenspider: that integration is crazy

Page 87: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Monkeypatch of 224 lines! ARGH!

Page 88: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

He submitted a pull request.

Page 89: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Trying to make his life easier.

Page 90: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Patch was the wrong way to go.

Page 91: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

There's already a huge difference.

Page 92: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

It got the ball rolling.

Page 93: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

He was communicating.

Page 94: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

This gave us the chance to reach

some clarity.

Page 95: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Small change to minitest### Record the result of a single run. Makes it very easy to gather# information. Eg:## class StatisticsRecorder < MiniTest::Unit# def record suite, method, assertions, time, error# # ... record the results somewhere ...# end# end## MiniTest::Unit.runner = StatisticsRecorder.new

def record suite, method, assertions, time, errorend

# in _run_suite:record suite, method, inst._assertions, time, last_error

Page 96: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Massively Simplified His Codediff --git a/.autotest b/.autotestindex 5cd7c43..f4f90a1 100644--- a/.autotest+++ b/.autotest@@ -1,26 +1,11 @@ # -*- ruby -*- require 'autotest/restart'+require 'autotest/isolate' Autotest.add_hook :initialize do |at| at.add_exception 'test/reports'-# at.extra_files << "../some/external/dependency.rb"-#-# at.libs << ":../some/external"-#-# at.add_exception 'vendor'-#-# at.add_mapping(/dependency.rb/) do |f, _|-# at.files_matching(/test_.*rb$/)-# end-#-# %w(TestA TestB).each do |klass|-# at.extra_class_map[klass] = "test/test_misc.rb"-# end false end -# Autotest.add_hook :run_command do |at|-# system "rake build"-# end # vim: syntax=rubydiff --git a/README.txt b/README.txtindex 92c840f..5898fb2 100644--- a/README.txt+++ b/README.txt@@ -5,11 +5,12 @@ == DESCRIPTION: CI reporter plugin for MiniTest+ This gem was made possible by ATT Interactive. == FEATURES/PROBLEMS: -* Monkeypatches MiniTest::Unit#_run_suite so I have to fix the version of MiniTest I support.+* Uses MiniTest::Unit#record which is only available since version 2.12.0 == SYNOPSIS: diff --git a/Rakefile b/Rakefileindex ff07b81..5e1ae7e 100644--- a/Rakefile+++ b/Rakefile@@ -10,7 +10,7 @@ Hoe.spec 'minitest-ci' do self.testlib = :none - extra_deps << ['minitest', '2.6.0']+ extra_deps << ['minitest', '~> 2.12.0'] extra_dev_deps << ['nokogiri', '~> 1.5.0'] extra_dev_deps << ['rdoc', '>= 2.4.2'] enddiff --git a/lib/minitest/ci.rb b/lib/minitest/ci.rbindex 6c1c5ba..02b1bc7 100644--- a/lib/minitest/ci.rb+++ b/lib/minitest/ci.rb@@ -1,12 +1,7 @@-begin- gem 'minitest', '2.6.0'- require "minitest/unit"-rescue Gem::LoadError => e- msg = [- 'minitest version 2.6.0 required',- 'try: gem install minitest -v 2.6.0'- ]- raise e.exception msg.join("\n")

+require 'minitest/unit'+#unless MiniTest::Unit::VERSION >= '2.12.0'+unless MiniTest::Unit.public_method_defined? :record+ abort 'you are running an unsupported version of MiniTest. try upgrading.' end require 'fileutils'@@ -14,44 +9,20 @@ module MiniTest module Ci- ###- # copied- file = if RUBY_VERSION =~ /^1\.9/ then # bt's expanded, but __FILE__ isn't :(- File.expand_path __FILE__- elsif __FILE__ =~ /^[^\.]/ then # assume both relative- require 'pathname'- pwd = Pathname.new Dir.pwd- pn = Pathname.new File.expand_path(__FILE__)- pn = File.join(".", pn.relative_path_from(pwd)) unless pn.relative?- pn.to_s- else # assume both are expanded- __FILE__- end- # end of copy- ###- CI_MINI_DIR = File.dirname(File.dirname(file)) VERSION = '1.0.4' - @test_dir = nil #'test/reports'- @error = nil+ @report_dir = nil @suites = Hash.new {|h,k| h[k] = []} class << self- attr_accessor :test_dir+ # Accessor method to change the report dir if you don't like the+ # defaults.+ attr_accessor :report_dir end - def add_error e- @error = e- end-- def push suite, method, num, time- a = [method, time, num]- if @error- a << @error- @error = nil- end- @suites[suite] << a+ def push suite, method, num_assertions, time, error+ @suites[suite] << [method, num_assertions, time, error] end def finish io@@ -60,7 +31,7 @@ def finish io clean - Dir.chdir @test_dir do+ Dir.chdir report_dir do @suites.each do |name, suite| generate_suite name, suite end@@ -70,31 +41,17 @@ def finish io private def clean- FileUtils.rm_rf @test_dir- FileUtils.mkdir_p @test_dir+ FileUtils.rm_rf report_dir+ FileUtils.mkdir_p report_dir

end def escape o CGI.escapeHTML(o.to_s) end - # use original as well as filtering this file.- def filter_backtrace bt- bt = MiniTest::filter_backtrace bt- orig_mini_dir = MiniTest::MINI_DIR-- orig_verbose, $VERBOSE = $VERBOSE, nil-- MiniTest.const_set :MINI_DIR, CI_MINI_DIR- MiniTest::filter_backtrace bt- ensure- MiniTest.const_set :MINI_DIR, orig_mini_dir- $VERBOSE = orig_verbose- end- def generate_suite name, suite total_time, assertions, errors, failures, skips = 0, 0, 0, 0, 0- suite.each do |_, t, a, e|+ suite.each do |_, a, t, e| total_time += t assertions += a case e@@ -111,12 +68,12 @@ def generate_suite name, suite f.puts '<?xml version="1.0" encoding="UTF-8"?>' f.puts "<testsuite time='#{"%6f" % total_time}' skipped='#{skips}' failures='#{failures}' errors='#{errors}' name='#{name}' assertions='#{assertions}' tests='#{suite.count}'>" - suite.each do |method, time, asserts, error|+ suite.each do |method, asserts, time, error| f.puts " <testcase time='#{"%6f" % time}' name='#{method}' assertions='#{asserts}'>" if error- bt = filter_backtrace(error.backtrace).join "\n"+ bt = MiniTest::filter_backtrace error.backtrace f.write " <#{type error} type='#{escape error.class}' message=#{escape( error.message ).inspect}>"- f.puts escape bt+ f.puts escape bt.join "\n" f.puts " </#{type error}>" end f.puts " </testcase>"@@ -138,55 +95,10 @@ def type e extend self end - class Unit- # pull this out of _run_suite to make it easier to grab stuff- def _run_suite_method suite, method- inst = suite.new method- inst._assertions = 0-- print "#{suite}##{method} = " if @verbose-- @start_time = Time.now- result = inst.run self- time = Time.now - @start_time-- print "%.2f s = " % time if @verbose- print result- puts if @verbose-- [inst._assertions, time]- end-- # copied out of MiniTest::Unit- def _run_suite suite, type- header = "#{type}_suite_header"- puts send(header, suite) if respond_to? header-- filter = options[:filter] || '/./'- filter = Regexp.new $1 if filter =~ /\/(.*)\//-

- assertions = suite.send("#{type}_methods").grep(filter).map { |method|- a_count, _ = _run_suite_method suite, method-- a_count- }-- return assertions.size, assertions.inject(0) { |sum, n| sum + n }- end- end- class CiUnit < Unit - def _run_suite_method suite, method- res = super-- MiniTest::Ci.push suite, method, *res-- res- end-- def puke klass, meth, e- MiniTest::Ci.add_error e+ def record suite, method, assertions, time, error+ MiniTest::Ci.push suite, method, assertions, time, error super end @@ -199,5 +111,5 @@ def status io = self.output end # set defaults-MiniTest::Ci.test_dir = 'test/reports'+MiniTest::Ci.report_dir = 'test/reports' MiniTest::Unit.runner = MiniTest::CiUnit.newdiff --git a/test/test_minitest_ci.rb b/test/test_minitest_ci.rbindex 1b204ec..6cfffce 100644--- a/test/test_minitest_ci.rb+++ b/test/test_minitest_ci.rb@@ -49,14 +49,14 @@ class TestMinitest::TestCi < MiniTest::Unit::TestCase ensure MiniTest::Unit.output = old_out end+ MiniTest::Unit.runner = nil # reset def self.output @output end def setup- file = "#{MiniTest::Ci.test_dir}/TEST-MockTestSuite.xml"- assert File.exists?( file ), 'expected xml file to exists'+ file = "#{MiniTest::Ci.report_dir}/TEST-MockTestSuite.xml" @file = File.read file @doc = Nokogiri.parse @file @doc = @doc.at_xpath('/testsuite')@@ -113,12 +113,8 @@ def test_output assert_match( /generating ci files/, self.class.output.read ) end - def test_filter_backtrace- bt = begin; raise; rescue => e; e.backtrace; end-- bt = MiniTest::Ci.send :filter_backtrace, bt-- assert_equal 1, bt.size- assert_match( /#{__FILE__}/, bt.first )+ def test_filtering_backtraces+ error = @doc.at_xpath('/testsuite/testcase[@name="test_raise_error"]')+ refute_match /lib\/minitest/, error.inner_text end end-- 1.7.10

Page 97: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

His code now looks like:class CiUnit < MiniTest::Unit after_tests do MiniTest::Ci.finish self.output end

def record suite, method, assertions, time, error MiniTest::Ci.push suite, method, assertions, time, error super endend

# ...

MiniTest::Unit.runner = MiniTest::CiUnit.new

Page 98: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Conclusion

Page 99: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

Communicate Communicate Communicate Communicate

Page 100: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Ryan Davis, Seattle.rb

Madison Ruby 2012, Madison, WI

How to Contribute to Open Source

(Duh)

Page 101: How to Contribute to Open Source - zenspider.com€¦ · How to Contribute to Open Source “Simple” MiniTest::Unit.autorun MiniTest::Unit.new.run ARGV self.class.runner._run args

Madison Ruby 2012, Madison, WI

Ryan Davis, Seattle.rbHow to Contribute to Open Source

!ank You