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
1年かけてgemを1つ作りました
Search
Kunihiko Ito
April 19, 2014
Programming
3
1.4k
1年かけてgemを1つ作りました
大江戸Ruby会議04 で発表したスライド
http://regional.rubykaigi.org/oedo04/
Kunihiko Ito
April 19, 2014
Tweet
Share
More Decks by Kunihiko Ito
See All by Kunihiko Ito
データでふりかえるToyama.rb #100 2024
kunitoo
0
28
富山Ruby会議01 をふりかえる
kunitoo
0
45
Using Ractor
kunitoo
0
150
introduction neo4j
kunitoo
0
140
vim operation and my hotkey
kunitoo
0
150
Introduction Neo4j oblove calendar
kunitoo
0
1.4k
アジャイルソフトウェア開発の概要と現場での実践
kunitoo
0
2k
Introduction of neo4j
kunitoo
0
1.9k
Ruby 2.3 のてざわり
kunitoo
2
460
Other Decks in Programming
See All in Programming
どの様にAIエージェントと 協業すべきだったのか?
takefumiyoshii
2
620
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
200
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
180
CSC509 Lecture 03
javiergs
PRO
0
330
SpecKitでどこまでできる? コストはどれくらい?
leveragestech
0
610
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
380
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
200
iOS 17で追加されたSubscriptionStoreView を利用して5分でサブスク実装チャレンジ
natmark
0
650
止められない医療アプリ、そっと Swift 6 へ
medley
1
130
そのpreloadは必要?見過ごされたpreloadが技術的負債として爆発した日
mugitti9
2
3.1k
Breaking Up with Big ViewModels — Without Breaking Your Architecture (droidcon Berlin 2025)
steliosf
PRO
1
350
ソフトウェア設計の実践的な考え方
masuda220
PRO
3
500
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Optimizing for Happiness
mojombo
379
70k
Practical Orchestrator
shlominoach
190
11k
How STYLIGHT went responsive
nonsquared
100
5.8k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
30
2.9k
4 Signs Your Business is Dying
shpigford
185
22k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Mobile First: as difficult as doing things right
swwweet
224
10k
Transcript
大江戸Ruby会議 04 1年かけて1つのgemを作りました 伊藤 邦彦 永和システムマネジメント
はじめに 発表する機会をいただき ありがとうございます
自己紹介 Kunihiko Ito @kunitoo Asakusa.rb歴: 約1年半 rgitlog を作ってます
今日話すこと Asakusa.rb でやっていること 作ったgemのこと
Asakusa.rb でやっている こと 上野会場のドアを開けたり 他の人の話を聞いたり 写経したり gem を作ったり
上野で会場のドアを開けたり ドア番をお願いされたのが Meet up に参加するきっかけ
他の人の話を聞いたり 会話の単語が分からない 調べながら会話を聞く 少しずつ慣れて話が分かるよう になった
写経したり Rails Tutorial Rails Guides RubyGems Guides
gem を作ったり 自己紹介するときに話せる代表 作がほしい なにを作るか考えるところから 始めた
作ったgem
rgitlog rails アプリの git log をブラウ ザで見ることができます
Insatall 以下を変更するだけ Gemfile config/routes.rb
Gemfile gem 'rgitlog' 次に % bundle
config/routes.rb mount Rgitlog::Engine, at: '/rgitlog'
Usage
rgitlogができるまで やりたいこと探し gitを扱うライブラリ探し
rgitlogができるまで やりたいこと探し gitを扱うライブラリ探し
やりたいこと 開発中に以前のバージョンの見 た目が気になることがあった 動作確認中はブラウザだけで完 結したい git checkout したくない
これからやりたいこと ブランチを選択して checkout したい diff を見れるようにしたい 見た目をかっこよくしたい
rgitlogができるまで やりたいこと探し gitを扱うライブラリ探し
最初のバージョン mojombo/grit mojombo/grit はRuby 2.0で動 かなかった gitlabhq/grit フォークを使用
grit での git log 取得 Repo.new('path/to/my/repository').commits
watchしていたらある日 “Grit is no longer maintained. Check out rugged” Pull
Request が 118 close された
rugged での git log 取得 Rugged::Repository.new('path/to/my/repository').head.log
rugged での git log 取得 Rugged::Repository.new('path/to/my/repository').head.log reflog 取得されます
正解 repo = Rugged::Repository.new('path/to/my/repository') repo.walk(repo.last_commit) 気付くのに数ヶ月かかりました orz
rgitlog リリースまで 作りたいと思ってから約1年 実はとっても簡単に作れます
rgitlogの作り方 今から作ります! 時間ありますよね?
rails plugin new $ rails plugin new rgitlog --mountable -O
-B $ cd rgitlog $ bundle --local
Add rugged rgitlog.gemspec s.add_dependency "rugged"
generate controller $ rails g controller rgitlog index
Controller require_dependency "rgitlog/application_controller" require 'rugged' module Rgitlog class RgitlogController <
ApplicationController def index path = Rugged::Repository.discover(Dir.pwd) repo = Rugged::Repository.new(path) @commits = repo.walk(repo.last_commit).to_a end end end
View <h1>commits</h1> <ul> <% @commits.each do |commit| %> <li><%= commit.message
%></li> <% end %> </ul>
Routes root to: 'rgitlog#index'
完成 慣れると10分くらいで作れるように なる
まとめ Asakusa.rbに通いこつこつと続け ていれば、 1年かかったことが20分でできるよ うになります