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

Our tDiary's policy and strategies to support Ruby 1.9 and our future plan

SHIBATA Hiroshi
October 10, 2011
740

Our tDiary's policy and strategies to support Ruby 1.9 and our future plan

SHIBATA Hiroshi

October 10, 2011
Tweet

Transcript

  1. tDiary ͷ Ruby1.9 ରԠͷաఔͱ
    ࠓޙͷϩʔυϚοϓ
    ࣲా തࢤ (tDiary.org)
    SHIBATA Hiroshi (tDiary.org)
    Our tDiary's policy and strategies to support Ruby
    1.9 and our future plan.
    1
    2009೥7݄19೔೔༵೔

    View full-size slide

  2. ࣗݾ঺հ
    2
    2009೥7݄19೔೔༵೔

    View full-size slide

  3. • SHIBATA Hiroshi a.k.a hsbt (hsbt.org)
    • ιϑτ΢ΣΞΤϯδχΞ
    • 1981೥ੜ·Ε ๺ւಓࡏॅ
    3
    2009೥7݄19೔೔༵೔

    View full-size slide

  4. RubyͱͷؔΘΓ
    • ߴઐ4೥ͷ࣌ͷԠ༻਺ֶͰ id:gotoken ͔
    Βڭ͑ͯ΋Β͏
    • tDiary Λ࢖͍࢝ΊͯओʹWebؔ࿈ͷϥΠ
    ϒϥϦΛ࢖͍࢝ΊΔ
    4
    2009೥7݄19೔೔༵೔

    View full-size slide

  5. • Administrator of developer team for
    tDiary.org
    5
    2009೥7݄19೔೔༵೔

    View full-size slide

  6. RubyKaigi2009
    ςʔϚʮมΘΔ/ม͑Δʯ
    6
    2009೥7݄19೔೔༵೔

    View full-size slide

  7. ΑΖ͓͘͠ئ͍͠·͢ɻ
    7
    2009೥7݄19೔೔༵೔

    View full-size slide

  8. Agenda
    • ·ͣ͸͡Ίʹ
    • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 α
    ϙʔτ)
    • Ruby 1.9 ରԠͷৄࡉ
    • tDiary-2.3.3~ future
    8
    2009೥7݄19೔೔༵೔

    View full-size slide

  9. ·ͣ͸͡Ίʹ
    9
    2009೥7݄19೔೔༵೔

    View full-size slide

  10. tDiary
    ࢖ͬͯΔਓ͍·͔͢?
    10
    2009೥7݄19೔೔༵೔

    View full-size slide

  11. tDiary
    11
    2009೥7݄19೔೔༵೔

    View full-size slide

  12. tDiaryͱݴ͑͹…
    12
    2009೥7݄19೔೔༵೔

    View full-size slide

  13. tDiary
    • feed reader ͰίϝϯτεύϜ͕(ry
    • tDiaryͷιʔείʔυ͸ಡ·ͳ͍ํ͕(ry
    • ςετίʔυ͕ͳ͍యܕతϨΨγʔ
    ίʔ(ry
    13
    2009೥7݄19೔೔༵೔

    View full-size slide

  14. tDiary
    • Tsukkomi oriented Diary system
    • before Rails͔Β։ൃܧଓத(25೥ܭը)
    • Rubyͱڞʹ੒௕
    • ϨϯλϧαʔόʔʹRubyΛೖΕͤ͞Δ
    ࡞ઓ
    14
    2009೥7݄19೔೔༵೔

    View full-size slide

  15. tDiary͸
    Rubyͱڞʹ੒௕
    15
    2009೥7݄19೔೔༵೔

    View full-size slide

  16. 2009/01/30
    Ruby 1.9 Release!
    16
    2009೥7݄19೔೔༵೔

    View full-size slide

  17. Ruby 1.9
    ࢖ͬͯΔਓ͍·͔͢?
    17
    2009೥7݄19೔೔༵೔

    View full-size slide

  18. RubyKaigi2009
    ςʔϚʮมΘΔ/ม͑Δʯ
    18
    2009೥7݄19೔೔༵೔

    View full-size slide

  19. ʮม͑Δʯ
    tDiary ʹΑΔ Ruby
    1.9 ීٴ࡞ઓ
    19
    2009೥7݄19೔೔༵೔

    View full-size slide

  20. tDiary ʹΑΔRuby 1.9 ීٴ࡞ઓ
    • Ruby 1.9͸͍͔ͭ͸࢖Θͳ͚Ε͹ͳΒͳ
    ͍
    • tDiaryΛRuby 1.9ීٴͷΩϥʔΞϓϦʹ
    ͢Δ
    • ͱΓ͋͑ͣಈ͔͘ΒRubyΛ1.9ʹόʔ
    δϣϯΞοϓͯ͠͠·͏
    20
    2009೥7݄19೔೔༵೔

    View full-size slide

  21. Agenda
    • ·ͣ͸͡Ίʹ
    • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 αϙʔτ)
    • Ruby 1.9 ରԠͷৄࡉ
    • tDiary-2.3.3~ future
    21
    2009೥7݄19೔೔༵೔

    View full-size slide

  22. tDiary-2.3.2ϦϦʔεܭը
    (Ruby 1.9 αϙʔτ)
    22
    2009೥7݄19೔೔༵೔

    View full-size slide

  23. ͱΓ͋͑ͣಈ͔ͯ͠ΈΔ
    23
    2009೥7݄19೔೔༵೔

    View full-size slide

  24. orz
    24
    2009೥7݄19೔೔༵೔

    View full-size slide

  25. Ͱ΋΍ΔΜͩΑ
    by kakutani
    25
    2009೥7݄19೔೔༵೔

    View full-size slide

  26. ͱΓ͋͑ͣ
    Կ͔Β࢝Ίͨ΋ͷ͔…
    26
    2009೥7݄19೔೔༵೔

    View full-size slide

  27. ·ͣ͸ܭը
    27
    2009೥7݄19೔೔༵೔

    View full-size slide

  28. 2008೥12݄
    ਆಸ઒ݝ๭ॴ
    28
    2009೥7݄19೔೔༵೔

    View full-size slide

  29. ࡞ઓձٞ
    29
    2009೥7݄19೔೔༵೔

    View full-size slide

  30. Ruby 1.9 ͰͷओͳରԠ
    •աڈόʔδϣϯͱͷඇޓ
    ׵෦෼
    •จࣈΤϯίʔσΟϯάͷ
    มߋ
    30
    2009೥7݄19೔೔༵೔

    View full-size slide

  31. Ruby 1.9 ରԠܭը
    •1.8ͱ1.9ʹଘࡏ͢Δ༷ʑͳඇ
    ޓ׵ΛͲ͏͢Δ͔
    •magic comment ΛͲ͏͢Δ͔
    31
    2009೥7݄19೔೔༵೔

    View full-size slide

  32. Ruby 1.9ରԠܭը
    •ruby ࣮ߦ࣌ͷ --encodingͲ
    ͏͢Δ͔
    •ΤϯίʔσΟϯάपΓͷ
    ࡉ͔͍मਖ਼Ͳ͏͢Δ͔
    32
    2009೥7݄19೔೔༵೔

    View full-size slide

  33. Agenda
    • ·ͣ͸͡Ίʹ
    • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 αϙʔτ)
    • Ruby 1.9 ରԠͷৄࡉ
    • tDiary-2.3.3~ future
    33
    2009೥7݄19೔೔༵೔

    View full-size slide

  34. Ruby 1.9 ରԠͷৄࡉ
    34
    2009೥7݄19೔೔༵೔

    View full-size slide

  35. ͦͷ1
    ޓ׵ੑରԠ
    (core/misc/lib/compatible.rb)
    35
    2009೥7݄19೔೔༵೔

    View full-size slide

  36. compatible.rb
    • ϓϩτλΠϓ͸ machu ͞Μ͕࡞੒
    • 1.8ͱ1.9ͱͷඇޓ׵Λٵऩ
    • for 1.9: String.each_line, String.to_a ...
    • for 1.8: String.force_encoding,
    String.bytesize ...
    36
    2009೥7݄19೔೔༵೔

    View full-size slide

  37. ͦͷ2
    ϚδίϝΔ
    (magic comment ru)
    37
    2009೥7݄19೔೔༵೔

    View full-size slide

  38. ϚδίϝΔ
    •*.rb ͷ1ߦ໨ʹจࣈΤϯίʔ
    σΟϯάΛ໌ࣔ
    •shebang ͕࢖ΘΕ͍ͯΔ΋ͷ
    ͸2ߦ໨
    38
    2009೥7݄19೔೔༵೔

    View full-size slide

  39. ͓୊
    1ߦ໨ʹ೚ҙͷจࣈྻΛૠ
    ೖ͢ΔϫϯϥΠφʔΛॻ
    ͖ͳ͍͞
    39
    2009೥7݄19೔೔༵೔

    View full-size slide

  40. gsed -i "1s/.*/# -\*- coding: utf-8; -\*-\n&/" **/*.rb
    sed Λ࢖͏Μͩ!
    40
    2009೥7݄19೔೔༵೔

    View full-size slide

  41. ͦͷ3
    ruby --encoding=utf-8
    41
    2009೥7݄19೔೔༵೔

    View full-size slide

  42. ruby --encoding=utf-8
    • ruby ࣮ߦ࣌ʹ --encoding ΦϓγϣϯΛ͚ͭ
    Δ͜ͱͰΤϯίʔσΟϯάΛڧ੍Ͱ͖Δ
    • tDiaryͷ৔߹ͩͱindex.rb΍update.rbͷ
    shebangʹ௥Ճ
    • Ϣʔβʔʹ༏͘͠ແ͍ͷͰҙࣝ͠ͳͯ͘
    ΋ಈ͘Α͏ʹ͢Δ
    42
    2009೥7݄19೔೔༵೔

    View full-size slide

  43. ͦͷ4
    ֎෦ΤϯίʔσΟϯάͷࢦఆ
    43
    2009೥7݄19೔೔༵೔

    View full-size slide

  44. ֎෦ΤϯίʔσΟϯάͷࢦఆ
    •࠷ॳ͸open( file, ‘r:utf-8’) Λ
    ࢖͍ͬͯͨ
    •Ruby 1.8.6 ͩͱ࢖͑ͳ͍ٕ
    •٫Լ
    44
    2009೥7݄19೔೔༵೔

    View full-size slide

  45. Encoding::default_external = ‘UTF-8’
    default_externalΛ࢖͏Μͩ!
    45
    2009೥7݄19೔೔༵೔

    View full-size slide

  46. ؔ܎ऀ࿈བྷ
    RUBY_VERSION͸࢖Θͳ͍
    46
    2009೥7݄19೔೔༵೔

    View full-size slide

  47. ͦͷଞ
    ࡉ͔͍मਖ਼
    47
    2009೥7݄19೔೔༵೔

    View full-size slide

  48. ࡉ͔͍मਖ਼
    • cgi.cookies ͕ ASCII-8BIT ͱೝࣝ͞ΕΔͷͰ
    encodingΛݸผʹࢦఆ͢Δ
    • ϒϩοΫΛ͚ͭͳ͍ map ͸ Enumerator Λฦ
    ͢Α͏ʹͳͬͨͷͰ to_a ͢Δ
    • get ͷୈೋҾ਺͕ nil ڐ༰͠ͳ͘ͳͬͨͷͰ
    ԿΒ͔ͷ஋Λࢦఆ
    48
    2009೥7݄19೔೔༵೔

    View full-size slide

  49. ͜͜·ͰରԠ͢Δͱ…
    49
    2009೥7݄19೔೔༵೔

    View full-size slide

  50. ͻͱ·ͣಈ࡞֬ೝ׬ྃ
    50
    2009೥7݄19೔೔༵೔

    View full-size slide

  51. ͱ͜Ζ͕…
    51
    2009೥7݄19೔೔༵೔

    View full-size slide

  52. eval࣮ߦ࣌ʹSecurityError
    52
    2009೥7݄19೔೔༵೔

    View full-size slide

  53. eval࣮ߦ࣌ʹSecurityError
    53
    2009೥7݄19೔೔༵೔

    View full-size slide

  54. [BUG]ͩͬͨ
    • $SAFE= 1ͷ࣌ͷevalʹ[BUG]
    • ௚Δ·Ͱ͜Μͳײ͡ͰରԠ
    54
    2009೥7݄19೔೔༵೔

    View full-size slide

  55. ruby-1.9.1p129 Ͱ bug fix
    55
    2009೥7݄19೔೔༵೔

    View full-size slide

  56. ࿝ࢣᐌ͘
    • Ruby ͷ [BUG] Λ౿ΜͩΒتͼͳ͍͞
    • Ruby ͷ [BUG] Λ౿ΉΑ͏ʹͳ͔ͬͯ
    ΒҰਓલͷΞϓϦέʔγϣϯ
    • ͨͩͷϨΨ(ry
    56
    2009೥7݄19೔೔༵೔

    View full-size slide

  57. 2009/05/08
    tDiary-2.3.2 ϦϦʔε
    57
    2009೥7݄19೔೔༵೔

    View full-size slide

  58. ΊͰͨ͠ΊͰͨ͠
    58
    2009೥7݄19೔೔༵೔

    View full-size slide

  59. hsbt.org
    59
    2009೥7݄19೔೔༵೔

    View full-size slide

  60. Agenda
    • ·ͣ͸͡Ίʹ
    • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 αϙʔτ)
    • Ruby 1.9 ରԠͷৄࡉ
    • tDiary-2.3.3~ future
    60
    2009೥7݄19೔೔༵೔

    View full-size slide

  61. ʮมΘΔʯ
    tDiary-2.3.3~ future
    61
    2009೥7݄19೔೔༵೔

    View full-size slide

  62. tDiary-2.3.3~ future
    • testing frameworkͷ࠾༻
    • rspec
    • cucumber
    • CGI͔ΒRack΁ͷࡌͤସ͑
    • ػೳ௥Ճͱෆ۩߹मਖ਼
    62
    2009೥7݄19೔೔༵೔

    View full-size slide

  63. testing framework
    • ࿝ࢣ(ϚΠέϧɾCɾϑΣβʔζ)ᐌ͘:
    • ࣗ৴Λ࣋ͬͯมߋ͕Ͱ͖ͳ͍
    • ೩ྉ: rspecͱcucumber
    ʮςετ͕ແ͍ίʔυ͸ϨΨγʔίʔυʯ
    63
    2009೥7݄19೔೔༵೔

    View full-size slide

  64. rspec
    •pluginͷڍಈΛςετ
    •contribͷ੒ՌΛcoreʹϚʔ
    δ༧ఆ
    64
    2009೥7݄19೔೔༵೔

    View full-size slide

  65. cucumber
    •γφϦΦΛςετ
    •testable_tdiary ͷ੒ՌΛϚʔ
    δࡁ
    65
    2009೥7݄19೔೔༵೔

    View full-size slide

  66. testable_tdiary!!
    66
    2009೥7݄19೔೔༵೔

    View full-size slide

  67. ͓͞Β͍
    67
    2009೥7݄19೔೔༵೔

    View full-size slide

  68. SapporoRubyKaigi01
    68
    2009೥7݄19೔೔༵೔

    View full-size slide

  69. ৄ͘͠͸…
    • ࡳຈtDiaryձٞ01ͷ֯୩͞Μͷεϥ
    ΠυΛࢀর
    • http://kakutani.com/20081025.html#p01
    69
    2009೥7݄19೔೔༵೔

    View full-size slide

  70. testable_tdiary ͷϚʔδ
    70
    2009೥7݄19೔೔༵೔

    View full-size slide

  71. githubͰ࡞ۀத
    http://github.com/hsbt/tdiary/tree/testable_merge
    71
    2009೥7݄19೔೔༵೔

    View full-size slide

  72. ࡞ۀεςʔλε
    •script/server (pure webrick)
    •rackup -s webrick tdiary.ru
    •cucumber -l ja features
    •Ұ෦ͷγφϦΦͷΈಈ͘
    72
    2009೥7݄19೔೔༵೔

    View full-size slide

  73. tDiaryձٞใࠂ
    73
    2009೥7݄19೔೔༵೔

    View full-size slide

  74. ເͷ͋Δੈք
    tDiary cgi.rb
    webrick
    rack
    cgi.rb
    webrick
    passenger
    74
    2009೥7݄19೔೔༵೔

    View full-size slide

  75. Ϣʔβʔ/ίϛολͷ੠
    • cacheϑΥϧμʹcache͡Όͳ͍σʔλ͕
    ͋Δ
    • XMLRPC͕ಈ͔ͳ͍··์ஔ͞Ε͍ͯΔ
    • mod_rubyո͍͔͠ΒfcgiΛऔΓࠐΈ͍ͨ
    • Ruby 1.9 Ͱಈ͔͢ͱඍົʹ஗͍
    75
    2009೥7݄19೔೔༵೔

    View full-size slide

  76. ๻ΒͷಓͷΓ͸
    ·ͩ·ͩ௕͍
    76
    2009೥7݄19೔೔༵೔

    View full-size slide

  77. ·ͱΊ
    77
    2009೥7݄19೔೔༵೔

    View full-size slide

  78. ·ͱΊ
    • tDiary͸Rubyͱڞʹ੒௕͍ͯ͠·͢
    • ʮม͑Δʯ: tDiary͕Ruby1.9ʹରԠͨ͠
    ͷͰօ͞Μ࢖͍·͠ΐ͏
    • ʮมΘΔʯ: tDiary͸2.3.3ͰϨΨγʔ
    ίʔυ͔Βଔۀ͠·͢
    78
    2009೥7݄19೔೔༵೔

    View full-size slide

  79. ͝੩ௌ
    ͋Γ͕ͱ͏͍͟͝·ͨ͠
    79
    2009೥7݄19೔೔༵೔

    View full-size slide

  80. Q&A
    80
    2009೥7݄19೔೔༵೔

    View full-size slide