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
52
introduction_scriptor_gem.pdf
hatsu
January 09, 2025
Tweet
Share
More Decks by hatsu
See All by hatsu
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
24
15k
Just a Rails Patch Update
hatsu38
2
550
Dive into MaintenanceTasks
hatsu38
1
110
GitHub Actions is Fun
hatsu38
1
120
Other Decks in Programming
See All in Programming
Spatial Rendering for Apple Vision Pro
warrenm
0
340
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
390
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.3k
Androidアプリの One Experience リリース
nein37
0
520
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
220
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1k
バグを見つけた?それAppleに直してもらおう!
uetyo
0
210
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
600
php-conference-japan-2024
tasuku43
0
400
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
160
MCP with Cloudflare Workers
yusukebe
2
260
Compose UIテストを使った統合テスト
hiroaki404
0
120
Featured
See All Featured
Writing Fast Ruby
sferik
628
61k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
Bash Introduction
62gerente
609
210k
Unsuck your backbone
ammeep
669
57k
How to train your dragon (web standard)
notwaldorf
88
5.8k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Agile that works and the tools we love
rasmusluckow
328
21k
How STYLIGHT went responsive
nonsquared
96
5.3k
Designing for Performance
lara
604
68k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
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ͷհͰͨ͠💡