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

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

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

    View full-size slide

  2. Kensuke Nagae
    @kyanny
    http://www.quipperschool.com/

    View full-size slide

  3. https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
    What I learnt

    View full-size slide

  4. Solution
    Motivation
    Implementation

    View full-size slide

  5. Solution
    Motivation
    Implementation
    What I made

    View full-size slide

  6. Solution
    Motivation
    Implementation
    Why I needed it

    View full-size slide

  7. Solution
    Motivation
    Implementation
    How I solved problem

    View full-size slide

  8. Solution
    Motivation
    Implementation
    Retrospective

    View full-size slide

  9. Solution
    Motivation
    Implementation
    What I made

    View full-size slide

  10. Compare Linker
    https://github.com/kyanny/compare_linker

    View full-size slide

  11. Make links
    from diff

    View full-size slide

  12. Compare View URL
    https://github.com/blog/612-introducing-github-compare-view

    View full-size slide

  13. Compare View URL
    github.com/markevans/dragonfly/compare/v1.0.6…v1.0.7

    View full-size slide

  14. Compare View URL
    github.com/markevans/dragonfly/compare/v1.0.6…v1.0.7
    username/reponame
    versions (old…new)

    View full-size slide

  15. Compare View URL
    github.com/quipper/schema/compare/d6ba752…714ec45

    View full-size slide

  16. Compare View URL
    github.com/quipper/schema/compare/d6ba752…714ec45
    username/reponame
    Git commit object name (old…new)

    View full-size slide

  17. Solution
    Motivation
    Implementation
    Why I needed it

    View full-size slide

  18. 1 year ago…

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  24. Feedbacks
    Heroku ver.
    Tachikoma.io
    http://qiita.com/camelmasa/items/afe2a69a0ed97d5e9dc6
    http://tachikoma.io/

    View full-size slide

  25. But
    Not the case…

    View full-size slide

  26. quipper/schema

    View full-size slide

  27. schema
    api
    qlink qsupport
    qcreate

    View full-size slide

  28. api
    qlink qsupport
    qcreate
    schema
    def api_rocks
    do_something
    end

    View full-size slide

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

    View full-size slide

  30. 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

    View full-size slide

  31. 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??

    View full-size slide

  32. https://www.flickr.com/photos/marcobellucci/3534516458

    View full-size slide

  33. Not very useful

    View full-size slide

  34. I did it very often…

    View full-size slide

  35. I did it very often…
    github.com/

    View full-size slide

  36. I did it very often…
    github.com/
    dragonfly ruby github

    View full-size slide

  37. I did it very often…
    github.com/
    dragonfly ruby github

    View full-size slide

  38. I did it very often…
    github.com/markevans/dragonfly
    dragonfly ruby github

    View full-size slide

  39. I did it very often…
    github.com/markevans/dragonfly/compare/
    dragonfly ruby github

    View full-size slide

  40. I did it very often…
    github.com/markevans/dragonfly/compare/v1.0.6…
    dragonfly ruby github

    View full-size slide

  41. I did it very often…
    github.com/markevans/dragonfly/compare/v1.0.6…v1.0.7
    dragonfly ruby github

    View full-size slide

  42. I did it very often…
    github.com/markevans/dragonfly/compare/v1.0.6…v1.0.7
    dragonfly ruby github
    IUUQTXXXqJDLSDPNQIPUPTUIJSUFFOPGDMVCT

    View full-size slide

  43. "bundle update"
    should/can be
    more fun to review

    View full-size slide

  44. https://www.flickr.com/photos/derpoly/8288583655

    View full-size slide

  45. I did it very often…
    github.com/markevans/dragonfly/compare/v1.0.6…v1.0.7
    dragonfly ruby github
    Automation!!

    View full-size slide

  46. Make links
    from diff

    View full-size slide

  47. Compare Linker

    View full-size slide

  48. Solution
    Motivation
    Implementation
    How I solved problem

    View full-size slide

  49. Compare Gemfile.lock(s)
    Receive webhook
    Build URL
    Post comment

    View full-size slide

  50. Compare Gemfile.lock(s)
    Receive webhook
    Build URL
    Post comment

    View full-size slide

  51. Webhook Payload (JSON)

    View full-size slide

  52. pull request
    Compare
    Linker
    Receive webhook JSON
    {
    "action": "opened",
    "number": 48,
    "pull_request": {
    "id": 18905849,
    "state": "open",
    "title": "……",
    /* JSON data */
    }

    View full-size slide

  53. Compare Gemfile.lock(s)
    Receive webhook
    Build URL
    Post comment

    View full-size slide

  54. Compare
    Linker
    GitHub API
    Get Gemfile.lock(s)

    View full-size slide

  55. Compare
    Linker
    GitHub API
    Get Gemfile.lock(s)
    master
    feature

    View full-size slide

  56. 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
    )
    )

    View full-size slide

  57. 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

    View full-size slide

  58. Compare
    Linker
    GitHub API
    Get homepage_uri
    Rubygems
    API

    View full-size slide

  59. http://github.com/markevans/dragonfly

    View full-size slide

  60. Compare Gemfile.lock(s)
    Receive webhook
    Build URL
    Post comment

    View full-size slide

  61. Compare View URL
    github.com/markevans/dragonfly/compare/v1.0.6…v1.0.7
    username/reponame
    versions (old…new)

    View full-size slide

  62. Compare View URL
    github.com/quipper/schema/compare/d6ba752…714ec45
    username/reponame
    Git commit object name (old…new)

    View full-size slide

  63. Compare Gemfile.lock(s)
    Receive webhook
    Build URL
    Post comment

    View full-size slide

  64. Comment to pull request

    View full-size slide

  65. Solution
    Motivation
    Implementation
    What I made
    How I solved problem
    Why I needed it

    View full-size slide

  66. Solution
    Motivation
    Implementation
    What I made
    How I solved problem
    Why I needed it
    Retrospective

    View full-size slide

  67. Weak in Rails :(

    View full-size slide

  68. Weak in Rails :(
    http://www.rubyonrails.org/

    View full-size slide

  69. {
    "action": "opened",
    "number": 48,
    "pull_request": {
    "id": 18905849,
    "state": "open",
    "title": "……",
    /* JSON data */
    }
    pull request
    Compare
    Linker
    git push --force

    View full-size slide

  70. Compare
    Linker
    git push --force
    pull request
    {
    "ref": "refs/head/xyz",
    "after": "4d2ab4e",
    "before": "993b46b",
    "created": false,
    "deleted": false,
    "forced": true,
    /* JSON data */
    }

    View full-size slide

  71. In short:
    It’s "So-so" (-_-)
    Not very successful project

    View full-size slide

  72. https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
    What I learnt

    View full-size slide

  73. https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
    I was thinking…
    idea
    other

    View full-size slide

  74. https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
    I was thinking…
    idea
    other
    F

    View full-size slide

  75. https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
    Actually…
    idea
    action
    improvement

    View full-size slide

  76. https://www.flickr.com/photos/derpoly/8288583655
    Idea is worth but…

    View full-size slide

  77. https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
    idea < action < improvement

    View full-size slide

  78. Solution
    Motivation
    Implementation
    I made Compare Linker
    I wanted to make "bundle update"
    more fun to review
    I implemented it upon useful APIs

    View full-size slide

  79. https://medium.com/the-year-of-the-looking-glass/junior-designers-vs-senior-designers-fbe483d3b51e
    Keep improvement!!
    idea
    action
    improvement

    View full-size slide

  80. Thank you for listening :)
    =end

    View full-size slide