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

<%= link_to "bundle", "update" %> - Make "bundl...

Kensuke Nagae
September 19, 2014

<%= link_to "bundle", "update" %> - Make "bundle update" more fun to review

RubyKaigi 2014, 18th-20th September 2014
Presented by Kensuke Nagae (@kyanny)
http://rubykaigi.org/2014/presentation/S-KensukeNagae

Kensuke Nagae

September 19, 2014
Tweet

More Decks by Kensuke Nagae

Other Decks in Programming

Transcript

  1. <%= link_to "bundle", "update" %> Make "bundle update" more fun

    to review RubyKaigi 2014 19th September 2014 =begin
  2. "bundle update" is neglected Too lazy to do it regularly

    No sense of duty from "bundle outdated"
  3. "bundle update" is neglected Too lazy to do it regularly

    No sense of duty from "bundle outdated"
  4. "bundle update" is neglected Too lazy to do it regularly

    No sense of duty from "bundle outdated"
  5. "bundle update" is neglected Too lazy to do it regularly

    No sense of duty from "bundle outdated"
  6. "bundle update" is neglected Too lazy to do it regularly

    No sense of duty from "bundle outdated" Automation!!
  7. schema api qlink qcreate qsupport def api_rocks do_something end def

    api_rocks do_something end def api_rocks do_something end $ bundle update $ bundle update $ bundle update
  8. schema qlink qsupport qcreate def api_rocks do_something end def api_rocks

    do_something end def api_rocks do_something end $ bundle update $ bundle update $ bundle update Necessary??
  9. pull request Compare Linker Receive webhook JSON { "action": "opened",

    "number": 48, "pull_request": { "id": 18905849, "state": "open", "title": "……", /* JSON data */ }
  10. Compare Linker GitHub API Get Gemfile.lock(s) master feature file =

    octokit.contents( repo_full_name, { ref: 'master' } ).find { |content| content.name == "Gemfile.lock" } lockfile = Bundler::LockfileParser.new( Base64.decode64( octokit.blob(repo_full_name, file.sha1).content ) )
  11. Compare Linker GitHub API Get Gemfile.lock(s) master feature file =

    octokit.contents( repo_full_name, { ref: 'master' } ).find { |content| content.name == "Gemfile.lock" } lockfile = Bundler::LockfileParser.new( Base64.decode64( octokit.blob(repo_full_name, file.sha1).content ) ) old_lockfile.specs.each do |old_spec| new_lockfile.specs.each do |new_spec| if old_spec.name == new_spec.name if old_spec.version != new_spec.version updated_gems << gem end end end end
  12. { "action": "opened", "number": 48, "pull_request": { "id": 18905849, "state":

    "open", "title": "……", /* JSON data */ } pull request Compare Linker git push --force
  13. Compare Linker git push --force pull request { "ref": "refs/head/xyz",

    "after": "4d2ab4e", "before": "993b46b", "created": false, "deleted": false, "forced": true, /* JSON data */ }
  14. Solution Motivation Implementation I made Compare Linker I wanted to

    make "bundle update" more fun to review I implemented it upon useful APIs