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 Slide

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

    View Slide

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

    View Slide

  4. Solution
    Motivation
    Implementation

    View Slide

  5. Solution
    Motivation
    Implementation
    What I made

    View Slide

  6. Solution
    Motivation
    Implementation
    Why I needed it

    View Slide

  7. Solution
    Motivation
    Implementation
    How I solved problem

    View Slide

  8. Solution
    Motivation
    Implementation
    Retrospective

    View Slide

  9. Solution
    Motivation
    Implementation
    What I made

    View Slide

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

    View Slide

  11. Make links
    from diff

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  17. Solution
    Motivation
    Implementation
    Why I needed it

    View Slide

  18. 1 year ago…

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  25. But
    Not the case…

    View Slide

  26. quipper/schema

    View Slide

  27. schema
    api
    qlink qsupport
    qcreate

    View Slide

  28. api
    qlink qsupport
    qcreate
    schema
    def api_rocks
    do_something
    end

    View Slide

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

    View 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 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 Slide

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

    View Slide

  33. Not very useful

    View Slide

  34. I did it very often…

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  46. Make links
    from diff

    View Slide

  47. Compare Linker

    View Slide

  48. Solution
    Motivation
    Implementation
    How I solved problem

    View Slide

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

    View Slide

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

    View Slide

  51. Webhook Payload (JSON)

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View 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 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 Slide

  58. Compare
    Linker
    GitHub API
    Get homepage_uri
    Rubygems
    API

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  64. Comment to pull request

    View Slide

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

    View Slide

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

    View Slide

  67. Issues…

    View Slide

  68. Weak in Rails :(

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  79. Recap

    View Slide

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

    View Slide

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

    View Slide

  82. Thank you for listening :)
    =end

    View Slide