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
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
Futexes the good, the bad, the ugly
ennael
PRO
0
120
AI Made Us Faster at Solving the Wrong Problems
marceloancelmo
0
160
スキルを作る、その前に!複数人で使われるスキルを 作るためのプロセス
junkifurukawa
2
310
購入ドメインでの課題と取り組み
ykagano
0
140
メルペイ 会計システム概要と歴史
mewuto
0
150
全社共通データ基盤をつくる。ソニーのDatabricks活用とデータガバナンス設計の裏側
sony
0
420
Snowflake Horizon Catalog と Apache Iceberg で作る オープンなデータ基盤
kitagawaz
0
440
生成AIを使って「人が」考える技術 ― AI時代の人機共想と実践ノウハウ|UNITT AC2026
ishiirikie
0
550
SREでアラート疲れを 解決しよう!
kairim0
1
200
HolmesGPTで始めるSREエージェント入門!プラットフォームの障害調査はAIにお任せ 〜
leveragestech
PRO
0
150
AI 時代の Azure エンジニアリング ~ 私たちは何を磨き、何を任せるのか ~
chack411
1
450
インバスケット試験対策アプリを 作って見えたAIエージェント構築 ナレッジ2選
shichijoyuhi
1
130
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
570
Mobile First: as difficult as doing things right
swwweet
225
10k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
610
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
970
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
380
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
400
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
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