HOW TO READ HUGE OPEN SOURCE CODE EASILY

HOW TO READ HUGE OPEN SOURCE CODE EASILY

for RailsConf 2019 LT

Ae2bbea5e1c3938df2bcc3a79b719f11?s=128

yhirano55

May 01, 2019
Tweet

Transcript

  1. HOW TO READ HUGE OPEN SOURCE CODE EASILY @yhirano55 at

    RailsConf 2019
  2. self.inspect ➤Yoshiyuki Hirano from JAPAN ➤GitHub: @yhirano55 ➤Twitter: @yoshi_hirano ➤Rails

    Contributors #62 ➤I’m chief organizer of “Railsdm” ➤I love Rails community
  3. Have you ever read Ruby on Rails source code?

  4. MORE QUESTIONS ➤Do you know the request/response Lifecycle of Rails

    application? ➤Do you know the steps of Active Record's create, update, validate, and destroy? ➤Do you know the processing of initialization of Rails application?
  5. I do not think many of them actually do

  6. To tell the truth,

  7. I have not, too

  8. I guess we don't have much time and patience

  9. Yesterday, I was impressed by Skylight’s sponsor talk. The design

    of the rack application is really elegant
  10. AND.. ➤I want to read the code of its lifecycle

    of Rails application ➤But I don't want to spend much time to trace the code ➤I want to read source code easily. What would you do?
  11. Finally, I've shipped a new RubyGem this morning

  12. yhirano55/trace_location

  13. DEMO

  14. At first, boot rails console, and set request env

  15. And execute `Rails.application.call(env)` inside `TraceLocation.trace` block

  16. Then it generates a log file

  17. It’s traced locations about `Rails.application.call(env)`

  18. It’s traced locations about `Rails.application.call(env)` CALL on rails/engine.rb:522 #call

  19. It’s traced locations about `Rails.application.call(env)` CALL on rails/application.rb:607 #build_request

  20. It helps you can get tracing the processing of the

    Lifecycle of Rails application easily!!
  21. HOW IT WORK? ➤Use TracePoint that is a Ruby standard

    API ➤TracePoint API is one of the BLACK MAGIC in Ruby
  22. IMPLEMENTATION This is TracePoint

  23. IMPLEMENTATION Collect logs

  24. IMPLEMENTATION Trace events while block call And disable when it

    finished
  25. In making this gem, I used TracePoint for the first

    time. It makes me really feel so good!!
  26. It helps you get deeply understanding Ruby on Rails

  27. It's my pleasure to help you enjoy Ruby on Rails

  28. self.inspect ➤Yoshiyuki Hirano from JAPAN ➤GitHub: @yhirano55 ➤Twitter: @yoshi_hirano ➤Rails

    Contributors #62 ➤I’m chief organizer of “Railsdm” ➤I love Rails community
  29. We’re going to have a new Ruby on Rails conference

    The name is…
  30. RailsKaigi 2020

  31. We hope you join RailsKaigi 2020 in Japan

  32. yhirano55/trace_location Thank you so much