Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Documentation for fun and profit

Documentation for fun and profit

Presented at the NYC.rb Meetup (April 9, 2013)

Lucas Mazza

April 09, 2013
Tweet

More Decks by Lucas Mazza

Other Decks in Programming

Transcript

  1. why

  2. def parse(header) directives = {} header.delete(' ').split(',').each do |part| next

    if part.empty? name, value = part.split('=', 2) directives[name.downcase] = (value || true) unless name.empty? end directives end
  3. def parse(header) directives = {} header.delete(' ').split(',').each do |part| next

    if part.empty? name, value = part.split('=', 2) directives[name.downcase] = (value || true) unless name.empty? end directives end # Internal: Parses the Cache Control string to a Hash. # Existing whitespace will be removed and the string is split on commas. # For each part everything before a '=' will be treated as the key # and the exceeding will be treated as the value. If only the key is # present then the assigned value will default to true. # # Examples: # parse("max-age=600") # # => { "max-age" => "600" } # # parse("max-age") # # => { "max-age" => true } # # Returns a Hash.
  4. So, document those hashes and splat arguments. # Document possible

    combinations def where(*every_possible_thing_ever) # ... end # What options it accepts? # What values are default? def where(stuff = {}) # ... end
  5. And maybe those bang methods too. # It mutates the

    object... def merge! # ... end # ...or raises an error? def save! # ... end
  6. Or suggest alternative implementations. # This is an internal method

    called every time Devise needs # to send a notification/mail. This can be overridden if you # need to customize the e-mail delivery logic. For instance, # if you are using a queue to deliver e-mails... def send_devise_notification(notification, opts={}) # ... end
  7. Choose your weapon: (but it isn’t that important) 1. RDoc

    2. YARD 3. Rocco 4. Tomdoc 5. Plain text / markdown
  8. Not just your precious Ruby code 1. CLIs and shell

    scripts 2. That truckload of JavaScript
  9. Not just your precious Ruby code 1. CLIs and shell

    scripts 2. That truckload of JavaScript 3. CSS modules and styleguides
  10. Not just your precious Ruby code 1. CLIs and shell

    scripts 2. That truckload of JavaScript 3. CSS modules and styleguides 4. and so on...
  11. By community, for the community. • Keep it simple. •

    Help keeping it up to date. • Spread the word.
  12. • SSH tunneling black magic. • Windows VMs. (yes, windows

    VMs) • Outdated/undocumented tools. • Permissions bureaucracy.
  13. Document it like it was open source. (Or enough to

    help new developers join the project)
  14. # Changelog ## Unreleased * [Bug #50] Fixed missing Devise

    translations ## 03-10-2013 * [User Story #200] New signup landing page * [Bug #49] Fixed broken links on 'About us' ## 03-07-2013 -2 * [User Story #199] OAuth2 support * [User Story #198] Deliver a welcome email to new users * Ruby version upgraded to 2.0.0-p1 :heart: ## 03-07-2013 * Security release, updated dependency XPTO.
  15. 1. Migrate the database 2. Setup a redis instance 3.

    A bazillion of rake tasks 4. ?????????
  16. 1. Migrate the database 2. Setup a redis instance 3.

    A bazillion of rake tasks 4. ????????? 5. PROFIT
  17. # Deployment tasks ## Unreleased 1. Regenerate the app config

    YML with the ‘config:setup’ task 2. Run `rake data:import` to seed new data ## 01-18-2013 (v1.5.0) 1. Update API configuration for new endpoint ## 12-15-2012 (v1.4.0) 1. Install imagemagick on worker machines