hikiutils 0.2.3.13 → 0.2.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/hikiutils.gemspec +2 -1
  3. data/hikiutils_bob/Rakefile +30 -16
  4. data/hikiutils_bob/code.hiki +9 -30
  5. data/hikiutils_bob/figs/hikiutils_bob.002.jpeg +0 -0
  6. data/hikiutils_bob/figs/hikiutils_bob.007.jpeg +0 -0
  7. data/hikiutils_bob/figs/hikiutils_bob.pdf +0 -0
  8. data/hikiutils_bob/hikiutils_bob/hikiutils_bob.002.jpeg +0 -0
  9. data/hikiutils_bob/hikiutils_bob/hikiutils_bob.007.jpeg +0 -0
  10. data/hikiutils_bob/hikiutils_bob.key +0 -0
  11. data/hikiutils_bob/latex_all.hiki +33 -8
  12. data/hikiutils_bob/latex_dir/code.aux +7 -14
  13. data/hikiutils_bob/latex_dir/code.log +28 -0
  14. data/hikiutils_bob/latex_dir/code.tex +13 -31
  15. data/hikiutils_bob/latex_dir/hikiutils_bob.log +59 -50
  16. data/hikiutils_bob/latex_dir/hikiutils_bob.pdf +0 -0
  17. data/hikiutils_bob/latex_dir/hikiutils_bob.synctex.gz +0 -0
  18. data/hikiutils_bob/latex_dir/hikiutils_bob.toc +29 -29
  19. data/hikiutils_bob/latex_dir/latex_all.aux +19 -16
  20. data/hikiutils_bob/latex_dir/latex_all.log +28 -0
  21. data/hikiutils_bob/latex_dir/latex_all.tex +34 -9
  22. data/hikiutils_bob/latex_dir/sync.aux +16 -16
  23. data/hikiutils_bob/latex_dir/sync.tex +4 -4
  24. data/hikiutils_yamane/Rakefile +14 -2
  25. data/hikiutils_yamane/abstract.hiki +3 -3
  26. data/hikiutils_yamane/discussion.hiki +9 -0
  27. data/hikiutils_yamane/hikiutils_yamane.hiki +8 -10
  28. data/hikiutils_yamane/introduction.hiki +1 -1
  29. data/hikiutils_yamane/latex_dir/abstract.tex +3 -3
  30. data/hikiutils_yamane/latex_dir/{%CA%FD/313/241.aux → discussion.aux} +8 -7
  31. data/hikiutils_yamane/latex_dir/discussion.tex +9 -0
  32. data/hikiutils_yamane/latex_dir/hikiutils_yamane.aux +3 -6
  33. data/hikiutils_yamane/latex_dir/hikiutils_yamane.log +50 -59
  34. data/hikiutils_yamane/latex_dir/hikiutils_yamane.pdf +0 -0
  35. data/hikiutils_yamane/latex_dir/hikiutils_yamane.synctex.gz +0 -0
  36. data/hikiutils_yamane/latex_dir/hikiutils_yamane.tex +4 -7
  37. data/hikiutils_yamane/latex_dir/hikiutils_yamane.toc +21 -21
  38. data/hikiutils_yamane/latex_dir/introduction.tex +1 -1
  39. data/hikiutils_yamane/latex_dir/method.aux +46 -0
  40. data/hikiutils_yamane/latex_dir/method.tex +247 -0
  41. data/hikiutils_yamane/latex_dir/results.aux +49 -0
  42. data/hikiutils_yamane/latex_dir/results.tex +249 -0
  43. data/hikiutils_yamane/method.hiki +234 -0
  44. data/hikiutils_yamane/results.hiki +225 -0
  45. data/hikiutils_yamane/toc.hiki +0 -1
  46. data/lib/hikiutils/version.rb +1 -1
  47. data/lib/hikiutils_thor.rb~ +37 -37
  48. data/lib/templates/Rakefile_hiki_sync +32 -17
  49. data/lib/templates/mi_key_bind_setting +1 -0
  50. metadata +33 -19
  51. data/hikiutils_yamane/Rakefile~ +0 -477
  52. data/hikiutils_yamane/command.hiki +0 -111
  53. data/hikiutils_yamane/compare.hiki +0 -116
  54. data/hikiutils_yamane/latex_dir/command.aux +0 -35
  55. data/hikiutils_yamane/latex_dir/command.log +0 -0
  56. data/hikiutils_yamane/latex_dir/command.tex +0 -123
  57. data/hikiutils_yamane/latex_dir/compare.aux +0 -30
  58. data/hikiutils_yamane/latex_dir/compare.tex +0 -123
  59. data/hikiutils_yamane/latex_dir/optparse.aux +0 -31
  60. data/hikiutils_yamane/latex_dir/optparse.tex +0 -119
  61. data/hikiutils_yamane/latex_dir/thor.aux +0 -32
  62. data/hikiutils_yamane/latex_dir/thor.tex +0 -110
  63. data/hikiutils_yamane/optparse.hiki +0 -114
  64. data/hikiutils_yamane/thor.hiki +0 -107
@@ -1,4 +1,4 @@
1
- This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.1.26) 10 FEB 2017 15:01
1
+ This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.1.26) 12 FEB 2017 12:03
2
2
  entering extended mode
3
3
  restricted \write18 enabled.
4
4
  file:line:error style messages enabled.
@@ -117,21 +117,20 @@ Package: jlisting 2006/02/20 0.2 (Thor)
117
117
  \lst@nextchar=\count99
