rabbit-slide-unasuke-tqrk12 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 04f0f212a4dc6264c65dda1ff1663b78e91470e41b268ba150d592d3fac2f4d9
4
+ data.tar.gz: 7d28366c3218232252dc03903e93e032cd2a8dab11c894c011f3e7de381a34df
5
+ SHA512:
6
+ metadata.gz: d5490ec011965a5f845c99753125dad88e901ca74df74aedead24748c12650e8b123653baa1a3a0cf01c06e7bdd0102722ac40e74638b4bc5aea20920411b205
7
+ data.tar.gz: 83c8ea5a822010a5bf1ae4e3781eb64c82ac812d01dacdee4ef853034628fb93220cfe39f571a502ead65091fa9a924b53165d9a2300eba6b21dabea88fa196d
data/.rabbit ADDED
@@ -0,0 +1 @@
1
+ slide.md
@@ -0,0 +1,22 @@
1
+ # TokyuRubyKaigi12
2
+
3
+ ## 作者向け
4
+
5
+ ### 表示
6
+
7
+ rake
8
+
9
+ ### 公開
10
+
11
+ rake publish
12
+
13
+ ## 閲覧者向け
14
+
15
+ ### インストール
16
+
17
+ gem install rabbit-slide-unasuke-tqrk12
18
+
19
+ ### 表示
20
+
21
+ rabbit rabbit-slide-unasuke-tqrk12.gem
22
+
@@ -0,0 +1,17 @@
1
+ require "rabbit/task/slide"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ spec = nil
6
+ Rabbit::Task::Slide.new do |task|
7
+ spec = task.spec
8
+ # spec.files += Dir.glob("doc/**/*.*")
9
+ # spec.files -= Dir.glob("private/**/*.*")
10
+ # spec.add_runtime_dependency("YOUR THEME")
11
+ end
12
+
13
+ desc "Tag #{spec.version}"
14
+ task :tag do
15
+ sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
16
+ sh("git", "push", "--tags")
17
+ end
@@ -0,0 +1,19 @@
1
+ ---
2
+ id: tqrk12
3
+ base_name: slide
4
+ tags: []
5
+ presentation_date:
6
+ version: 1.0.0
7
+ licenses: ['MIT']
8
+ slideshare_id:
9
+ speaker_deck_id:
10
+ ustream_id:
11
+ vimeo_id:
12
+ youtube_id:
13
+ author:
14
+ markup_language: :markdown
15
+ name: unasuke
16
+ email: yusuke1994525@gmail.com
17
+ rubygems_user: unasuke
18
+ slideshare_user:
19
+ speaker_deck_user:
Binary file
Binary file
@@ -0,0 +1,313 @@
1
+ # Rubyにpatchを\\n送ってみよう!
2
+ subtitle
3
+ : 2018-07-29 at 株式会社VOYAGE GROUP
4
+
5
+ subtitle
6
+ : TokyuRuby会議12
7
+
8
+ author
9
+ : うなすけ
10
+
11
+ theme
12
+ : unasuke-white
13
+
14
+ # 自己紹介
15
+ - 名前 : うなすけ
16
+ - 所属 : 株式会社バンク (エンジニア)
17
+ - インフラ寄りサーバーサイドエンジニア
18
+ - GitHub [@unasuke](https://github.com/unasuke)
19
+ - Twitter [@yu\_suke1994](https://twitter.com/yu_suke1994)
20
+ - Mastodon [@unasuke@mstdn.maud.io](https://mstdn.maud.io/@unasuke)
21
+
22
+ ![](img/icon_raw.jpg){:relative_width="24" align="right" relative_margin_right="-10" relative_margin_top="42"}
23
+
24
+ # 最近
25
+ ![](img/computer-on-the-bed-overview.jpg){:relative_width="70"}
26
+
27
+ [寝転がったままパソコンを使う \| うなすけとあれこれ](https://blog.unasuke.com/2018/use-computer-on-the-bed/)
28
+
29
+ # tqrk12
30
+ ![](img/tweet-yu_suke1994-talk-order.png){:relative_width="90"}
31
+
32
+ # tqrk12
33
+ ![](img/tweet-yu_suke1994-last.png){:relative_width="90"}
34
+
35
+
36
+ # はい
37
+ - はい
38
+
39
+ # Rubyにpatchを送る
40
+ - どうやって?
41
+ - SVNわかんない……
42
+ - C言語わかんない……
43
+ - そもそも送るネタがない
44
+ - 私に直せるバグなんてある?
45
+ - 新機能なんて思いつかないし……
46
+
47
+ # Rubyにpatchを送る
48
+ - どうやって?
49
+ - SVNわかんない…… ←それな
50
+ - C言語わかんない…… ←それな
51
+ - そもそも送るネタがない
52
+ - 私に直せるバグなんてある? ←それな
53
+ - 新機能なんて思いつかないし…… ←それな
54
+
55
+ # Rubyにpatchを送った
56
+
57
+ {:.center}
58
+ {::tag name="x-large"}ぼくのばあい{:/tag}
59
+
60
+ # bank/karakuri_ai-ruby
61
+ ![https://github.com/bank/karakuri_ai-ruby](img/github-bank-karakuri_ai-ruby.png){:relative_width="90"}
62
+
63
+
64
+ # bank/karakuri_ai-ruby's gemspec
65
+
66
+ ```ruby
67
+ spec.add_development_dependency "bundler", "~> 1.16"
68
+ spec.add_development_dependency "rake", "~> 10.0"
69
+ spec.add_development_dependency "minitest", "~> 5.0"
70
+ spec.add_development_dependency "webmock"
71
+ ```
72
+
73
+ [karakuri_ai-ruby/karakuri_ai.gemspec at master · bank/karakuri_ai-ruby · GitHub](https://github.com/bank/karakuri_ai-ruby/blob/a6462b888882693bc6123add5fc2d8d815fd6a02/karakuri_ai.gemspec#L24-L27)
74
+
75
+ - runtime_dependencyがない!
76
+ - 標準ライブラリのみを使用している
77
+
78
+ # net/http のみで実装するAPI Client Gem
79
+ - 動機
80
+ - 無駄に依存を増やしたくない
81
+ - Faraday
82
+ - httparty
83
+ - etc...
84
+ - [https://postd.cc/kill-your-dependencies/](https://postd.cc/kill-your-dependencies/)
85
+ - 標準ライブラリのお勉強
86
+
87
+ # net/http のみで実装するAPI Client Gem
88
+ - 機能
89
+ - 認証
90
+ - JSONをPOROにmapping
91
+ - エラーが返ってきたら例外 ← ここ
92
+
93
+ # Net::HTTPResponse#value
94
+ [class Net::HTTPResponse (Ruby 2.5.0)](https://docs.ruby-lang.org/ja/2.5.0/class/Net=3a=3aHTTPResponse.html#I_VALUE)
95
+
96
+ > レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。
97
+
98
+ オッ、便利か〜〜???
99
+
100
+
101
+ # Net::HTTPResponse#value
102
+ [class Net::HTTPResponse (Ruby 2.5.0)](https://docs.ruby-lang.org/ja/2.5.0/class/Net=3a=3aHTTPResponse.html#I_VALUE)
103
+
104
+
105
+ > [EXCEPTION] HTTPServerException:
106
+ > レスポンスが 4xx である場合に発生します。
107
+
108
+ {::tag name="x-large"}🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔🤔{:/tag}
109
+
110
+ # HTTP status code
111
+ > The 4xx class of status code is intended for cases in which the client seems to have erred.The 4xx class of status code is intended for cases in which the client seems to have erred.
112
+
113
+ [https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)
114
+
115
+ 400系はクライアントが悪い場合……だよね?
116
+
117
+ # Net::HTTPResponse#value
118
+ [class Net::HTTPResponse (Ruby 2.5.0)](https://docs.ruby-lang.org/ja/2.5.0/class/Net=3a=3aHTTPResponse.html#I_VALUE)
119
+
120
+
121
+ > [EXCEPTION] HTTPServerException:
122
+ > レスポンスが 4xx である場合に発生します。
123
+
124
+ - 間違ってるのはどっち?
125
+ - Ruby Net::HTTPResponse#value
126
+ - 俺
127
+
128
+ # 困ったときの
129
+ ![](https://img.esa.io/uploads/production/attachments/2910/2016/09/24/3849/6fc478d7-a643-4418-88c4-82ce0d92bbe1.png){:relative_width="80"}
130
+
131
+ # 困ったときの Asakusa.rb
132
+ usa-san says...
133
+
134
+ > これは仕様のバグですね
135
+
136
+
137
+ - 間違ってるのはどっち?
138
+ - Ruby Net::HTTPResponse#value ← こっち
139
+ - 俺
140
+
141
+ # なおす
142
+ - なおす
143
+ - SVNわかんない……
144
+ - C言語わかんない……
145
+
146
+ # なおす
147
+ - なおす
148
+ - SVNわかんない……
149
+ - 使うのはgitだけ
150
+ - C言語わかんない……
151
+ - (今回)書くのはRuby
152
+
153
+ やっていきましょう
154
+
155
+ # なおし手順
156
+ 1. cloneする
157
+ 1. grepする
158
+ 1. みつける
159
+ 1. 書き換える
160
+ 1. testを回す
161
+ 1. bugs.ruby-lang.orgに投稿
162
+ 1. 待つ
163
+
164
+ # なおし手順 - cloneする
165
+ - git cloneでダイジョウブ
166
+ - `https://github.com/ruby/ruby.git` ← オススメ
167
+ - `https://git.ruby-lang.org/ruby.git`
168
+
169
+ # なおし手順 - grepする
170
+ ```shell
171
+ $ git grep HTTPServerException
172
+ ```
173
+
174
+ `lib/net/http/exceptions.rb` が怪しい!
175
+
176
+ ```ruby
177
+ # lib/net/http/exceptions.rb
178
+ module Net::HTTPExceptions
179
+ def initialize(msg, res) #:nodoc:
180
+ super msg
181
+ @response = res
182
+ end
183
+ attr_reader :response
184
+ alias data response #:nodoc: obsolete
185
+ end
186
+ ### snip ###
187
+ ```
188
+
189
+ # なおし手順 - みつける
190
+ ```ruby
191
+ class Net::HTTPServerException < Net::ProtoServerError
192
+ # We cannot use the name "HTTPServerError", it is the name of the response.
193
+ include Net::HTTPExceptions
194
+ end
195
+ ```
196
+ [https://github.com/ruby/ruby/blob/v2_5_1/lib/net/http/exceptions.rb#l19-l22](https://github.com/ruby/ruby/blob/v2_5_1/lib/net/http/exceptions.rb#l19-l22)
197
+
198
+ ここだ〜〜〜〜
199
+
200
+ # なおし手順 - 書き換える
201
+ - 単純に名前を換えるのヤバそう
202
+ - この例外の名前を使ってるコードがぶっ壊れ
203
+ - `alias` という便利機能があるっぽい
204
+ - [https://docs.ruby-lang.org/ja/latest/doc/spec=2fdef.html#alias](https://docs.ruby-lang.org/ja/latest/doc/spec=2fdef.html#alias)
205
+ - Rubyってすごいな〜〜
206
+
207
+ # なおし手順 - 書き換える
208
+ しかしこういうことはできない!
209
+
210
+ ```ruby
211
+ alias Net::NiceExceptionName Net::HTTPServerException
212
+ ```
213
+
214
+ これならできる
215
+
216
+ ```ruby
217
+ module Net
218
+ alias NiceExceptionName HTTPServerException
219
+ end
220
+ ```
221
+
222
+ # なおし手順 - 書き換える
223
+ 結局こうした
224
+
225
+ ```ruby
226
+ # for compatibility
227
+ Net::HTTPClientException = Net::HTTPServerException
228
+ ```
229
+
230
+ {::tag name="x-small"}usaさんが代入すればいい的なことをおっしゃってたので……{:/tag}
231
+
232
+ # なおし手順 - testを回す
233
+ - 変更してtestが通るか確認
234
+ - `make check`
235
+ - なんならテストも書き換える
236
+
237
+ ```diff
238
+ # test/net/http/test_httpresponse.rb
239
+ res = Net::HTTPResponse.read_new(io)
240
+ assert_equal(nil, res.message)
241
+ - assert_raise Net::HTTPServerException do
242
+ + assert_raise Net::HTTPClientException do
243
+ res.error!
244
+ end
245
+ end
246
+ ```
247
+
248
+ # なおし手順 - bugs.ruby-lang.orgに投稿
249
+ 1. ユーザー登録する
250
+ 1. チケット → 「新しいチケット」をクリック
251
+ 1. 思いの丈をぶつける
252
+
253
+ [Feature #14688: Net::HTTPResponse#value raises "Net::HTTPServerException" in 4xx response - Ruby trunk - Ruby Issue Tracking System](https://bugs.ruby-lang.org/issues/14688)
254
+
255
+
256
+ # なおし手順 - 待つ
257
+ - open 04/15 → close 06/06
258
+ - 約2ヶ月
259
+ - きっかけはnaruseさんに直に相談
260
+ - 「会える」は強い
261
+ - みんな暇じゃない
262
+
263
+ # my patch approved!
264
+ ![](img/tweet-yu_suke1994-patch-approved.png){:relative_width="90"}
265
+
266
+ # Rubyにpatchを送る
267
+ - どうやって?
268
+ - SVNわかんない……
269
+ - 使うのはgitだけ
270
+ - C言語わかんない……
271
+ - 領域による
272
+
273
+ # Rubyにpatchを送る
274
+ - そもそも送るネタがない
275
+ - 私に直せるバグなんてある?
276
+ - 新機能なんて思いつかないし……
277
+
278
+
279
+ # Rubyにpatchを送る
280
+ ![](img/tweet-mametter-refactor.png){:relative_width="60"}
281
+
282
+ [https://twitter.com/mametter/status/1022848181590052864](https://twitter.com/mametter/status/1022848181590052864)
283
+
284
+ # Rubyにpatchを送る
285
+ > テストやリファクタリングを頑張るコミッタはあんまいない
286
+
287
+
288
+ # Rubyにpatchを送る
289
+ ![](img/github-ruby-ruby-igaiga-pullreq.png){:relative_width="90"}
290
+
291
+ # Rubyにpatchを送る
292
+ - そもそも送るネタがない
293
+ - 私に直せるバグなんてある?
294
+ - 不足しているテストを書くとよさそう
295
+ - 新機能なんて思いつかないし……
296
+ - (今)思いつかなくてもいいのでは
297
+ - あせらない、あせらない
298
+
299
+ # Ruby communityにpatchを送る
300
+ - ruby/rubyだけがRubyじゃない
301
+
302
+ > 「Rubyist」という言葉は造語で、Rubyに対して単なるお客さん以上の気持を持っている人がRubyistです。
303
+
304
+ - rurema/doctree
305
+ - rubima/magazine.rubyist.net
306
+ - many rubygems...
307
+
308
+ # まとめ
309
+ - Ruby 2.6には僕のpatchが含まれてます
310
+ - Rubyにpatchを送るには
311
+ - gitの知識で十分
312
+ - GitHubにpull requestを送るのでもOK
313
+ - We are Rubyist!
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-unasuke-tqrk12
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - unasuke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabbit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ description: ''
28
+ email:
29
+ - yusuke1994525@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rabbit"
35
+ - README.md
36
+ - Rakefile
37
+ - config.yaml
38
+ - img/computer-on-the-bed-overview.jpg
39
+ - img/github-bank-karakuri_ai-ruby.png
40
+ - img/github-ruby-ruby-igaiga-pullreq.png
41
+ - img/icon_raw.jpg
42
+ - img/tweet-mametter-refactor.png
43
+ - img/tweet-yu_suke1994-last.png
44
+ - img/tweet-yu_suke1994-patch-approved.png
45
+ - img/tweet-yu_suke1994-talk-order.png
46
+ - pdf/tqrk12-slide.pdf
47
+ - slide.md
48
+ homepage: http://slide.rabbit-shocker.org/authors/unasuke/tqrk12/
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.7.6
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: TokyuRubyKaigi12
72
+ test_files: []