Writing Rubygems & Contributing to OSS in the Github Age
A talk on how to get started writing your own gems, and contributing to others, and how easy it is to get involved in contributing to open source projects with Github
executables are nothing more than ruby files requiring and running your own code • c-extensions live in ./ext and use an extconf.rb to generate a makefile (rest is out of scope) refer to: • http://tenderlovemaking.com/2009/12/18/writing-ruby-c- extensions-part-1/ • http://tenderlovemaking.com/2010/12/11/writing-ruby-c- extensions-part-2/
and not already taken name for the gem • use snake_case for gem names • only use dashes for extending existing gems e.g. rack-cache, capistrano-ext • modules are your friend
just having them present is the important part • travis-ci is a nice distributed build server providing a ci server that will run your tests on multiple ruby implementations • no tests makes it hard for others to contribute and you to accept patches
for pre releases (1.4.3.beta3) • Increment patch level for bug fixes, optimisation and other small changes. • minor level for backwards compatible features (this one is used more fluidly in practice) • major level for non backwards compatible • tag versions in your source (git tag v1.3.4 && git push --tags) • allows for use of pessimistic versioning for your users ‘~> 2.1’ implies ‘< 3.X’
documentation (rdoc, yard) • rubygems builds yard docs at rubydoc.info • run yard locally with ‘yard server’ • readme driven development: • take the time to explain your project (goals, tradeoffs, and importantly how to get started using it) • Consider what API you would want to use yourself
• when submitting a bug report, be thorough and polite • submit a patch: • fork, use a branch per bug/feature • accepting patches: • git remote add otherguy git://..... • git pull otherguy feature_x • github new web editor steamlines even more