118
118
  \lst@inputfile=\read1
119
119
  ) (./hikiutils_yamane.aux (./abstract.aux) (./introduction.aux)
120
- (./compare.aux) (./optparse.aux
120
+ (./method.aux
121
121
 
122
122
  LaTeX Warning: Label `default' multiply defined.
123
123
 
124
124
 
125
125
  LaTeX Warning: Label `default' multiply defined.
126
126
 
127
- ) (./command.aux
127
+ ) (./results.aux
128
128
 
129
129
  LaTeX Warning: Label `default' multiply defined.
130
130
 
131
131
 
132
132
  LaTeX Warning: Label `default' multiply defined.
133
133
 
134
- ) (./thor.aux
135
134
 
136
135
  LaTeX Warning: Label `default' multiply defined.
137
136
 
@@ -141,7 +140,7 @@ LaTeX Warning: Label `default' multiply defined.
141
140
 
142
141
  LaTeX Warning: Label `default' multiply defined.
143
142
 
144
- ))
143
+ ) (./discussion.aux))
145
144
  \openout1 = `hikiutils_yamane.aux'.
146
145
 
147
146
  LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 38.
@@ -207,13 +206,13 @@ LaTeX Font Info: Font shape `JY1/mc/m/n' will be
207
206
  [3]
208
207
  \openout2 = `abstract.aux'.
209
208
 
210
- (./abstract.tex) [4
209
+ (./abstract.tex)
210
+ [4
211
211
 
212
212
  ]
213
213
  \openout2 = `introduction.aux'.
214
214
 
215
-
216
- (./introduction.tex
215
+ (./introduction.tex
217
216
  File: ../figs/./hikiutils_yamane.001.jpg Graphic file (type eps)
218
217
  <../figs/./hikiutils_yamane.001.jpg>
219
218
  LaTeX Font Info: Font shape `JT1/mc/m/n' will be
@@ -223,17 +222,15 @@ LaTeX Font Info: Font shape `JY1/mc/m/n' will be
223
222
  ) [5
224
223
 
225
224
 
226
- ] [6] [7
225
+ ] [6]
226
+ \openout2 = `method.aux'.
227
227
 
228
- ]
229
- \openout2 = `compare.aux'.
230
228
 
231
-
232
- (./compare.tex
229
+ (./method.tex
233
230
  LaTeX Font Info: Font shape `JT1/gt/m/n' will be
234
- (Font) scaled to size 11.53198pt on input line 2.
231
+ (Font) scaled to size 11.53198pt on input line 3.
235
232
  LaTeX Font Info: Font shape `JY1/gt/m/n' will be
236
- (Font) scaled to size 11.53198pt on input line 2.
233
+ (Font) scaled to size 11.53198pt on input line 3.
237
234
 
238
235
  (/usr/local/texlive/2016/texmf-dist/tex/latex/listings/lstlang1.sty
239
236
  File: lstlang1.sty 2015/06/04 1.6 listings language file
@@ -257,101 +254,95 @@ LaTeX Font Info: Font shape `JY1/gt/m/n' will be
257
254
  (Font) scaled to size 6.72699pt on input line 23.
258
255
  LaTeX Font Info: Font shape `OT1/cmtt/bx/n' in size <7> not available
259
256
  (Font) Font shape `OT1/cmtt/m/n' tried instead on input line 23.
260
- [8
261
-
262
- ]
263
- [9]) [10]
264
- \openout2 = `optparse.aux'.
265
-
266
- (./optparse.tex
267
- File: ../figs/./hikiutils_yamane.005.jpg Graphic file (type eps)
268
- <../figs/./hikiutils_yamane.005.jpg> [11
257
+ [7
269
258
 
270
259
 
271
260
  ]
261
+ [8] [9]
262
+ File: ../figs/./hikiutils_yamane.005.jpg Graphic file (type eps)
263
+ <../figs/./hikiutils_yamane.005.jpg> [10]
272
264
  File: ../figs/./hikiutils_yamane.007.jpg Graphic file (type eps)
273
265
 
274
- <../figs/./hikiutils_yamane.007.jpg> [12] [13]) [14] [15
266
+ <../figs/./hikiutils_yamane.007.jpg> [11] [12] [13]) [14]
267
+ \openout2 = `results.aux'.
275
268
 
276
- ]
277
- \openout2 = `command.aux'.
278
-
279
- (./command.tex
269
+ (./results.tex
280
270
  File: ../figs/./hikiutils_yamane.002.jpg Graphic file (type eps)
281
271
 
282
272
  <../figs/./hikiutils_yamane.002.jpg>
283
- LaTeX Font Info: Try loading font information for OMS+cmr on input line 23.
273
+ LaTeX Font Info: Try loading font information for OMS+cmr on input line 24.
284
274
 
285
275
  (/usr/local/texlive/2016/texmf-dist/tex/latex/base/omscmr.fd
286
276
  File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions
287
277
  )
288
278
  LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10> not available
289
- (Font) Font shape `OMS/cmsy/m/n' tried instead on input line 23.
290
- [16
279
+ (Font) Font shape `OMS/cmsy/m/n' tried instead on input line 24.
280
+ [15
291
281
 
292
- ] [17]
293
- [18]) [19]
294
- \openout2 = `thor.aux'.
295
282
 
296
- (./thor.tex
283
+ ] [16]
284
+ [17]
297
285
  File: ../figs/./hikiutils_yamane.003.jpg Graphic file (type eps)
298
- <../figs/./hikiutils_yamane.003.jpg> [20
299
-
300
-
301
- ]
286
+ <../figs/./hikiutils_yamane.003.jpg> [18]
302
287
  File: ../figs/./hikiutils_yamane.004.jpg Graphic file (type eps)
303
288
 
304
- <../figs/./hikiutils_yamane.004.jpg> [21]
289
+ <../figs/./hikiutils_yamane.004.jpg> [19] [20]
305
290
  File: ../figs/./hikiutils_yamane.006.jpg Graphic file (type eps)
306
- <../figs/./hikiutils_yamane.006.jpg>
307
- [22]
308
- Overfull \hbox (3.95764pt too wide) in paragraph at lines 84--85
291
+
292
+ <../figs/./hikiutils_yamane.006.jpg>
293
+ Overfull \hbox (3.95764pt too wide) in paragraph at lines 215--216
309
294
  \OT1/cmr/m/n/10 Thor \JY1/mc/m/n/10 では \OT1/cmr/m/n/10 start(ARGV) \JY1/mc/m/
310
295
  n/10 を呼び出すことで \OT1/cmr/m/n/10 CLI \JY1/mc/m/n/10 を開始する . \OT1/cmr
311
296
  /m/n/10 Hikithor::CLI.start(ARGV)
312
297
  []
313
298
 
314
- [23]) [24]
315
- Underfull \hbox (badness 10000) in paragraph at lines 58--59
299
+ [21]) [22]
300
+ \openout2 = `discussion.aux'.
301
+
302
+ (./discussion.tex) [23
303
+
304
+
305
+ ]
306
+ Underfull \hbox (badness 10000) in paragraph at lines 55--56
316
307
  []\OT1/cmr/m/n/10 hikidoc, \OT1/cmtt/m/n/10 https://rubygems.org/gems/hikidoc/v
317
308
  ersions/0.1.0,
318
309
  []
319
310
 
320
311
 
321
- Overfull \hbox (30.69658pt too wide) in paragraph at lines 59--60
312
+ Overfull \hbox (28.25214pt too wide) in paragraph at lines 56--57
322
313
  []\JY1/mc/m/n/10 「\OT1/cmr/m/n/10 Thor \JY1/mc/m/n/10 の使い方まとめ 」 \OT1/c
323
- mr/m/n/10 , \OT1/cmtt/m/n/10 http://qiita.com/succi0303/items/32560103190436c94
324
- 35b
314
+ mr/m/n/10 ,\OT1/cmtt/m/n/10 http://qiita.com/succi0303/items/32560103190436c943
315
+ 5b
325
316
  []
326
317
 
327
318
 
328
- Underfull \hbox (badness 10000) in paragraph at lines 60--61
319
+ Underfull \hbox (badness 10000) in paragraph at lines 57--58
329
320
  []\JY1/mc/m/n/10 「\OT1/cmr/m/n/10 15.5. opt-parse - \JY1/mc/m/n/10 コマンドラ
330
321
  インオプシ ョン解析器 」 \OT1/cmr/m/n/10 ,
331
322
  []
332
323
 
333
324
 
334
- Overfull \hbox (38.02074pt too wide) in paragraph at lines 61--62
325
+ Overfull \hbox (38.02074pt too wide) in paragraph at lines 58--59
335
326
  []\JY1/mc/m/n/10 「\OT1/cmr/m/n/10 library opt-parse\JY1/mc/m/n/10 」 \OT1/cmr/
336
327
  m/n/10 , \OT1/cmtt/m/n/10 https://docs.ruby-lang.org/ja/latest/library/optparse
337
328
  .html
338
329
  []
339
330
 
340
- [25
331
+ [24
341
332
 
342
333
  ] (./hikiutils_yamane.aux (./abstract.aux) (./introduction.aux)
343
- (./compare.aux) (./optparse.aux) (./command.aux) (./thor.aux))
334
+ (./method.aux) (./results.aux) (./discussion.aux))
344
335
 
345
336
  LaTeX Warning: There were multiply-defined labels.
346
337
 
347
338
  )
348
339
  Here is how much of TeX's memory you used:
349
- 2624 strings out of 493683
350
- 36097 string characters out of 6149653
351
- 249697 words of memory out of 5000000
352
- 6151 multiletter control sequences out of 15000+600000
340
+ 2619 strings out of 493683
341
+ 36077 string characters out of 6149653
342
+ 259998 words of memory out of 5000000
343
+ 6153 multiletter control sequences out of 15000+600000
353
344
  15673 words of font info for 72 fonts, out of 8000000 for 9000
354
345
  934 hyphenation exceptions out of 8191
355
- 35i,9n,51p,777b,1725s stack positions out of 5000i,500n,10000p,200000b,80000s
346
+ 35i,9n,51p,777b,1684s stack positions out of 5000i,500n,10000p,200000b,80000s
356
347
 
357
- Output written on hikiutils_yamane.dvi (25 pages, 91988 bytes).
348
+ Output written on hikiutils_yamane.dvi (24 pages, 95744 bytes).
@@ -48,15 +48,12 @@
48
48
 
49
49
  \include{abstract}
50
50
  \include{introduction}
51
- \section{方法}
52
- \include{compare}
53
- \include{optparse}
54
- \section{結果}
55
- \include{command}
56
- \include{thor}
51
+ \include{method}
52
+ \include{results}
53
+ \include{discussion}
57
54
  \begin{thebibliography}{99}
58
55
  \bibitem{1-1} hikidoc, \verb|https://rubygems.org/gems/hikidoc/versions/0.1.0,| \verb|https://github.com/hiki/hikidoc,2017/1/30| アクセス.
59
- \bibitem{1-2} 「Thorの使い方まとめ」, \verb|http://qiita.com/succi0303/items/32560103190436c9435b| ,2017/1/30 アクセス.
56
+ \bibitem{1-2} 「Thorの使い方まとめ」,\verb|http://qiita.com/succi0303/items/32560103190436c9435b| 2015/01/14更新,2017/1/30 アクセス.
60
57
  \bibitem{1-3} 「15.5. optparse - コマンドラインオプション解析器」, \verb|http://docs.python.jp/2/library/optparse.html| ,2017/1/30 アクセス.
61
58
  \bibitem{1-4} 「library optparse」, \verb|https://docs.ruby-lang.org/ja/latest/library/optparse.html| ,2017/1/30 アクセス.
62
59
  \end{thebibliography}
@@ -1,31 +1,31 @@
1
1
  \contentsline {section}{\numberline {1}概要}{4}
2
2
  \contentsline {section}{\numberline {2}序論}{5}
3
3
  \contentsline {section}{\numberline {3}方法}{7}
4
- \contentsline {subsection}{\numberline {3.1}optparseとthorの比較}{8}
5
- \contentsline {subsubsection}{\numberline {3.1.1}optparse}{8}
4
+ \contentsline {subsection}{\numberline {3.1}optparseとthorの比較}{7}
5
+ \contentsline {subsubsection}{\numberline {3.1.1}Thor}{7}
6
+ \contentsline {paragraph}{fizzbuzzメソッド,versionメソッド}{8}
7
+ \contentsline {subsubsection}{\numberline {3.1.2}optparse}{8}
6
8
  \contentsline {paragraph}{runメソッド}{9}
7
9
  \contentsline {paragraph}{initializeメソッド}{9}
8
10
  \contentsline {paragraph}{executeメソッド}{9}
9
- \contentsline {paragraph}{fizzbuzzメソッド}{10}
11
+ \contentsline {paragraph}{fizzbuzzメソッド}{9}
10
12
  \contentsline {paragraph}{versionメソッド}{10}
11
- \contentsline {subsubsection}{\numberline {3.1.2}Thor}{10}
12
- \contentsline {paragraph}{fizzbuzzメソッド,versionメソッド}{10}
13
- \contentsline {subsection}{\numberline {3.2}既存のhikiutilsのコマンド解説}{11}
14
- \contentsline {subsubsection}{\numberline {3.2.1}コマンドの登録と実行メソッド}{11}
15
- \contentsline {subsubsection}{\numberline {3.2.2}CLIの実行プロセス}{12}
16
- \contentsline {subsubsection}{\numberline {3.2.3}コード}{13}
13
+ \contentsline {subsection}{\numberline {3.2}既存のhikiutilsのコマンド解説}{10}
14
+ \contentsline {subsubsection}{\numberline {3.2.1}コマンドの登録と実行メソッド}{10}
15
+ \contentsline {subsubsection}{\numberline {3.2.2}CLIの実行プロセス}{11}
16
+ \contentsline {subsubsection}{\numberline {3.2.3}コード}{12}
17
17
  \contentsline {section}{\numberline {4}結果}{15}
18
- \contentsline {subsection}{\numberline {4.1}コマンドの命名原則}{16}
19
- \contentsline {subsubsection}{\numberline {4.1.1}hikiutilsの想定利用形態}{16}
20
- \contentsline {subsubsection}{\numberline {4.1.2}コメンド名と振る舞いの詳細}{17}
18
+ \contentsline {subsection}{\numberline {4.1}コマンドの命名原則}{15}
19
+ \contentsline {subsubsection}{\numberline {4.1.1}hikiutilsの想定利用形態}{15}
20
+ \contentsline {subsubsection}{\numberline {4.1.2}コメンド名と振る舞いの詳細}{16}
21
21
  \contentsline {paragraph}{open FILE}{17}
22
- \contentsline {paragraph}{ls [FILE]}{18}
23
- \contentsline {paragraph}{rsync}{18}
22
+ \contentsline {paragraph}{ls [FILE]}{17}
23
+ \contentsline {paragraph}{rsync}{17}
24
24
  \contentsline {paragraph}{touch FILE}{18}
25
- \contentsline {paragraph}{pwd}{19}
26
- \contentsline {paragraph}{cd VAL}{19}
27
- \contentsline {subsection}{\numberline {4.2}Thorによる実装}{20}
28
- \contentsline {subsubsection}{\numberline {4.2.1}クラス初期化}{20}
29
- \contentsline {subsubsection}{\numberline {4.2.2}コマンド定義}{21}
30
- \contentsline {subsubsection}{\numberline {4.2.3}CLIの実行プロセス}{22}
31
- \contentsline {subsubsection}{\numberline {4.2.4}optparseとの全体的な比較}{24}
25
+ \contentsline {paragraph}{pwd}{18}
26
+ \contentsline {paragraph}{cd VAL}{18}
27
+ \contentsline {subsection}{\numberline {4.2}Thorによる実装}{18}
28
+ \contentsline {subsubsection}{\numberline {4.2.1}クラス初期化}{18}
29
+ \contentsline {subsubsection}{\numberline {4.2.2}コマンド定義}{19}
30
+ \contentsline {subsubsection}{\numberline {4.2.3}CLIの実行プロセス}{21}
31
+ \contentsline {section}{\numberline {5}optparseからThorへの移行}{23}
@@ -1,5 +1,5 @@
1
1
  \section{序論}
2
- hikiは,hiki記法を用いたwiki cloneである.wikiはウォード・カニンガムが作ったwikiwikiwebを源流とするhome page制作を容易にするシステムで,hikiもwikiの基本要求仕様を満足するシステムを提供する.wikiの特徴であるweb上で編集する機能を提供する.これを便宜上hiki web systemと呼ぶ.図にある通り,一般的な表示画面の他に,編集画面が提供されており,ユーザーはこの編集画面からコンテンツを編集することが可能である.リンクやヘッダー,リスト,引用,表,図の表示などの基本テキストフォーマットが用意されている.
2
+ hikiは,hiki記法を用いたwiki cloneである.wikiはウォード・カニンガムが作ったwikiwikiwebを源流とするhome page制作を容易にするシステムで,hikiもwikiの基本要求仕様を満足するシステムを提供する.wikiの特徴であるweb上で編集する機能を提供する.これを便宜上hiki web systemと呼ぶ.図\ref{fig:one}にある通り,一般的な表示画面の他に,編集画面が提供されており,ユーザーはこの編集画面からコンテンツを編集することが可能である.リンクやヘッダー,リスト,引用,表,図の表示などの基本テキストフォーマットが用意されている.
3
3
 
4
4
  hiki web systemの実際の基本動作は,hiki.cgiプログラムを介して行われている.こちらを便宜上hiki systemと呼ぶ.図\ref{fig:one}に従ってhiki systemの動作概要を説明する.hiki systemは,data/textに置かれた書かれたプレーンテキストをhtmlへ変換する.この変換はhikidoc\cite{1-1}というhikiフォーマットconverterを使っている.また,添付書類はcache/attachに,一度フォーマットしたhtmlはparserに置かれており,それらを参照してhtmlを表示する画面をhiki.cgiは作っている.さらにhiki systemでは検索機能,自動リンク作成などが提供されている
5
5
 
@@ -0,0 +1,46 @@
1
+ \relax
2
+ \citation{1-2}
3
+ \citation{1-2}
4
+ \citation{1-2}
5
+ \@writefile{toc}{\contentsline {section}{\numberline {3}方法}{7}}
6
+ \@writefile{toc}{\contentsline {subsection}{\numberline {3.1}optparseとthorの比較}{7}}
7
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {3.1.1}Thor}{7}}
8
+ \citation{1-3}
9
+ \citation{1-4}
10
+ \@writefile{toc}{\contentsline {paragraph}{fizzbuzzメソッド,versionメソッド}{8}}
11
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {3.1.2}optparse}{8}}
12
+ \@writefile{toc}{\contentsline {paragraph}{runメソッド}{9}}
13
+ \@writefile{toc}{\contentsline {paragraph}{initializeメソッド}{9}}
14
+ \@writefile{toc}{\contentsline {paragraph}{executeメソッド}{9}}
15
+ \@writefile{toc}{\contentsline {paragraph}{fizzbuzzメソッド}{9}}
16
+ \@writefile{toc}{\contentsline {paragraph}{versionメソッド}{10}}
17
+ \@writefile{toc}{\contentsline {subsection}{\numberline {3.2}既存のhikiutilsのコマンド解説}{10}}
18
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {3.2.1}コマンドの登録と実行メソッド}{10}}
19
+ \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces コマンドの登録と実行メソッドの対応.}}{10}}
20
+ \newlabel{fig:005}{{2}{10}}
21
+ \newlabel{default}{{2}{10}}
22
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {3.2.2}CLIの実行プロセス}{11}}
23
+ \@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces CLIの実行プロセス.}}{12}}
24
+ \newlabel{fig:007}{{3}{12}}
25
+ \newlabel{default}{{3}{12}}
26
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {3.2.3}コード}{12}}
27
+ \@setckpt{method}{
28
+ \setcounter{page}{15}
29
+ \setcounter{equation}{0}
30
+ \setcounter{enumi}{2}
31
+ \setcounter{enumii}{0}
32
+ \setcounter{enumiii}{0}
33
+ \setcounter{enumiv}{0}
34
+ \setcounter{footnote}{0}
35
+ \setcounter{mpfootnote}{0}
36
+ \setcounter{part}{0}
37
+ \setcounter{section}{3}
38
+ \setcounter{subsection}{2}
39
+ \setcounter{subsubsection}{3}
40
+ \setcounter{paragraph}{0}
41
+ \setcounter{subparagraph}{0}
42
+ \setcounter{figure}{3}
43
+ \setcounter{table}{0}
44
+ \setcounter{lstnumber}{38}
45
+ \setcounter{lstlisting}{0}
46
+ }
@@ -0,0 +1,247 @@
1
+
2
+ \section{方法}
3
+ \subsection{optparseとthorの比較}
4
+ 今回の研究対象のhikiutilsは,optparseというコマンドライン解析ライブラリで実装されている.
5
+ 本研究ではこの代替ライブラリとしてThorの採用を検討した.
6
+ 本章の最初では,FizzBuzzという簡単なコードを例にoptparseとThorにより作成するコマンドライン解析コードの比較を行う.FizzBuzzはThorの使い方を解説した記事\cite{1-2}で紹介されている.比較しやすくするためoptparseでFizzBuzzを新たに実装した.
7
+
8
+ \subsubsection{Thor}
9
+ Thorとは,コマンドラインツールの作成を支援するライブラリのことである.gitやbundlerのようにサブコマンドを含むコマンドラインツールを簡単に作成することができる\cite{1-2}.
10
+
11
+ Thorの基本的な流れとしては
12
+
13
+ \begin{enumerate}
14
+ \item Thorを継承したクラスのメソッドがコマンドになる
15
+ \item クラス.start(ARGV)でコマンドラインの処理をスタートする
16
+ \end{enumerate}
17
+ である\cite{1-2}.
18
+
19
+ startに渡す引数が空の場合,Thorはクラスのヘルプリストを出力する.また,Thorはサブコマンドやサブサブコマンドも容易に作ることができる.
20
+
21
+ 以下に示したコードがThorで記述されたfizzbuzzである.
22
+ \begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
23
+ module Fizzbuzz
24
+ class CLI < Thor
25
+
26
+ desc 'fizzbuzz', 'Get fizzbuzz result from limit number'
27
+ def fizzbuzz(limit)
28
+ print Fizzbuzz.fizzbuzz(limit).join(',')
29
+ exit
30
+ end
31
+
32
+ desc 'version', 'version'
33
+ def version
34
+ puts Fizzbuzz::VERSION
35
+ end
36
+ end
37
+ end
38
+ \end{lstlisting}
39
+ このコードもoptparseのfizzbuzzと同様fizzbuzzとversionのコマンドを実行させる.
40
+
41
+ \paragraph{fizzbuzzメソッド,versionメソッド}
42
+ descでコマンド一覧で表示させるコマンド名と説明を書く.メソッド内ではそれぞれのコマンドの処理内容が書かれている.
43
+
44
+ \subsubsection{optparse}
45
+ optparseとは,getoptよりも簡便で,柔軟性に富み,かつ強力なコマンドライン解析ライブラリである.optparseでは,より宣言的なスタイルのコマンドライン解析手法,すなわちOptionParserのインスタンスでコマンドラインを解析するという手法をとっている.これを使うと,GNU/POSIX構文でオプションを指定できるだけでなく,使用法やヘルプメッセージの生成も行える\cite{1-3}.利用頻度はあまり高くないが古くから開発され,使用例が広く紹介されている.
46
+
47
+ optparseの基本的な流れとしては
48
+
49
+ \begin{enumerate}
50
+ \item OptionParserオブジェクトoptを生成する
51
+ \item オプションを取り扱うブロックをopt.onに登録する
52
+ \item opt.parse(ARGV)でコマンドラインを実際にparseする
53
+ \end{enumerate}
54
+ である.
55
+
56
+ OptionParserはコマンドラインのオプション取り扱うためのクラスであるためオブジェクトoptを生成されopt.onにコマンドを登録することができる.しかし,OptionParser\#onにはコマンドが登録されているだけであるため,OptionParser\#parseが呼ばれた時,コマンドラインにオプションが指定されていれば実行される.optparseにはデフォルトとして--helpと--versionオプションを認識する\cite{1-4}.
57
+
58
+ 以下に示したコードがoptparseで記述したfizzbuzzである.
59
+ \begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
60
+ module Fizzbuzz
61
+ class Command
62
+
63
+ def self.run(argv)
64
+ new(argv).execute
65
+ end
66
+
67
+ def initialize(argv)
68
+ @argv = argv
69
+ end
70
+
71
+ def execute
72
+ options = Options.parse!(@argv)
73
+ sub_command = options.delete(:command)
74
+ case sub_command
75
+ when 'fizzbuzz'
76
+ fizzbuzz(options[:id])
77
+ when 'version'
78
+ version
79
+ end
80
+ end
81
+
82
+ def fizzbuzz(limit_number)
83
+ (0..limit_number).map do |num|
84
+ if (num % 15).zero? then print 'FizzBuzz'
85
+ elsif (num % 5).zero? then print 'Buzz'
86
+ elsif (num % 3).zero? then print 'Fizz'
87
+ else print num.to_s
88
+ end
89
+ print ' '
90
+ end
91
+ end
92
+
93
+ def version
94
+ puts Fizzbuzz::VERSION
95
+ exit
96
+ end
97
+ end
98
+ end
99
+ \end{lstlisting}
100
+ このコードはfizzbuzzとversionをコマンドとして実行できる.
101
+
102
+ \paragraph{runメソッド}
103
+ コマンド実行を行うためのメソッドであり,argv配列を代入することでexecuteメソッドを実行する.
104
+
105
+ \paragraph{initializeメソッド}
106
+ 初期化を行うメソッドである.
107
+ \begin{quote}\begin{verbatim}
108
+ @argv = argv
109
+ \end{verbatim}\end{quote}
110
+ こうすることでargvをクラス内で利用できるようにする.
111
+
112
+ \paragraph{executeメソッド}
113
+ 上記でoptparseではopt.onにコマンドを登録する必要があると説明したが,opt.onで登録できるものはハイフンがついたコマンドだけであり,ハイフンなしのコマンドの登録はこのようになる.
114
+
115
+ argv配列の解析を行うOptions.parse!(@argv)をoptionsに代入して解析を行いsub\_commandに代入する.sub\_commandがfizzbuzzであればfizzbuzz(options[:id])メソッドを実行,versionであればversionメソッドを実行する.
116
+
117
+ \paragraph{fizzbuzzメソッド}
118
+ 引数としてlimit\_numberを受け取り,0〜limit\_numberまでの数字を繰り返す.numが15であればFizzbuzzを表示,5であればBuzzを表示,3であればFizzを表示,それ以外は数字を表示し,その後に空白を表示する.
119
+
120
+ \paragraph{versionメソッド}
121
+ fizzbuzzのバージョンを表示する.
122
+
123
+ \subsection{既存のhikiutilsのコマンド解説}
124
+ 既存のhikiutilsはコマンド解析ライブラリのoptparseを用いて,コマンドの処理を行っている.
125
+ optparseの特徴は,「コマンドの登録,実行method」に分けて記述することが期待されている.
126
+ また,CLIの起動の仕方が特徴的である.この二つを取り出して,動作とコードを説明する.
127
+
128
+ \subsubsection{コマンドの登録と実行メソッド}
129
+ \begin{figure}[htbp]\begin{center}
130
+ \includegraphics[width=10cm,bb= 0 0 737 553]{../figs/./hikiutils_yamane.005.jpg}
131
+ \caption{コマンドの登録と実行メソッドの対応.}
132
+ \label{fig:005}
133
+ \label{default}\end{center}\end{figure}
134
+ optparseでは以下の通り,コマンドの登録と実行が行われる.
135
+
136
+ \begin{enumerate}
137
+ \item OptionParserオブジェクトoptを生成
138
+ \item optにコマンドを登録
139
+ \item 入力されたコマンドの処理のメソッドへ移動
140
+ \end{enumerate}
141
+ optparseではOptionParserオブジェクトoptの生成を行い,コマンドをoptに登録することでコマンドを作成することができる.しかし,これはコマンドを登録しているだけでコマンドの一覧ではこれを表示することができるが,コマンドの実行を行うためには実行を行うためのメソッドを作成する必要がある.optparseでのコマンドの実行はoptで登録されたコマンドが入力されることでそれぞれのコマンドの処理を行うメソッドに移動し処理を行う.しかし,このコマンド登録はハイフンを付けたコマンドしか登録ができず,ハイフンなしのコマンド登録はまた別の手段でやらなくてはいけない.
142
+ \begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
143
+ def execute
144
+ @argv << '--help' if @argv.size==0
145
+ command_parser = OptionParser.new do |opt|
146
+ opt.on('-v', '--version','show program Version.') { |v|
147
+ opt.version = HikiUtils::VERSION
148
+ puts opt.ver
149
+ }
150
+ opt.on('-s', '--show','show sources') {show_sources}
151
+ opt.on('-a', '--add','add sources info') {add_sources }
152
+ opt.on('-t', '--target VAL','set target id') {|val| set_target(val)}
153
+ opt.on('-e', '--edit FILE','open file') {|file| edit_file(file) }
154
+
155
+ ...省略...
156
+
157
+ end
158
+ begin
159
+ command_parser.parse!(@argv)
160
+ rescue=> eval
161
+ p eval
162
+ end
163
+ dump_sources
164
+ exit
165
+ end
166
+
167
+ def show_sources()
168
+ printf("target_no:%i\n",@src[:target])
169
+ printf("editor_command:%s\n",@src[:editor_command])
170
+
171
+ ...省略...
172
+
173
+ end
174
+
175
+ 以下略
176
+
177
+ \end{lstlisting}
178
+ \subsubsection{CLIの実行プロセス}
179
+ \begin{figure}[htbp]\begin{center}
180
+ \includegraphics[width=10cm,bb= 0 0 737 553]{../figs/./hikiutils_yamane.007.jpg}
181
+ \caption{CLIの実行プロセス.}
182
+ \label{fig:007}
183
+ \label{default}\end{center}\end{figure}
184
+ optparseを用いた場合のCLIの実行プロセスは次の通りとなる.
185
+
186
+ \begin{enumerate}
187
+ \item HikiのHikiUtils::Command.run(ARGV)でhikiutils.rbのrunメソッドを呼ぶ
188
+ \item new(argv).executeでexecuteメソッドが実行される
189
+ \end{enumerate}
190
+ optparseではHikiutils::Command.run(ARGV)で実行され,requireで呼び出されたhikiutils.rbのrunメソッドが実行される.そこでコマンドを登録しているexecuteメソッドへ移動し入力したコマンドと対応させる.そして,対応したコマンドの処理が行われるメソッドに移動することで実行される.このようにoptparseでは実行を行うためのメソッドが必要である.
191
+
192
+ \subsubsection{コード}
193
+ optparseの呼び出し側のexe/hikiのコードは次の通りである.
194
+ \begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
195
+ #!/usr/bin/env ruby
196
+
197
+ require "hikiutils"
198
+
199
+ HikiUtils::Command.run(ARGV)
200
+ \end{lstlisting}
201
+ 「require "hikituils"」ではlib/hikiutils.rbを読み出してくることを期待している.
202
+ これはgemspecファイルでlibへのロードパスの記述がされているため,hikiutils.rbを参照することができる.
203
+ 「Hikiuils::Command.run(ARGV)」ではlib/hikiutils.rbのHikiUtilsモジュールCommandクラスのrunメソッドを実行する記述が成されている.
204
+
205
+ また呼び出される側のlib/hikiutils.rbのrunおよびexecute部のコードは次の通りとなる.
206
+ \begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
207
+ def self.run(argv=[])
208
+ print "hikiutils: provide utilities for helping hiki editing.\n"
209
+ new(argv).execute
210
+ end
211
+
212
+ def execute
213
+ @argv << '--help' if @argv.size==0
214
+ command_parser = OptionParser.new do |opt|
215
+ opt.on('-v', '--version','show program Version.') { |v|
216
+ opt.version = HikiUtils::VERSION
217
+ puts opt.ver
218
+ }
219
+ opt.on('-s', '--show','show sources') {show_sources}
220
+ opt.on('-a', '--add','add sources info') {add_sources }
221
+ opt.on('-t', '--target VAL','set target id') {|val| set_target(val) }
222
+ opt.on('-e', '--edit FILE','open file') {|file| edit_file(file) }
223
+ opt.on('-l', '--list [FILE]','list files') {|file| list_files(file) }
224
+ opt.on('-u', '--update FILE','update file') {|file| update_file(file) }
225
+ opt.on('-r', '--rsync','rsync files') {rsync_files}
226
+ opt.on('--database FILE','read database file') {|file| db_file(file)}
227
+ opt.on('--display FILE','display converted hikifile') {|file| display(f\
228
+ ile)}
229
+ opt.on('-c', '--checkdb','check database file') {check_db}
230
+ opt.on('--remove FILE','remove file') {|file| remove_file(file)}
231
+ opt.on('--move FILES','move file1,file2',Array) {|files| move_file(file\
232
+ s)}
233
+ opt.on('--euc FILE','translate file to euc') {|file| euc_file(file) }
234
+ opt.on('--initialize','initialize source directory') {dir_init() }
235
+ end
236
+ begin
237
+ command_parser.parse!(@argv)
238
+ rescue=> eval
239
+ p eval
240
+ end
241
+ dump_sources
242
+ exit
243
+ end
244
+ \end{lstlisting}
245
+ runメソッドでは「hikiutils: provide utilities for helping hiki editing.」を表示させ,executeメソッドを実行させる.
246
+ executeメソッドでは最初に「@argv \<\< '--help' if @argv.size==0」と記述する.これはもしargv配列の中身が空であればargv配列に'--help'を代入する.「command\_parser = OptionParser.new do |opt|」ではOptionParserオブジェクトがoptを生成しコマンドを登録していき,command\_parserに代入する.そして,「command\_parser.parse!(@argv)」では@argvにある文字列をcommand\_parserでparseする.つまり,ここでは入力されたコマンドを解析し,登録されたコマンドと一致すればその処理が行われる.もし,一致しなければevalメソッドで表示する.
247
+
@@ -0,0 +1,49 @@
1
+ \relax
2
+ \@writefile{toc}{\contentsline {section}{\numberline {4}結果}{15}}
3
+ \@writefile{toc}{\contentsline {subsection}{\numberline {4.1}コマンドの命名原則}{15}}
4
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {4.1.1}hikiutilsの想定利用形態}{15}}
5
+ \@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces hikiutilsがあらかじめ想定している利用形態.}}{15}}
6
+ \newlabel{fig:002}{{4}{15}}
7
+ \newlabel{default}{{4}{15}}
8
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {4.1.2}コメンド名と振る舞いの詳細}{16}}
9
+ \@writefile{lot}{\contentsline {table}{\numberline {1}{\ignorespaces コマンドオプションとshellコマンドの対応.}}{17}}
10
+ \newlabel{table:ShellOption}{{1}{17}}
11
+ \newlabel{default}{{1}{17}}
12
+ \@writefile{toc}{\contentsline {paragraph}{open FILE}{17}}
13
+ \@writefile{toc}{\contentsline {paragraph}{ls [FILE]}{17}}
14
+ \@writefile{toc}{\contentsline {paragraph}{rsync}{17}}
15
+ \@writefile{toc}{\contentsline {paragraph}{touch FILE}{18}}
16
+ \@writefile{toc}{\contentsline {paragraph}{pwd}{18}}
17
+ \@writefile{toc}{\contentsline {paragraph}{cd VAL}{18}}
18
+ \@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Thorによる実装}{18}}
19
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.1}クラス初期化}{18}}
20
+ \@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Thorのinitializeでのコード}}{19}}
21
+ \newlabel{default}{{5}{19}}
22
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.2}コマンド定義}{19}}
23
+ \@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces Thorにおけるコマンド記述のひな形.}}{20}}
24
+ \newlabel{fig:004}{{6}{20}}
25
+ \newlabel{default}{{6}{20}}
26
+ \@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.3}CLIの実行プロセス}{21}}
27
+ \@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces CLIの実行プロセス.}}{21}}
28
+ \newlabel{fig:006}{{7}{21}}
29
+ \newlabel{default}{{7}{21}}
30
+ \@setckpt{results}{
31
+ \setcounter{page}{23}
32
+ \setcounter{equation}{0}
33
+ \setcounter{enumi}{2}
34
+ \setcounter{enumii}{0}
35
+ \setcounter{enumiii}{0}
36
+ \setcounter{enumiv}{0}
37
+ \setcounter{footnote}{0}
38
+ \setcounter{mpfootnote}{0}
39
+ \setcounter{part}{0}
40
+ \setcounter{section}{4}
41
+ \setcounter{subsection}{2}
42
+ \setcounter{subsubsection}{3}
43
+ \setcounter{paragraph}{0}
44
+ \setcounter{subparagraph}{0}
45
+ \setcounter{figure}{7}
46
+ \setcounter{table}{1}
47
+ \setcounter{lstnumber}{14}
48
+ \setcounter{lstlisting}{0}
49
+ }