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
21
富山Ruby会議01 をふりかえる
kunitoo
0
36
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
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
5
1.1k
Modern Angular with Signals and Signal Store:New Rules for Your Architecture @enterJS Advanced Angular Day 2025
manfredsteyer
PRO
0
220
Discover Metal 4
rei315
2
140
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
780
#kanrk08 / 公開版 PicoRubyとマイコンでの自作トレーニング計測装置を用いたワークアウトの理想と現実
bash0c7
1
770
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
260
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
510
Startups on Rails in Past, Present and Future–Irina Nazarova, RailsConf 2025
irinanazarova
0
110
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
290
Rails Frontend Evolution: It Was a Setup All Along
skryukov
0
140
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
250
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
260
Featured
See All Featured
Thoughts on Productivity
jonyablonski
69
4.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Optimizing for Happiness
mojombo
379
70k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Being A Developer After 40
akosma
90
590k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Docker and Python
trallard
44
3.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Rails Girls Zürich Keynote
gr2m
95
14k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
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分でできるよ うになります