Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
大規模 Padrino アプリケーション Rails 移行 / Migrating to Ra...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Tsukuru Tanimichi
April 26, 2016
Technology
13k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
大規模 Padrino アプリケーション Rails 移行 / Migrating to Rails from Padrino
Tsukuru Tanimichi
April 26, 2016
More Decks by Tsukuru Tanimichi
See All by Tsukuru Tanimichi
react-rails で SPA, SSR を実現する / react-rails-spa-ssr
ttanimichi
2
1.2k
マネーフォワードにおけるウェブメディア高速化の取り組み / yamagoya2018
ttanimichi
7
2.4k
WebSocket はどれくらい通じるのかの統計 / websocket-connectivity-survey
ttanimichi
0
640
共通基盤システムの開発について
ttanimichi
5
13k
Other Decks in Technology
See All in Technology
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
160
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
170
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
9
1k
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
2
1.5k
LLMに渡さなかった仕事
nanaism
0
1.2k
データ_AIの事業の勝敗をわけるもの
nek0128
1
470
山手線を徒歩で一周してわかった、 位置情報アプリは「足」が最強のデバッガー
hinakko
0
170
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
250
AI coding 整合正規方法
philipz
0
420
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
2.6k
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
140
Reactの設計論
uhyo
24
14k
Featured
See All Featured
HDC tutorial
michielstock
2
880
Automating Front-end Workflow
addyosmani
1369
210k
First, design no harm
axbom
PRO
2
1.3k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Practical Orchestrator
shlominoach
192
12k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
290
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
530
The Mindset for Success: Future Career Progression
greggifford
PRO
0
500
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
300
Transcript
େن Padrino ΞϓϦέʔγϣϯ Rails Ҡߦ 2016/04/27 @ttanimichi (C) Tsukuru Tanimichi,
2016 1
ࣗݾհ • @ttanimichi • 20146݄ʙ גࣜձࣾ Aiming • ڞ௨ج൫ͷ։ൃΛ͍ͯͨ͠ •
࠷ۙήʔϜλΠτϧʹҟಈ • https://github.com/ttanimichi •
[email protected]
(C) Tsukuru Tanimichi, 2016 2
ݬౝઓهάϦϑΥϯ (C) Tsukuru Tanimichi, 2016 3
ڥ • Ruby 2.0 • Padrino 0.11 • MySQL 5.5
• nginx • Redis (C) Tsukuru Tanimichi, 2016 4
rake stats % bin/rake stats +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines
| LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+ | Controllers | 2984 | 2566 | 50 | 302 | 6 | 6 | | Helpers | 86 | 86 | 0 | 1 | 0 | 84 | | Models | 15810 | 13029 | 422 | 1513 | 3 | 6 | | Mailers | 0 | 0 | 0 | 0 | 0 | 0 | | Javascripts | 11577 | 7916 | 1 | 809 | 809 | 7 | | Libraries | 19329 | 13621 | 693 | 1754 | 2 | 5 | | Controller specs | 223 | 181 | 0 | 2 | 0 | 88 | | Lib specs | 4404 | 3603 | 6 | 6 | 1 | 598 | | Model specs | 31852 | 26255 | 0 | 19 | 0 | 1379 | | Request specs | 15 | 13 | 0 | 0 | 0 | 0 | | Service specs | 24027 | 19808 | 3 | 37 | 12 | 533 | +----------------------+-------+-------+---------+---------+-----+-------+ | Total | 110307 | 87078 | 1175 | 4443 | 3 | 17 | +----------------------+-------+-------+---------+---------+-----+-------+ Code LOC: 37218 Test LOC: 49860 Code to Test Ratio: 1:1.3 (C) Tsukuru Tanimichi, 2016 5
rake stats % bin/rake stats +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines
| LOC | Classes | Methods | M/C | LOC/M | ... | Models | 15810 | 13029 | 422 | 1513 | 3 | 6 | ... +----------------------+-------+-------+---------+---------+-----+-------+ 400 Models (C) Tsukuru Tanimichi, 2016 6
(C) Tsukuru Tanimichi, 2016 7
rake stats • COOKPAD Ͱ 1500 Models • lib/ ҎԼʹ
Model ͬΆ͍Ϋϥε͕100ݸ͘ Β͍͋ͬͨ • ͋ΘͤΔͱ 500 Models ͘Β͍ • COOKPAD ͷ 1/3 ͘Β͍ʁʁ (C) Tsukuru Tanimichi, 2016 8
ੈք࠷େͷ Padrino ΞϓϦέʔγϣϯʁʁ (C) Tsukuru Tanimichi, 2016 9
ͭΒΈ • rake spec ʹ1͔͔࣌ؒΔ • autoload ͬͯͳ͔ͬͨ • ىಈʹ2͘Β͍͔͔Δ
• spec Ұ࣮݅ߦ͢Δ͚ͩͰ2 • AR ͷΩϟογϡ͕ޮ͍ͯͳ͍ͬΆ͍ʁʁ (C) Tsukuru Tanimichi, 2016 10
ґଘϥΠϒϥϦ • activerecord 3.2 • activesupport 3.2 ͭ·Γɺ΄ͱΜͲ Rails3 (C)
Tsukuru Tanimichi, 2016 11
͜Ε Rails ʹҠߦͰ͖ΔΜ͡ΌͶʁ (C) Tsukuru Tanimichi, 2016 12
͍ͭΧοͱͳͬͯ... (C) Tsukuru Tanimichi, 2016 13
(C) Tsukuru Tanimichi, 2016 14
Ҡߦίετ • Padrino ͔Β Rails ͷҠߦ • activerecord ͷόʔδϣϯΛ্͛Δ •
activesupport ͷόʔδϣϯΛ্͛Δ • ͍ͭͰʹ Ruby ͷόʔδϣϯ্͛Δ (C) Tsukuru Tanimichi, 2016 15
ํ • ·ͣ Rails4 Ͱಈ͔͢͜ͱ͚ͩߟ͑Δ • ʮ͍ͭͰʹϦϑΝΫλϦϯάʯೝΊͳ͍ • ػցతʹҠߦ࡞ۀ͚ͩ͢Δ •
ϦϑΝΫλϦϯάࡉ͔͍վળҠߦޙʹ͍͘ ΒͰͰ͖Δ (C) Tsukuru Tanimichi, 2016 16
ํ • RailsͷҠߦͱ͍͏ʮେ͖͍ʯ • ಉ࣌ʹϦϑΝΫλϦϯά͠͡ΊΔͱӬ ԕʹҠߦ࡞ۀ͕ྃ͠ͳ͍ • Ϗδωεଆ͕ΩϨΔ → Ҡߦ͕ࣦഊ
• ͱʹ͔͘ػցతʹҠߦ͢Δ • Կߟ͑ͣʹ spec ͕ίέ͍ͯΔॴΛ͢ (C) Tsukuru Tanimichi, 2016 17
Ҡߦखॱ • ͱʹ͔͘·ͣσΟϨΫτϦߏΛ࡞Δ • Padrino ଆ͔Β Models ͳͲΛҠ͍ͯ͘͠ • bundle
exec rspec ͕ಈ͘ͱ͜Ζ·ͰҰਓ Ͱͬͯ͘ • rails new • rails generate rspec:install • database.yml ͷઃఆͱ͔ (C) Tsukuru Tanimichi, 2016 18
(C) Tsukuru Tanimichi, 2016 19
(C) Tsukuru Tanimichi, 2016 20
bundle exec rspec ಈ͍ͨ • ͔͜͜Βઌϝϯόʔʹ࡞ۀΛৼΔ • ͱʹ͔͘ spec ͑͞ಈ͚ۀͰ͖Δ
• ୲ͯ͠ spec ͕ίέ͍ͯΔ෦Λमਖ਼ (C) Tsukuru Tanimichi, 2016 21
େʹίέΔ spec (C) Tsukuru Tanimichi, 2016 22
(C) Tsukuru Tanimichi, 2016 23
େʹίέΔ spec • ͲΜ͚ͩίέͯͯ spec ͕ಈ͖͑͢͞Εम ਖ਼ϝϯόʔʹ୲Ͱ͖Δ • Active Record
3 ͱ 4 ͷඇޓͱ͔ • ઃఆ·ΘΓͷ • padrino helper ͷґଘ • ಉ໊͡લͷϝιουΛఆٛͯ͠ rails ͷ helper ΞΫηε͢ΔΑ͏मਖ਼ (C) Tsukuru Tanimichi, 2016 24
Ͱ͖·ͨ͠ % rails -v Rails 4.2.4 % ruby -v ruby
2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14] ຊ൪ڥͰطʹಈ͍ͯ·͢ (C) Tsukuru Tanimichi, 2016 25
ৼΓฦΓ (C) Tsukuru Tanimichi, 2016 26
(C) Tsukuru Tanimichi, 2016 27
ৼΓฦΓ • Ҡߦίετʹݟ߹͏͚ͩͷϝϦοτ͕͋ͬͨͷ ͔ͳ͔ͬͨͷ͔ʮ͔Βͳ͍ʯ • ϝϯόʔͷ։ൃʹର͢ΔϞνϕʔγϣϯΞοϓ • େֻ͔ΓͳҠߦʹ༐ؾͱܾஅྗ͕ඞཁ • Padrino
ͷ··࠷ݶͷվળ͚ͩ͢Δͬͯબ ࢶΞϦ͔ͩͬͨ (C) Tsukuru Tanimichi, 2016 28
͓·͚ (C) Tsukuru Tanimichi, 2016 29
ཧը໘ • ຊମͱཧը໘ผΞϓϦέʔγϣϯ • ཧπʔϧଆຊମଆͷ Model Λࢀর • ཧπʔϧଆҰ୴ Padrino
ͷ··ͨ͠ • Ұ෦ͷ Model ͕ Rails.env ʹґଘʢྑ͘ͳ͍ʣ • Padrino ͷ߹ Padrino.env Λࢀর͍ͨ͠ (C) Tsukuru Tanimichi, 2016 30
Rails = Padrino ΩλίϨ Rails = Padrino Rails.env #=> "development"
ॳظԽ࣌ʹ Rails ͱ͍͏ఆΛఆٛ ※ ωλͰ͢ ※ ཧը໘ Rails ͷҠߦ࡞ۀΛࠓ͍ͯ͠ΔΑ ※ ཧը໘ͷ Rails Ҡߦ΄ͱΜͲྃ (C) Tsukuru Tanimichi, 2016 31
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ (C) Tsukuru Tanimichi, 2016 32