Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Our tDiary's policy and strategies to support R...
Search
SHIBATA Hiroshi
October 10, 2011
0
840
Our tDiary's policy and strategies to support Ruby 1.9 and our future plan
SHIBATA Hiroshi
October 10, 2011
Tweet
Share
More Decks by SHIBATA Hiroshi
See All by SHIBATA Hiroshi
How to make faster release cycle of Ruby?
hsbt
2
5.2k
Ruby の開発を支えるエコシステム
hsbt
4
2.1k
Why is building the Ruby environment hard?
hsbt
6
6.8k
開発環境へのこだわり
hsbt
15
12k
OSS ことはじめ
hsbt
5
1.3k
GMO DevNight 05 在宅勤務開始から2ヶ月でやったこと
hsbt
2
480
Development Environment 2019
hsbt
1
310
How to become the Psychic
hsbt
0
1.9k
Software Development
hsbt
1
6.4k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
The Cult of Friendly URLs
andyhume
78
6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Become a Pro
speakerdeck
PRO
25
5k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
What's new in Ruby 2.0
geeforr
343
31k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
How GitHub (no longer) Works
holman
310
140k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Scaling GitHub
holman
458
140k
Transcript
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 20097݄19༵
ࣗݾհ 2 20097݄19༵
• SHIBATA Hiroshi a.k.a hsbt (hsbt.org) • ιϑτΣΞΤϯδχΞ • 1981ੜ·Ε
ւಓࡏॅ 3 20097݄19༵
RubyͱͷؔΘΓ • ߴઐ4ͷ࣌ͷԠ༻ֶͰ id:gotoken ͔ Βڭ͑ͯΒ͏ • tDiary Λ͍࢝ΊͯओʹWebؔ࿈ͷϥΠ ϒϥϦΛ͍࢝ΊΔ
4 20097݄19༵
• Administrator of developer team for tDiary.org 5 20097݄19༵
RubyKaigi2009 ςʔϚʮมΘΔ/ม͑Δʯ 6 20097݄19༵
ΑΖ͓͘͠ئ͍͠·͢ɻ 7 20097݄19༵
Agenda • ·ͣ͡Ίʹ • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 α ϙʔτ) • Ruby
1.9 ରԠͷৄࡉ • tDiary-2.3.3~ future 8 20097݄19༵
·ͣ͡Ίʹ 9 20097݄19༵
tDiary ͬͯΔਓ͍·͔͢? 10 20097݄19༵
tDiary 11 20097݄19༵
tDiaryͱݴ͑… 12 20097݄19༵
tDiary • feed reader ͰίϝϯτεύϜ͕(ry • tDiaryͷιʔείʔυಡ·ͳ͍ํ͕(ry • ςετίʔυ͕ͳ͍యܕతϨΨγʔ ίʔ(ry
13 20097݄19༵
tDiary • Tsukkomi oriented Diary system • before Rails͔Β։ൃܧଓத(25ܭը) •
Rubyͱڞʹ • ϨϯλϧαʔόʔʹRubyΛೖΕͤ͞Δ ࡞ઓ 14 20097݄19༵
tDiary Rubyͱڞʹ 15 20097݄19༵
2009/01/30 Ruby 1.9 Release! 16 20097݄19༵
Ruby 1.9 ͬͯΔਓ͍·͔͢? 17 20097݄19༵
RubyKaigi2009 ςʔϚʮมΘΔ/ม͑Δʯ 18 20097݄19༵
ʮม͑Δʯ tDiary ʹΑΔ Ruby 1.9 ීٴ࡞ઓ 19 20097݄19༵
tDiary ʹΑΔRuby 1.9 ීٴ࡞ઓ • Ruby 1.9͍͔ͭΘͳ͚ΕͳΒͳ ͍ • tDiaryΛRuby
1.9ීٴͷΩϥʔΞϓϦʹ ͢Δ • ͱΓ͋͑ͣಈ͔͘ΒRubyΛ1.9ʹόʔ δϣϯΞοϓͯ͠͠·͏ 20 20097݄19༵
Agenda • ·ͣ͡Ίʹ • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 αϙʔτ) • Ruby 1.9
ରԠͷৄࡉ • tDiary-2.3.3~ future 21 20097݄19༵
tDiary-2.3.2ϦϦʔεܭը (Ruby 1.9 αϙʔτ) 22 20097݄19༵
ͱΓ͋͑ͣಈ͔ͯ͠ΈΔ 23 20097݄19༵
orz 24 20097݄19༵
ͰΔΜͩΑ by kakutani 25 20097݄19༵
ͱΓ͋͑ͣ Կ͔Β࢝Ίͨͷ͔… 26 20097݄19༵
·ͣܭը 27 20097݄19༵
200812݄ ਆಸݝॴ 28 20097݄19༵
࡞ઓձٞ 29 20097݄19༵
Ruby 1.9 ͰͷओͳରԠ •աڈόʔδϣϯͱͷඇޓ ෦ •จࣈΤϯίʔσΟϯάͷ มߋ 30 20097݄19༵
Ruby 1.9 ରԠܭը •1.8ͱ1.9ʹଘࡏ͢Δ༷ʑͳඇ ޓΛͲ͏͢Δ͔ •magic comment ΛͲ͏͢Δ͔ 31 20097݄19༵
Ruby 1.9ରԠܭը •ruby ࣮ߦ࣌ͷ --encodingͲ ͏͢Δ͔ •ΤϯίʔσΟϯάपΓͷ ࡉ͔͍मਖ਼Ͳ͏͢Δ͔ 32 20097݄19༵
Agenda • ·ͣ͡Ίʹ • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 αϙʔτ) • Ruby 1.9
ରԠͷৄࡉ • tDiary-2.3.3~ future 33 20097݄19༵
Ruby 1.9 ରԠͷৄࡉ 34 20097݄19༵
ͦͷ1 ޓੑରԠ (core/misc/lib/compatible.rb) 35 20097݄19༵
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 20097݄19༵
ͦͷ2 ϚδίϝΔ (magic comment ru) 37 20097݄19༵
ϚδίϝΔ •*.rb ͷ1ߦʹจࣈΤϯίʔ σΟϯάΛ໌ࣔ •shebang ͕ΘΕ͍ͯΔͷ 2ߦ 38 20097݄19༵
͓ 1ߦʹҙͷจࣈྻΛૠ ೖ͢ΔϫϯϥΠφʔΛॻ ͖ͳ͍͞ 39 20097݄19༵
gsed -i "1s/.*/# -\*- coding: utf-8; -\*-\n&/" **/*.rb sed Λ͏Μͩ!
40 20097݄19༵
ͦͷ3 ruby --encoding=utf-8 41 20097݄19༵
ruby --encoding=utf-8 • ruby ࣮ߦ࣌ʹ --encoding ΦϓγϣϯΛ͚ͭ Δ͜ͱͰΤϯίʔσΟϯάΛڧ੍Ͱ͖Δ • tDiaryͷ߹ͩͱindex.rbupdate.rbͷ
shebangʹՃ • Ϣʔβʔʹ༏͘͠ແ͍ͷͰҙࣝ͠ͳͯ͘ ಈ͘Α͏ʹ͢Δ 42 20097݄19༵
ͦͷ4 ֎෦ΤϯίʔσΟϯάͷࢦఆ 43 20097݄19༵
֎෦ΤϯίʔσΟϯάͷࢦఆ •࠷ॳopen( file, ‘r:utf-8’) Λ ͍ͬͯͨ •Ruby 1.8.6 ͩͱ͑ͳ͍ٕ •٫Լ
44 20097݄19༵
Encoding::default_external = ‘UTF-8’ default_externalΛ͏Μͩ! 45 20097݄19༵
ؔऀ࿈བྷ RUBY_VERSIONΘͳ͍ 46 20097݄19༵
ͦͷଞ ࡉ͔͍मਖ਼ 47 20097݄19༵
ࡉ͔͍मਖ਼ • cgi.cookies ͕ ASCII-8BIT ͱೝࣝ͞ΕΔͷͰ encodingΛݸผʹࢦఆ͢Δ • ϒϩοΫΛ͚ͭͳ͍ map
Enumerator Λฦ ͢Α͏ʹͳͬͨͷͰ to_a ͢Δ • get ͷୈೋҾ͕ nil ڐ༰͠ͳ͘ͳͬͨͷͰ ԿΒ͔ͷΛࢦఆ 48 20097݄19༵
͜͜·ͰରԠ͢Δͱ… 49 20097݄19༵
ͻͱ·ͣಈ࡞֬ೝྃ 50 20097݄19༵
ͱ͜Ζ͕… 51 20097݄19༵
eval࣮ߦ࣌ʹSecurityError 52 20097݄19༵
eval࣮ߦ࣌ʹSecurityError 53 20097݄19༵
[BUG]ͩͬͨ • $SAFE= 1ͷ࣌ͷevalʹ[BUG] • Δ·Ͱ͜Μͳײ͡ͰରԠ 54 20097݄19༵
ruby-1.9.1p129 Ͱ bug fix 55 20097݄19༵
ࢣᐌ͘ • Ruby ͷ [BUG] Λ౿ΜͩΒتͼͳ͍͞ • Ruby ͷ [BUG]
Λ౿ΉΑ͏ʹͳ͔ͬͯ ΒҰਓલͷΞϓϦέʔγϣϯ • ͨͩͷϨΨ(ry 56 20097݄19༵
2009/05/08 tDiary-2.3.2 ϦϦʔε 57 20097݄19༵
ΊͰͨ͠ΊͰͨ͠ 58 20097݄19༵
hsbt.org 59 20097݄19༵
Agenda • ·ͣ͡Ίʹ • tDiary-2.3.2ϦϦʔεܭը(Ruby 1.9 αϙʔτ) • Ruby 1.9
ରԠͷৄࡉ • tDiary-2.3.3~ future 60 20097݄19༵
ʮมΘΔʯ tDiary-2.3.3~ future 61 20097݄19༵
tDiary-2.3.3~ future • testing frameworkͷ࠾༻ • rspec • cucumber •
CGI͔ΒRackͷࡌͤସ͑ • ػೳՃͱෆ۩߹मਖ਼ 62 20097݄19༵
testing framework • ࢣ(ϚΠέϧɾCɾϑΣβʔζ)ᐌ͘: • ࣗ৴Λ࣋ͬͯมߋ͕Ͱ͖ͳ͍ • ೩ྉ: rspecͱcucumber ʮςετ͕ແ͍ίʔυϨΨγʔίʔυʯ
63 20097݄19༵
rspec •pluginͷڍಈΛςετ •contribͷՌΛcoreʹϚʔ δ༧ఆ 64 20097݄19༵
cucumber •γφϦΦΛςετ •testable_tdiary ͷՌΛϚʔ δࡁ 65 20097݄19༵
testable_tdiary!! 66 20097݄19༵
͓͞Β͍ 67 20097݄19༵
SapporoRubyKaigi01 68 20097݄19༵
ৄ͘͠… • ࡳຈtDiaryձٞ01ͷ֯୩͞Μͷεϥ ΠυΛࢀর • http://kakutani.com/20081025.html#p01 69 20097݄19༵
testable_tdiary ͷϚʔδ 70 20097݄19༵
githubͰ࡞ۀத http://github.com/hsbt/tdiary/tree/testable_merge 71 20097݄19༵
࡞ۀεςʔλε •script/server (pure webrick) •rackup -s webrick tdiary.ru •cucumber -l
ja features •Ұ෦ͷγφϦΦͷΈಈ͘ 72 20097݄19༵
tDiaryձٞใࠂ 73 20097݄19༵
ເͷ͋Δੈք tDiary cgi.rb webrick rack cgi.rb webrick passenger 74 20097݄19༵
Ϣʔβʔ/ίϛολͷ • cacheϑΥϧμʹcache͡Όͳ͍σʔλ͕ ͋Δ • XMLRPC͕ಈ͔ͳ͍··์ஔ͞Ε͍ͯΔ • mod_rubyո͍͔͠ΒfcgiΛऔΓࠐΈ͍ͨ • Ruby
1.9 Ͱಈ͔͢ͱඍົʹ͍ 75 20097݄19༵
ΒͷಓͷΓ ·ͩ·͍ͩ 76 20097݄19༵
·ͱΊ 77 20097݄19༵
·ͱΊ • tDiaryRubyͱڞʹ͍ͯ͠·͢ • ʮม͑Δʯ: tDiary͕Ruby1.9ʹରԠͨ͠ ͷͰօ͞Μ͍·͠ΐ͏ • ʮมΘΔʯ: tDiary2.3.3ͰϨΨγʔ
ίʔυ͔Βଔۀ͠·͢ 78 20097݄19༵
͝੩ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠ 79 20097݄19༵
Q&A 80 20097݄19༵