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
hatsu
January 09, 2025
Programming
1
110
introduction_scriptor_gem.pdf
hatsu
January 09, 2025
Tweet
Share
More Decks by hatsu
See All by hatsu
MySQL初心者が311個のカラムにNot NULL制約を追加していってALTER TABLEについて学んだ話
hatsu38
2
120
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
24
16k
Just a Rails Patch Update
hatsu38
2
690
Dive into MaintenanceTasks
hatsu38
1
140
GitHub Actions is Fun
hatsu38
1
160
Other Decks in Programming
See All in Programming
Browser and UI #2 HTML/ARIA
ken7253
2
180
JAWS DAYS 2025 re_Cheers: WEB
komakichi
0
110
Lambda(Python)の リファクタリングが好きなんです
komakichi
5
270
ComposeでのPicture in Picture
takathemax
0
130
生成AI時代のフルスタック開発
kenn
2
290
2025年のz-index設計を考える
tak_dcxi
7
3.3k
ASP.NETアプリケーションのモダナイゼーションについて
tomokusaba
0
260
カオスに立ち向かう小規模チームの装備の選択〜フルスタックTSという装備の強み _ 弱み〜/Choosing equipment for a small team facing chaos ~ Strengths and weaknesses of full-stack TS~
bitkey
1
140
In geheimer Mission: AI Agents entwickeln
joergneumann
0
110
ぽちぽち選択するだけでOSSを読めるVSCode拡張機能
ymbigo
14
6.2k
Ruby on Railroad: The Power of Visualizing CFG
ydah
0
310
Rubyの!メソッドをちゃんと理解する
alstrocrack
1
240
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
600
What's in a price? How to price your products and services
michaelherold
245
12k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.2k
A better future with KSS
kneath
239
17k
Documentation Writing (for coders)
carmenintech
71
4.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
14
1.4k
Done Done
chrislema
184
16k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
700
Speed Design
sergeychernyshev
29
930
4 Signs Your Business is Dying
shpigford
183
22k
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ͷհͰͨ͠💡