rabbit-slide-nishidayuya-2023-09-16-matrk10-permanent_uri_and_dpu 2023.9.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cf601a9b2e63bceb6aaab76c3ae42abcefd87706df377d2d2594621d42dcfd6d
4
+ data.tar.gz: cf4b24c066617269f1fc850cee179c924a9b121511fb7b4783251139558cb5bb
5
+ SHA512:
6
+ metadata.gz: 1f8294ac43cdc65babb8c4f2a7e0b15f7b670f936a25e44912e43d413577e9742cad462b781faedc6cbfe661246c8b3dbbe4e53a56a48dfc5dda08204ade616f
7
+ data.tar.gz: f2d8cc9491c11ee0c3b2b691ce4c2d5ebe69c02ac3f30192b34c521c06126fd4dee56464743206b3ece3c8a0f19e39ed6432539af4f812732540f9d96cd1c117
data/.rabbit ADDED
@@ -0,0 +1,2 @@
1
+ --size 1368,768
2
+ permanent_uri_and_dpu.md
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # ソースコード参照URIの考察と作成したツールの紹介
2
+
3
+ 2023-09-16に開催された[松江Ruby会議10](https://matsue.rubyist.net/matrk10/)での発表資料
4
+
5
+ ---
6
+
7
+ ソースコードを参照するURIは,ブランチ名を使ったものよりもコミットIDを使ったもの(permalink)がよく,さらにはタグ名を使ったものがより望ましいと考える.本発表ではその説明と作成したツールの紹介を行う.
8
+
9
+ ## 作者向け
10
+
11
+ ### 表示
12
+
13
+ rake
14
+
15
+ ### 公開
16
+
17
+ rake publish
18
+
19
+ ## 閲覧者向け
20
+
21
+ ### インストール
22
+
23
+ gem install rabbit-slide-nishidayuya-2023-09-16-matrk10-permanent_uri_and_dpu
24
+
25
+ ### 表示
26
+
27
+ rabbit rabbit-slide-nishidayuya-2023-09-16-matrk10-permanent_uri_and_dpu.gem
data/Rakefile ADDED
@@ -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("rabbit-theme-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
data/config.yaml ADDED
@@ -0,0 +1,24 @@
1
+ ---
2
+ id: 2023-09-16-matrk10-permanent_uri_and_dpu
3
+ base_name: permanent_uri_and_dpu
4
+ tags:
5
+ - CC-BY-4.0
6
+ presentation_date: '2023-09-16'
7
+ presentation_start_time:
8
+ presentation_end_time:
9
+ version: 2023.9.16.0
10
+ licenses: []
11
+ slideshare_id:
12
+ speaker_deck_id:
13
+ vimeo_id:
14
+ youtube_id:
15
+ width: 1368
16
+ height: 768
17
+ source_code_uri:
18
+ author:
19
+ markup_language: :markdown
20
+ name: Yuya.Nishida.
21
+ email:
22
+ rubygems_user: nishidayuya
23
+ slideshare_user:
24
+ speaker_deck_user: nishidayuya
Binary file
@@ -0,0 +1,254 @@
1
+ # ソースコード参照URIの考察と作成したツールの紹介
2
+
3
+ author
4
+ : 西田雄也
5
+
6
+ date
7
+ : 2023-09-16
8
+
9
+ allotted-time
10
+ : 20m
11
+
12
+ theme
13
+ : lightning-simple
14
+
15
+ start-time
16
+ : 2023-09-16
17
+
18
+ end-time
19
+ : 2023-09-16
20
+
21
+ # 自己紹介
22
+
23
+ - 西田雄也 ネットワーク応用通信研究所
24
+ - GitHub: [https://github.com/nishidayuya](https://github.com/nishidayuya)
25
+ - X(旧Twitter): [https://twitter.com/nishidayuya](https://twitter.com/nishidayuya)
26
+ - なにかツールを作るのが趣味
27
+ - [git-cococo](https://github.com/nishidayuya/git-cococo): Gitの作業ディレクトリ上で実行したコマンドによる変更をコミットメッセージに残しながらコミットするコマンド
28
+ - [img_to_pdf](https://github.com/nishidayuya/img_to_pdf): 画像ファイルを大きく印刷するために複数ページのPDFにするコマンド
29
+ - [redmine_ruby_wasm](https://github.com/nishidayuya/redmine_ruby_wasm): Redmineに書いたRubyのコードを実行
30
+ - [dpu](https://github.com/nishidayuya/dpu): 今日紹介するもの
31
+
32
+ # では
33
+
34
+ # 想像してください
35
+
36
+ # 想像してください
37
+
38
+ - とあるウェブサービスのクライアントプログラムの改修をしていました.
39
+ - POSTする際のデフォルトのタイムアウト時間は60秒でした.
40
+ - なぜ60秒であるのか.
41
+ - 調べたところ,あるpull-requestに辿り着きました.
42
+
43
+ # 悲劇
44
+
45
+ # 参照先のURIが見当違い
46
+
47
+ # なぜでしょうか
48
+
49
+ # なぜでしょうか
50
+
51
+ - コメントが書かれた当時(2021-01-07)は合っていた ✨
52
+
53
+
54
+
55
+ - 対象リポジトリの開発が進んだ 🎉
56
+ - 当該コードの行番号が変わった 👀
57
+
58
+
59
+
60
+ - コメントはそのままのため,不適切な位置になった 😭
61
+
62
+ # 発生する場面
63
+
64
+ 今回はpull-requestのコメントでした
65
+
66
+ - ソースコード上のコメント
67
+ - X(旧Twitter)のポスト
68
+ - ブログ記事
69
+ - ...
70
+
71
+
72
+
73
+ ソースコードを参照するURIを書く全ての場面
74
+
75
+ # そうすると
76
+
77
+ # どうすれば良かったのか
78
+
79
+ # どうすれば良かったのか
80
+
81
+ - ブランチ名によるURI
82
+ - https://github.com/ruby/ruby/blob/master/lib/net/http.rb#L690
83
+ -                  ↑↑↑↑ここ
84
+
85
+ # どうすれば良かったのか
86
+
87
+ - ブランチ名によるURI
88
+ - https://github.com/ruby/ruby/blob/master/lib/net/http.rb#L690
89
+ -                  ↑↑↑↑ここ変える
90
+
91
+
92
+
93
+ - コミットIDかタグを元にしたURIにする
94
+ - https://github.com/ruby/ruby/blob/4d0985a7bd8f591dff4b430e288bfd83af782e51/lib/net/http.rb#L690
95
+ - masterブランチに新しいコミットが積まれてもそのままでOK! 🎉
96
+
97
+ # GitHub.comの場合
98
+
99
+ # GitHub.comの場合
100
+
101
+ - 三点リーダークリック→「Copy permalink」クリック
102
+ - y C-l C-cでコピーしても良い
103
+
104
+ ![](github_copy_permalink.png){:relative_height='90'}
105
+
106
+ - コミットIDを元にしたURIが得られる!
107
+
108
+ # 解決
109
+
110
+ # でも...
111
+
112
+ # でも...
113
+
114
+ - いちいちウェブブラウザ上でソースコードを参照するのは面倒
115
+ - テキストエディター上で読むことが多いため
116
+ - 手でURIを作るのも面倒
117
+
118
+
119
+
120
+ - 手元のテキストエディターからサクッとURIを取得したい.
121
+
122
+
123
+
124
+ # エディターの拡張を書こう
125
+
126
+ # エディターの拡張を書こう
127
+
128
+ - 自分が使うテキストエディター
129
+ - Emacs: 普段使い
130
+ - Textbringer: 軽い編集時
131
+ - Vim: sudoで編集するとき
132
+ - Visual Studio Code: ペアプロ・モブプロ時にLiveShare
133
+
134
+
135
+
136
+ - いっぱいある
137
+
138
+ # エディターの拡張を書こう
139
+
140
+ - 自分が使うテキストエディター
141
+ - Emacs: Emacs Lispで書く
142
+ - Textbringer: Rubyで書く
143
+ - Vim: Vim scriptで書く(らしい)
144
+ - Visual Studio Code: TypeScriptやJavaScriptで書く
145
+
146
+
147
+
148
+ - URIを決定するのはRubyで書いて各拡張から呼びだそう!
149
+
150
+ # デモ
151
+
152
+ # dpu.gem: determine permanent URI
153
+
154
+ - `gem install dpu`
155
+ - https://github.com/nishidayuya/dpu
156
+ - タグを使ったURIを生成するメソッドとコマンド
157
+ - 最新20タグ以内に同一内容のファイルがなかったらコミットIDを使う.
158
+
159
+
160
+
161
+ - ブランチURIの悲劇は起こさない.
162
+
163
+ # dpu.gem
164
+
165
+ - なぜタグを使うか.
166
+ - 短い
167
+ - https://github.com/ruby/ruby/blob/v3_0_0/lib/net/http.rb#L690
168
+ - https://github.com/ruby/ruby/blob/4d0985a7bd8f591dff4b430e288bfd83af782e51/lib/net/http.rb#L690
169
+ - 動いているプログラムの調査をするときは,
170
+ 動かしているバージョンのソースコードを調べる.
171
+ - URIを見ただけでバージョンが明らか
172
+
173
+ # dpu.gem
174
+
175
+ 対応しているSCMのサービス
176
+
177
+ - GitHub.com
178
+ - sourcehut
179
+ - pull-requestいただきました
180
+ - (GitLab.com)
181
+
182
+ # dpu.gem - EmacsとTextbringer
183
+
184
+ - https://github.com/nishidayuya/dpu に設定方法
185
+ - Emacs
186
+ - .emacsに書いて使う
187
+ - Textbringer
188
+ - .textbringer.rbに書いて使う
189
+ - 直接dpu.gemのメソッド呼び出しをしている.
190
+
191
+ # dpu.gem - Vim
192
+
193
+ - 自分がVim scriptわかってない
194
+ - sudoで編集するときなので作っていない
195
+
196
+
197
+
198
+ - どなたか作られましたらご連絡ください!
199
+
200
+ # dpu.gem - Visual Studio Code
201
+
202
+ - Marketplaceに出してます
203
+ - [Copy permanent URL](https://marketplace.visualstudio.com/items?itemName=nishidayuya.copy-permanent-url) で検索
204
+ - https://marketplace.visualstudio.com/items?itemName=nishidayuya.copy-permanent-url
205
+ - 2023-09-15時点のインストール数は脅威の
206
+
207
+ # dpu.gem - Visual Studio Code
208
+
209
+ - Marketplaceに出してます
210
+ - [Copy permanent URL](https://marketplace.visualstudio.com/items?itemName=nishidayuya.copy-permanent-url) で検索
211
+ - https://marketplace.visualstudio.com/items?itemName=nishidayuya.copy-permanent-url
212
+ - 2023-09-15時点のインストール数は脅威の
213
+ - ![](vscode_marketplace_copy_permanent_url.png){:relative_height="130" :align="right" :relative_margin_right="-5"}
214
+
215
+ # dpu.gem - Visual Studio Code
216
+
217
+ - ruby.wasmを同梱して呼び出そうと考えた.
218
+
219
+
220
+
221
+ - dpu.gemのインストールをしなくても
222
+ 拡張をインストールしたら使えるように
223
+ - (Rubyが入っていないとしてもすぐ使える)
224
+
225
+ # dpu.gem - Visual Studio Code
226
+
227
+ - ruby.wasmを同梱して呼び出そうと考えましたが...
228
+
229
+
230
+
231
+ - dpu.gemは中でGitのコマンドを実行する.
232
+ - https://github.com/ruby/ruby/blob/a1dc1a3de9683daf5a543d6f618e17aabfcb8708/wasm/README.md#current-limitation より
233
+ - Spawning a new process is not supported. e.g. Kernel.spawn and Kernel.system
234
+ - ruby.wasmの下にあるwasi libcをコマンド実行に対応させる必要がありそう...→調査できてない
235
+
236
+ # 類似ソフトウェア
237
+
238
+ - Emacs
239
+ - [git-link](https://github.com/sshaw/git-link): https://github.com/sshaw/git-link
240
+ - Vim
241
+ - [vim-github-link](https://github.com/knsh14/vim-github-link): https://github.com/knsh14/vim-github-link
242
+ - Visual Studio Code
243
+ - [GitHub Pull Requests and Issues](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github)
244
+ - [vscode-copy-github-permalink](https://marketplace.visualstudio.com/items?itemName=hogashi.vscode-copy-github-permalink)
245
+ - [Copy GitHub URL](https://marketplace.visualstudio.com/items?itemName=mattlott.copy-github-url)
246
+
247
+ # まとめ
248
+
249
+ - ブランチへのURIは古くなる→やめよう
250
+ - タグまたはコミットIDを使ったURIを使う
251
+ - ツールもあるよ!
252
+ - スターはこちら→[https://github.com/nishidayuya/dpu](https://github.com/nishidayuya/dpu)
253
+
254
+ ![](qrcode_dpu_repository.png){:relative_height="130" :align="right" :relative_margin_right="-5"}
Binary file
data/script.md ADDED
@@ -0,0 +1,43 @@
1
+
2
+
3
+ ## 未送信
4
+
5
+ はい、そうすると,「ソースコード参照uriの考察と作成したツールの紹介」ということで、ネットワーク応用通信研究所の西田がしゃべります.
6
+
7
+ ## 未送信
8
+
9
+ はい、とりあえず自己紹介というところで,GitHub.comとX旧Twitterのアカウントはこれです.
10
+ 自分は何かしらのツールを作るのが趣味で、例えばRailsのgenerator生成したコードは,もうそれだけでコミットして,そうじゃない部分のレビューをしたいので,そのためのコマンドラインプログラムを書いたりだとか,自分の娘の写真をでっかく印刷したいので、あの複数ページのPDFにするようなプログラムを書いたりとか,、あとは今日の紹介するツールとかを書いたりしていまう.
11
+ 自己紹介はそんなところでちょっと中に入りましょう.
12
+
13
+ ## 未送信
14
+
15
+ ということでちょっと想像してみてください。
16
+ 今、あなたはとあるWebサービスのクライアントプログラムの改修をしています.
17
+ で、POSTする際のタイムアウト時間のデフォルトが60秒でした。
18
+ しかし、なぜ60秒なのか、ちょっと調べたところ,pull-requestに辿り着きました。
19
+
20
+ うん、これがそのクライアント部分の実装を行ったpull-requestだ.
21
+ デフォルトのタイムアウト時間60秒ってのはそうそう、ここですね.
22
+ これなんで60秒なんだっけ?
23
+ おお,ちゃんとコメントが書いてある.えーと何々,
24
+ <読み上げ>.
25
+ なるほどなるほど.
26
+ で、これがその根拠になったソースコードのURLなんですね。
27
+ Rubyのリポジトリのこのファイルの697行目でこれを判断したと.
28
+ 本当にそうなの?一応このコードを見ておこうっとー.
29
+ クリック,クリックー.ポチ.
30
+ ええ?!
31
+
32
+ 皆々様はこのようなご経験はないでしょうか?
33
+
34
+ ## 未送信
35
+
36
+ はい。
37
+
38
+ 一体何が起こったんでしょうか?
39
+
40
+ ## 未送信
41
+
42
+ ってしまったのです.
43
+
data/setup.md ADDED
@@ -0,0 +1,72 @@
1
+ # 準備
2
+
3
+ ## 画面1
4
+
5
+ ### スライド
6
+
7
+ ```console
8
+ bundle exec rake &
9
+ ```
10
+
11
+ F11での全画面とウィンドウのトグル
12
+
13
+ ### 端末
14
+
15
+ C-+を7回
16
+
17
+ Tmux上で最後のセッション
18
+
19
+ ディレクトリは以下
20
+
21
+ - rabbit ~/private/presentations/2023-09-16
22
+ - `bundle exec rake &`
23
+ - ruby_matrk10 ~/src/github.com/nishidayuya/test_202309_3_matrk10_ruby
24
+
25
+ ### ブラウザ
26
+
27
+ #### pull-request
28
+
29
+ https://github.com/nishidayuya/test_202309_1_matrk10_sample/pull/2/files を表示して次のJavaScriptを実行して投稿した日付を見かけ上,変える.
30
+
31
+ ```js
32
+ [...document.querySelectorAll('relative-time[datetime]')].forEach((node) => node.setAttribute('datetime', node.getAttribute('datetime').replace(/.*T/, '2021-01-07T')))
33
+ ```
34
+
35
+ 200%で開いておく.
36
+
37
+ #### ruby/rubyのfork
38
+
39
+ https://github.com/nishidayuya/test_202309_3_matrk10_ruby
40
+
41
+ #### pull-request改
42
+
43
+ https://github.com/nishidayuya/test_202309_1_matrk10_sample/pull/3/files を表示して同様のJavaScriptを実行する.
44
+
45
+ ## 画面2
46
+
47
+ ### ブラウザ
48
+
49
+ - 空のURI
50
+
51
+ ### Emacs
52
+
53
+ `emacsclient -c`で起動
54
+
55
+ 以下をそれぞれC-x C-0で+を5回
56
+
57
+ - ~/src/github.com/nishidayuya/test_202309_3_matrk10_ruby/lib/net/http.rb
58
+ - `*Messages*`
59
+ - 2行程度表示できる高さ
60
+
61
+ ## 画面3
62
+
63
+ ### ブラウザ
64
+
65
+ - 空のURI
66
+
67
+ ### Visual Studio Code
68
+
69
+ C-+を4回ぐらい
70
+
71
+ - ~/src/github.com/nishidayuya/test_202309_3_matrk10_ruby/lib/net/http.rb
72
+ - 開く
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-nishidayuya-2023-09-16-matrk10-permanent_uri_and_dpu
3
+ version: !ruby/object:Gem::Version
4
+ version: 2023.9.16.0
5
+ platform: ruby
6
+ authors:
7
+ - Yuya.Nishida.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-09-17 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
+ 2023-09-16に開催された[松江Ruby会議10](https://matsue.rubyist.net/matrk10/)での発表資料
29
+
30
+ ---
31
+
32
+ ソースコードを参照するURIは,ブランチ名を使ったものよりもコミットIDを使ったもの(permalink)がよく,さらにはタグ名を使ったものがより望ましいと考える.本発表ではその説明と作成したツールの紹介を行う.
33
+ email:
34
+ -
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".rabbit"
40
+ - README.md
41
+ - Rakefile
42
+ - config.yaml
43
+ - github_copy_permalink.png
44
+ - pdf/2023-09-16-matrk10-permanent_uri_and_dpu-permanent_uri_and_dpu.pdf
45
+ - permanent_uri_and_dpu.md
46
+ - qrcode_dpu_repository.png
47
+ - script.md
48
+ - setup.md
49
+ - vscode_marketplace_copy_permanent_url.png
50
+ homepage: https://slide.rabbit-shocker.org/authors/nishidayuya/2023-09-16-matrk10-permanent_uri_and_dpu/
51
+ licenses: []
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.4.10
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: ソースコード参照URIの考察と作成したツールの紹介
72
+ test_files: []