42
Copyright Drecom Co., Ltd. All Rights Reserved. First step of Rails Contribute Railsにプルリクを送ってみた~ @sue445 2013/11/20 渋谷.rb

First step of Rails Contribute #shibuyarb

Embed Size (px)

DESCRIPTION

渋谷.rb[:20131120] で発表した資料です http://www.zusaar.com/event/1707006

Citation preview

Page 1: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

First step of Rails Contribute~Railsにプルリクを送ってみた~

@sue4452013/11/20 渋谷.rb

Page 2: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

自己紹介

sue445 @drecom● 社内ツール系とかサーバ構築とか● 好きな言語はJava● TDDキチガイ(ティー・ワダ教)● 今期も来期もサザエさんとプリキュア推し● AZusaar!! , Chrome Gitlab Notifier とか

Page 3: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

今期の嫁

http://instagram.com/p/Z0RcwNg5Ep/

Page 4: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

本妻

http://instagram.com/p/Z0RsGXg5E_/

Page 5: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

ダブルピース

http://instagram.com/p/gyDzqLg5NE/

Page 6: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

トリプルピース

http://instagram.com/p/gzG8JNg5HD/

Page 7: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

キュア本棚

http://instagram.com/p/gahcRhg5Oa/

Page 8: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

あじぇんだ

● Ruby on Railsについて● 発端● PR送る前● PR送る● PR送った後

Page 9: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

Ruby on Railsについて

説明不要

割愛

省略

ggrks

Page 10: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

発端

ARでSELECT 〜 FOR UPDATEしたかった

Page 12: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

Sample Code

# select * from accounts where id=1 for updateAccount.find(1, lock: true)

Page 13: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

Sample Code

# select * from accounts where id=1 for updateAccount.find(1, lock: true)

# => DEPRECATION WARNING: Passing options to #find is deprecated. Please build a scope and then call #find on it.

Page 14: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

_人人人人人人人人人人_

> サンプルが非推奨 <

 ̄ Y^Y^Y^Y^Y^Y^Y^Y^Y ̄

Page 15: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

あー、WEB+DB Vol.73で読んだわー

Ruby on Rails Guides

Rails 4.0 has deprecated the old-style hash based finder API. This means that methods which previously accepted "finder options" no longer do.

Page 16: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

Chatter(社内SNS)で聞いたら

Page 17: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

2分後にレスがきたwww

Page 18: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

lock! と thx! をかけています

Page 19: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

せっかくなのでこんとりびゅーとしたかった

Page 20: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

サンプルコードを1行直すだけでいい・・・

Page 21: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

テスト書かなくていいから楽

Page 22: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

PR送る前に読んだもの

● Contributing to Ruby on Rails○ 「6 Contributing to the Rails

Documentation」 の辺りを重点的に● API Documentation Guidelines

Page 23: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

俺氏のスペック

● 高校の英語はオールレッド● 大学入試も二次に英語の無い大学を受

験● TOEICスコア300くらい (10年前)

Page 24: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

英語どうですか?

Page 25: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

聞くまでもない

英語ダメです!(キリッ

Page 26: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

PR送る時

英語が最大の壁

Page 27: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

英語は読むより書く方が難しい

Page 28: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

役に立ったもの

● ChangeLog を支える英語● git - 英語コミットコメントに使えるオシャレフ

レーズ集 - Qiita [キータ] ● Google翻訳

○ 何も考えずに入れるとSVCメチャクチャなので翻訳されやすい日本語にするこ

○ GTO=Google Translation Optimize

Page 29: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

PR送ったったwww

https://github.com/rails/rails/pull/12560

Page 30: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

マサカリの嵐!

Page 31: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

かと思ったらRails界隈は優しかった

Page 32: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

優しいダメ出しはたくさんあった

Page 33: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

[ci skip]のことを失念してた

コメントだけの修正の時はコミットメッセージに [ci skip] が必要だった ><

Page 34: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

コードを修正したら2クエリに増えた

Page 35: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

コードを修正したら2クエリに増えた

● [Before] Message.find(1, lock: true)○ SELECT "messages".* FROM "messages" WHERE

"messages"."id" = $1 LIMIT 1 FOR UPDATE [["id", 1]]● [After] Message.find(1).lock!

○ SELECT "messages".* FROM "messages" WHERE "messages"."id" = $1 LIMIT 1 [["id", 1]]

○ SELECT "messages".* FROM "messages" WHERE "messages"."id" = $1 LIMIT 1 FOR UPDATE [["id", 1]]

● [Adviced] Message.lock.find(1)○ SELECT "messages".* FROM "messages" WHERE

"messages"."id" = $1 LIMIT 1 FOR UPDATE [["id", 1]]

Page 36: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

細かい言い回しはよー分からん

Page 37: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

Merge pull request !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Page 38: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

たった3行だけRailsに貢献できた

Page 39: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

まとめ

Page 40: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

こんな僕でも

なんとかなった

Page 41: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

お前らも

なんとかなる

Page 42: First step of Rails Contribute #shibuyarb

Copyright Drecom Co., Ltd. All Rights Reserved.

「プログラマはコードで語り合え」なんて幻想