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
19
富山Ruby会議01 をふりかえる
kunitoo
0
34
Using Ractor
kunitoo
0
140
introduction neo4j
kunitoo
0
130
vim operation and my hotkey
kunitoo
0
140
Introduction Neo4j oblove calendar
kunitoo
0
1.4k
アジャイルソフトウェア開発の概要と現場での実践
kunitoo
0
2k
Introduction of neo4j
kunitoo
0
1.9k
Ruby 2.3 のてざわり
kunitoo
2
440
Other Decks in Programming
See All in Programming
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
380
AWS CDKの推しポイント 〜CloudFormationと比較してみた〜
akihisaikeda
3
320
C++20 射影変換
faithandbrave
0
550
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
480
データの民主化を支える、透明性のあるデータ利活用への挑戦 2025-06-25 Database Engineering Meetup#7
y_ken
0
330
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
260
ふつうの技術スタックでアート作品を作ってみる
akira888
0
220
Is Xcode slowly dying out in 2025?
uetyo
1
240
WindowInsetsだってテストしたい
ryunen344
1
210
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
160
技術同人誌をMCP Serverにしてみた
74th
1
450
エンジニア向け採用ピッチ資料
inusan
0
180
Featured
See All Featured
Scaling GitHub
holman
459
140k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Docker and Python
trallard
44
3.4k
Unsuck your backbone
ammeep
671
58k
KATA
mclloyd
30
14k
Designing for humans not robots
tammielis
253
25k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
A designer walks into a library…
pauljervisheath
207
24k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
940
Documentation Writing (for coders)
carmenintech
72
4.9k
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分でできるよ うになります