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
introduction_scriptor_gem.pdf
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
hatsu
January 09, 2025
Programming
200
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
introduction_scriptor_gem.pdf
hatsu
January 09, 2025
More Decks by hatsu
See All by hatsu
active って名前で誤魔化すな / DON'T JUST CALL IT "ACTIVE"
hatsu38
0
84
Prism.parseで 300本以上あるエンドポイントに 接続できる権限の一覧表を作ってみた
hatsu38
1
210
MySQL初心者が311個のカラムにNot NULL制約を追加していってALTER TABLEについて学んだ話
hatsu38
2
440
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
25
21k
Just a Rails Patch Update
hatsu38
2
1k
Dive into MaintenanceTasks
hatsu38
1
240
GitHub Actions is Fun
hatsu38
1
230
Other Decks in Programming
See All in Programming
ソフトウェアラスタライザ
fadis
1
780
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
130
自分的「カンファレンスの楽しみ方」
syumai
0
180
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
120
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
200
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
140
ALB ログから Trace を気合で繋げる技術
fohte
7
860
AIの中の人になってみる
htkym
0
150
業務時間外もAIに働いてもらう話
colorful12
3
9.9k
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
53
34k
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
650
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
640
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
690
Documentation Writing (for coders)
carmenintech
77
5.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Paper Plane (Part 1)
katiecoart
PRO
1
10k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
290
Test your architecture with Archunit
thirion
2
2.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Transcript
Rails8 scripts generatorͷհ ͱͦΕʹ·ͭΘΔGemΛ࡞ͬͨ Omotesando.rb #104 @hatsu_38 2025/01/09
ࣗݾհ • Twitter: @hatsu_38 • GitHub: @hatsu38 • SHE Inc.
• Rubyྺ 5 = ΤϯδχΞྺ • React.js / TypeScript / GitHub Actions • Ruby͕Ұ൪͖
Rails8͔ΒՃ͞Εͨ scriptϑΥϧμ͍ͬͯ·͢ʁ
None
https://discuss.rubyonrails.org/t/is-there-any-of fi cial-way-to-organize-one-off-scripts/74186
OneTime(Ұ͖Γ)ͷscriptͷஔ͖ͷ՝ • ࠓ·ͰRailsެࣜͰఏڙ͍ͯ͠ΔOneTimeઐ༻ͷscriptͷஔ͖ͳ͔ͬͨ • OneTimeͷεΫϦϓτlib/tasks/* ʹஔ͍ͯӡ༻͞Ε͍ͯΔέʔεଟ͍ • migrateͷͨΊͳΒdata_migrate gemmaintenance_tasks gemͷखஈ͋Δ
• ͨͩlib/tasks/*ʹԿ࣮ߦ͞ΕΔScriptͳͲઃஔ͞Ε͍ͯΔ
OneTime(Ұ͖Γ)ͷscriptͷஔ͖Ͳ͕͍͍͜ʁ • Ұ͔͠Θͳ͍scriptɺෳճ࣮ߦ͠ͳ͍͜ͱΛ໌ࣔ͢ΔͨΊʹผϑΥϧμʹ͓͍ ͓͖͍ͯͨ • DHHͷBasecampͰɺscript/migrate/* ͷΑ͏ͳϑΥϧμʹཧ͍ͯ͠Δ • ଞʹscript/benchmarks/*
script/ops/* ͷΑ͏ͳͷΛ࡞ͬͯͨΓ͢Δ
https://github.com/rails/rails/pull/52335
bin/rails generate script my_script • script/my_script.rb ͕ੜ͞ΕΔ • cat script/my_script.rb
• த͍͢͝γϯϓϧ
scriptϑΥϧμͷ͍ํͷྫ • ruby script/my_script.rb "1" "
[email protected]
"
script folderͷഎܠ͍ํҎ্
αʔόʔʹೖ࣮ͬͯߦͱ͔ݏͩͳ͊💭
࣮ߦ݁ՌཤྺͰͱ͓͖͍ͬͯͨͳ💭
GemΛ࡞ͬͯΈͨ💡 https://github.com/hatsu38/scriptor
scriptϑΥϧμʹ͋ΔϑΝΠϧҰཡΛϒϥβͰӾཡͰ͖Δ
scriptϑΥϧμʹ͋ΔϑΝΠϧΛϒϥβͰӾཡͰ͖Δ
ϒϥβ͔Βscriptͷίʔυͷ࣮ߦ͕Ͱ͖Δ/࣮ߦཤྺ͕Δ
None
scriptorͷಋೖ • bundle add scriptor • bin/rails generate scriptor:install •
con fi g/routes.rbʹ `mount Scriptor::Engine => “/scriptor"` ͕Ճ͞ΕΔ • db/migrations/****_create_scriptor_executions.scriptor.rb ͕ੜ͞ΕΔ
Rails8 scriptϑΥϧμͷհͱ Scriptor gemͷհͰͨ͠💡