hikiutils 0.2.3.12 → 0.2.3.13
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.
- checksums.yaml +4 -4
- data/hikiutils_bob/Rakefile +3 -2
- data/hikiutils_yamane/Rakefile +148 -30
- data/hikiutils_yamane/Rakefile~ +477 -0
- data/hikiutils_yamane/command.hiki +13 -13
- data/hikiutils_yamane/compare.hiki +96 -5
- data/hikiutils_yamane/figs/hikiutils_yamane.001.jpg +0 -0
- data/hikiutils_yamane/figs/hikiutils_yamane.002.jpg +0 -0
- data/hikiutils_yamane/figs/hikiutils_yamane.003.jpg +0 -0
- data/hikiutils_yamane/figs/hikiutils_yamane.004.jpg +0 -0
- data/hikiutils_yamane/figs/hikiutils_yamane.005.jpg +0 -0
- data/hikiutils_yamane/figs/hikiutils_yamane.006.jpg +0 -0
- data/hikiutils_yamane/figs/hikiutils_yamane.007.jpg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.001.jpeg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.002.jpeg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.003.jpeg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.004.jpeg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.005.jpeg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.006.jpeg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.007.jpeg +0 -0
- data/hikiutils_yamane/hikiutils_yamane.hiki +6 -10
- data/hikiutils_yamane/introduction.hiki +5 -5
- data/hikiutils_yamane/latex_dir/%CA%FD/313/241.aux +21 -0
- data/hikiutils_yamane/latex_dir/abstract.aux +2 -2
- data/hikiutils_yamane/latex_dir/command.aux +15 -14
- data/hikiutils_yamane/latex_dir/command.log +0 -0
- data/hikiutils_yamane/latex_dir/command.tex +15 -14
- data/hikiutils_yamane/latex_dir/compare.aux +11 -5
- data/hikiutils_yamane/latex_dir/compare.tex +97 -5
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.aux +6 -3
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.log +113 -162
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.pdf +0 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.synctex.gz +0 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.tex +15 -18
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.toc +31 -26
- data/hikiutils_yamane/latex_dir/introduction.aux +6 -4
- data/hikiutils_yamane/latex_dir/introduction.tex +5 -4
- data/hikiutils_yamane/latex_dir/jlisting.sty +216 -0
- data/hikiutils_yamane/latex_dir/optparse.aux +11 -9
- data/hikiutils_yamane/latex_dir/optparse.tex +11 -8
- data/hikiutils_yamane/latex_dir/pre.tex +36 -0
- data/hikiutils_yamane/latex_dir/thor.aux +13 -13
- data/hikiutils_yamane/latex_dir/thor.tex +9 -11
- data/hikiutils_yamane/optparse.hiki +7 -6
- data/hikiutils_yamane/test.rb +10 -0
- data/hikiutils_yamane/thor.hiki +4 -5
- data/lib/hikiutils/version.rb +1 -1
- data/lib/hikiutils_thor.rb +39 -39
- data/lib/hikiutils_thor.rb~ +3 -4
- data/lib/templates/Rakefile_hiki_sync +3 -2
- metadata +15 -9
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.001.jpg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.002.jpg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.003.jpg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.004.jpg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.005.jpg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.006.jpg +0 -0
- data/hikiutils_yamane/hikiutils_yamane/hikiutils_yamane.007.jpg +0 -0
@@ -0,0 +1,216 @@
|
|
1
|
+
\NeedsTeXFormat{LaTeX2e}
|
2
|
+
\def\filedate{2006/02/20}
|
3
|
+
\def\fileversion{0.2}
|
4
|
+
\ProvidesPackage{jlisting}[\filedate\space\fileversion\space(Thor)]
|
5
|
+
%
|
6
|
+
\newcount\lst@nextchar
|
7
|
+
\let\lst@@ProcessSpace\lst@ProcessSpace
|
8
|
+
\def\lst@ProcessSpace#1{%
|
9
|
+
\lst@check@chartype{#1}%
|
10
|
+
\lst@@ProcessSpace
|
11
|
+
\lst@whitespacetrue}
|
12
|
+
\let\lst@@ProcessLetter\lst@ProcessLetter
|
13
|
+
\def\lst@ProcessLetter#1#2{%
|
14
|
+
\lst@check@chartype{#2}%
|
15
|
+
{\lst@@ProcessLetter{#1}}%
|
16
|
+
\relax}
|
17
|
+
\let\lst@@ProcessDigit\lst@ProcessDigit
|
18
|
+
\def\lst@ProcessDigit#1#2{%
|
19
|
+
\lst@check@chartype{#2}%
|
20
|
+
{\lst@@ProcessDigit{#1}}%
|
21
|
+
\relax}
|
22
|
+
\let\lst@@ProcessOther\lst@ProcessOther
|
23
|
+
\def\lst@ProcessOther#1#2{%
|
24
|
+
\lst@check@chartype{#2}%
|
25
|
+
{\lst@@ProcessOther{#1}}%
|
26
|
+
\relax}
|
27
|
+
\let\lst@@ProcessTabulator\lst@ProcessTabulator
|
28
|
+
\def\lst@ProcessTabulator#1{%
|
29
|
+
\lst@check@chartype{#1}%
|
30
|
+
\lst@@ProcessTabulator
|
31
|
+
\relax}
|
32
|
+
\def\lst@check@chartype#1#2#3{%
|
33
|
+
\edef\@tempa{\lst@nextchar=`\string#1\relax}%
|
34
|
+
\afterassignment\remove@to@nnil
|
35
|
+
\@tempa\@nnil
|
36
|
+
#2%
|
37
|
+
\ifnum\lst@nextchar<\@cclvi
|
38
|
+
#3%
|
39
|
+
\else
|
40
|
+
\lst@ifletter \else \lst@OutputOther \fi
|
41
|
+
\lst@whitespacefalse
|
42
|
+
\expandafter\lst@AppendJchar
|
43
|
+
\fi
|
44
|
+
#1}
|
45
|
+
\def\lst@AppendJchar#1#2{%
|
46
|
+
\lst@check@chartype{#2}%
|
47
|
+
{\advance\lst@length\@ne\lst@Append{#1}}%
|
48
|
+
\relax}
|
49
|
+
\def\lst@check@chartype@BOL#1{%
|
50
|
+
\edef\@tempa{\lst@nextchar=`\string#1\relax}%
|
51
|
+
\afterassignment\remove@to@nnil
|
52
|
+
\@tempa\@nnil
|
53
|
+
\ifnum\lst@nextchar<\@cclvi\else
|
54
|
+
\lst@whitespacefalse
|
55
|
+
\expandafter\lst@AppendJchar
|
56
|
+
\fi
|
57
|
+
#1}
|
58
|
+
\def\lst@InputListing#1{%
|
59
|
+
\begingroup
|
60
|
+
\lsthk@PreSet \gdef\lst@intname{#1}%
|
61
|
+
\expandafter\lstset\expandafter{\lst@set}%
|
62
|
+
\lsthk@DisplayStyle
|
63
|
+
\catcode\active=\active
|
64
|
+
\lst@Init\relax \let\lst@gobble\z@
|
65
|
+
\lst@SkipToFirst
|
66
|
+
\lst@ifprint \def\lst@next{\lst@get@filecontents{#1}}%
|
67
|
+
\else \let\lst@next\@empty
|
68
|
+
\fi
|
69
|
+
\lst@next
|
70
|
+
\lst@DeInit
|
71
|
+
\endgroup}
|
72
|
+
\newread\lst@inputfile
|
73
|
+
\def\lst@get@filecontents#1{%
|
74
|
+
\let\lst@filecontents\@empty
|
75
|
+
\openin\lst@inputfile=#1\relax
|
76
|
+
\let\@lst@get@filecontents@prevline\relax
|
77
|
+
\lst@get@filecontents@loop
|
78
|
+
\closein\lst@inputfile
|
79
|
+
\lst@filecontents\empty}
|
80
|
+
\def\lst@get@filecontents@loop{%
|
81
|
+
\read\lst@inputfile to\@lst@get@filecontents@currline
|
82
|
+
\ifx\@lst@get@filecontents@prevline\relax\else
|
83
|
+
\expandafter\expandafter\expandafter\def
|
84
|
+
\expandafter\expandafter\expandafter\lst@filecontents
|
85
|
+
\expandafter\expandafter\expandafter{%
|
86
|
+
\expandafter\lst@filecontents\@lst@get@filecontents@prevline}%
|
87
|
+
\fi
|
88
|
+
\let\@lst@get@filecontents@prevline\@lst@get@filecontents@currline
|
89
|
+
\ifeof\lst@inputfile\else
|
90
|
+
\expandafter\lst@get@filecontents@loop
|
91
|
+
\fi}
|
92
|
+
%%% [$B$3$N=hM}$b!$AjEv6/0z$G$9!%(B]
|
93
|
+
\def\lst@BOLGobble{%
|
94
|
+
\ifnum\lst@gobble>\z@
|
95
|
+
\@tempcnta\lst@gobble\relax
|
96
|
+
\expandafter\lst@BOLGobble@
|
97
|
+
\else
|
98
|
+
\expandafter\lst@check@chartype@BOL
|
99
|
+
\fi}
|
100
|
+
\def\lst@BOLGobble@#1{%
|
101
|
+
\let\lst@next#1%
|
102
|
+
\ifx \lst@next\relax\else
|
103
|
+
\ifx \lst@next\lst@MProcessListing\else
|
104
|
+
\ifx \lst@next\lst@ProcessFormFeed\else
|
105
|
+
\ifx \lst@next\lstenv@backslash
|
106
|
+
\let\lst@next\lstenv@BOLGobble@@
|
107
|
+
\else
|
108
|
+
\let\lst@next\lst@BOLGobble@@
|
109
|
+
\ifx #1\lst@ProcessTabulator
|
110
|
+
\advance\@tempcnta-\lst@tabsize\relax
|
111
|
+
\ifnum\@tempcnta<\z@
|
112
|
+
\lst@length-\@tempcnta \lst@PreGotoTabStop
|
113
|
+
\fi
|
114
|
+
\else
|
115
|
+
\edef\@tempa{\lst@nextchar=`\string#1\relax}%
|
116
|
+
\@tempa
|
117
|
+
\ifnum\lst@nextchar<\@cclvi\else
|
118
|
+
\advance\@tempcnta\m@ne
|
119
|
+
\fi
|
120
|
+
\advance\@tempcnta\m@ne
|
121
|
+
\fi
|
122
|
+
\fi \fi \fi \fi
|
123
|
+
\lst@next}
|
124
|
+
\def\lst@BOLGobble@@{%
|
125
|
+
\ifnum\@tempcnta>\z@
|
126
|
+
\expandafter\lst@BOLGobble@
|
127
|
+
\else
|
128
|
+
\expandafter\lst@check@chartype@BOL
|
129
|
+
\fi
|
130
|
+
}
|
131
|
+
%
|
132
|
+
% \begin{$B=$@5;v9`(B}{1.3}
|
133
|
+
% $B$A$g$C$H$7$?=$@5(B
|
134
|
+
\gdef\lst@breakProcessOther#1{\lst@ProcessOther#1}
|
135
|
+
% $B%=!<%9%3!<%IL\<!$K$*$1$kJ8;z$HHV9f$N6u$-(B
|
136
|
+
\let \l@lstlisting = \l@figure
|
137
|
+
% $B%-%c%W%7%g%s$H%=!<%9%3!<%IL\<!$KBP$9$kF|K\8lBP1~(B
|
138
|
+
\def\lstlistingname{$B%=!<%9%3!<%I(B}
|
139
|
+
\def\lstlistlistingname{$B%=!<%9%3!<%IL\<!(B}
|
140
|
+
% \end{$B=$@5;v9`(B}
|
141
|
+
\endinput
|
142
|
+
%
|
143
|
+
%#!platex
|
144
|
+
\documentclass[papersize]{jsarticle}
|
145
|
+
% Macros
|
146
|
+
\IfFileExists{dvipdfmx.def}{%
|
147
|
+
\usepackage[dvipdfmx]{color,graphicx}%
|
148
|
+
}{%
|
149
|
+
\usepackage[dvipdfm]{color,graphicx}%
|
150
|
+
}
|
151
|
+
\usepackage{listings}[2004/09/07]
|
152
|
+
\usepackage{jlisting}[2006/02/20]
|
153
|
+
\usepackage{url}
|
154
|
+
\usepackage{verbatim}
|
155
|
+
|
156
|
+
\makeatletter
|
157
|
+
% Original Macros
|
158
|
+
\def\email#1{\gdef\@email{\texttt{#1}}}
|
159
|
+
\def\homepage#1{\gdef\@homepage{\texttt{#1}}}
|
160
|
+
\def\mac#1{\textsf{#1}}
|
161
|
+
\def\URL#1{\texttt{#1}}
|
162
|
+
\def\src#1{\texttt{#1}}
|
163
|
+
|
164
|
+
% Dvipdfmx.def
|
165
|
+
\def\dvipdfmxDefi{http://tex.dante.jp/ok/dvipdfmx/}
|
166
|
+
\def\dvipdfmxDefii{http://ftp.ktug.or.kr/KTUG/dvipdfmx/contrib/latex/}
|
167
|
+
|
168
|
+
\IfFileExists{dvipdfmx.def}{%
|
169
|
+
\let \IfDvipdfmxDef = \empty \relax}{%
|
170
|
+
\typeout{^^Jget dvipdfmx.def at \dvipdfmxDefi^^J
|
171
|
+
or \dvipdfmxDefii^^J}%
|
172
|
+
\def\IfDvipdfmxDef{Get \src{dvipdfmx.def} at \URL \dvipdfmxDefii \\
|
173
|
+
or \URL \dvipdfmxDefi.}%
|
174
|
+
}
|
175
|
+
|
176
|
+
% Author Info
|
177
|
+
\author {Th\'or Watanabe\thanks \@email \space \thanks \@homepage}
|
178
|
+
\title {\mac{jlisting.sty}\\
|
179
|
+
---Japanese Localized Patch File of \mac{listings}---}
|
180
|
+
\email {thor@tex.dante.jp}
|
181
|
+
\homepage {http://tex.dante.jp/typo/}
|
182
|
+
\date {2006/02/20}
|
183
|
+
|
184
|
+
\makeatother
|
185
|
+
|
186
|
+
\begin{document}
|
187
|
+
\maketitle
|
188
|
+
%\IfDvipdfmxDef
|
189
|
+
|
190
|
+
\section{$B$A$g$C$H$7$?@bL@(B}% Short Description
|
191
|
+
|
192
|
+
$B1|B<@2I';a$N7G<(HD$N!VHFMQE*$JIbF0BN!W$H$$$&0lO"$N=q$-9~$_$+$i(B
|
193
|
+
$BE>:\$7$^$7$?!#(B
|
194
|
+
|
195
|
+
\begin{quote}
|
196
|
+
\url{http://http://cise.edu.mie-u.ac.jp/~okumura/texfaq/qa/21172.html}\\
|
197
|
+
\url{http://http://cise.edu.mie-u.ac.jp/~okumura/texfaq/qa/21184.html}\\
|
198
|
+
\url{http://http://cise.edu.mie-u.ac.jp/~okumura/texfaq/qa/21189.html}\\
|
199
|
+
\url{http://http://cise.edu.mie-u.ac.jp/~okumura/texfaq/qa/21197.html}
|
200
|
+
\end{quote}
|
201
|
+
|
202
|
+
Copyright $B$O5H1JE/H~;a$K$"$k$N$@$H;W$$$^$9!%(B
|
203
|
+
|
204
|
+
\section{$B99?7MzNr(B}% ChageLogs
|
205
|
+
|
206
|
+
\begin{description}
|
207
|
+
\item[ver.~0.1 (2004/03/24)]
|
208
|
+
$B$H$j$"$($:8x3+!%(B
|
209
|
+
\item[ver.~0.2 (2006/02/20)]
|
210
|
+
\verb|\lst@breakProcessOther| $BL?Na$NDj5A$NDI2C!%(B
|
211
|
+
\end{description}
|
212
|
+
|
213
|
+
\section{$B%=!<%9%3!<%I(B}
|
214
|
+
\par\narrowbaselines
|
215
|
+
\verbatiminput{jlisting.sty}
|
216
|
+
\end{document}
|
@@ -1,14 +1,16 @@
|
|
1
1
|
\relax
|
2
|
-
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}既存のhikiutilsのコマンド解説}{
|
3
|
-
\@writefile{toc}{\contentsline {subsubsection}{\numberline {3.2.1}コマンドの登録と実行メソッド}{
|
4
|
-
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces
|
5
|
-
\newlabel{
|
6
|
-
|
7
|
-
\@writefile{
|
8
|
-
\
|
9
|
-
|
2
|
+
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}既存のhikiutilsのコマンド解説}{11}}
|
3
|
+
\@writefile{toc}{\contentsline {subsubsection}{\numberline {3.2.1}コマンドの登録と実行メソッド}{11}}
|
4
|
+
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces コマンドの登録と実行メソッドの対応.}}{11}}
|
5
|
+
\newlabel{fig:005}{{2}{11}}
|
6
|
+
\newlabel{default}{{2}{11}}
|
7
|
+
\@writefile{toc}{\contentsline {subsubsection}{\numberline {3.2.2}CLIの実行プロセス}{12}}
|
8
|
+
\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces CLIの実行プロセス.}}{13}}
|
9
|
+
\newlabel{fig:007}{{3}{13}}
|
10
|
+
\newlabel{default}{{3}{13}}
|
11
|
+
\@writefile{toc}{\contentsline {subsubsection}{\numberline {3.2.3}コード}{13}}
|
10
12
|
\@setckpt{optparse}{
|
11
|
-
\setcounter{page}{
|
13
|
+
\setcounter{page}{15}
|
12
14
|
\setcounter{equation}{0}
|
13
15
|
\setcounter{enumi}{2}
|
14
16
|
\setcounter{enumii}{0}
|
@@ -6,8 +6,9 @@ optparseの特徴は,「コマンドの登録,実行method」に分けて記
|
|
6
6
|
|
7
7
|
\subsubsection{コマンドの登録と実行メソッド}
|
8
8
|
\begin{figure}[htbp]\begin{center}
|
9
|
-
\includegraphics[width=
|
10
|
-
\caption{
|
9
|
+
\includegraphics[width=10cm,bb= 0 0 737 553]{../figs/./hikiutils_yamane.005.jpg}
|
10
|
+
\caption{コマンドの登録と実行メソッドの対応.}
|
11
|
+
\label{fig:005}
|
11
12
|
\label{default}\end{center}\end{figure}
|
12
13
|
optparseでは以下の通り,コマンドの登録と実行が行われる.
|
13
14
|
|
@@ -17,7 +18,7 @@ optparseでは以下の通り,コマンドの登録と実行が行われる.
|
|
17
18
|
\item 入力されたコマンドの処理のメソッドへ移動
|
18
19
|
\end{enumerate}
|
19
20
|
optparseではOptionParserオブジェクトoptの生成を行い,コマンドをoptに登録することでコマンドを作成することができる.しかし,これはコマンドを登録しているだけでコマンドの一覧ではこれを表示することができるが,コマンドの実行を行うためには実行を行うためのメソッドを作成する必要がある.optparseでのコマンドの実行はoptで登録されたコマンドが入力されることでそれぞれのコマンドの処理を行うメソッドに移動し処理を行う.しかし,このコマンド登録はハイフンを付けたコマンドしか登録ができず,ハイフンなしのコマンド登録はまた別の手段でやらなくてはいけない.
|
20
|
-
\begin{lstlisting}[style=customRuby]
|
21
|
+
\begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
|
21
22
|
def execute
|
22
23
|
@argv << '--help' if @argv.size==0
|
23
24
|
command_parser = OptionParser.new do |opt|
|
@@ -55,8 +56,9 @@ optparseではOptionParserオブジェクトoptの生成を行い,コマンド
|
|
55
56
|
\end{lstlisting}
|
56
57
|
\subsubsection{CLIの実行プロセス}
|
57
58
|
\begin{figure}[htbp]\begin{center}
|
58
|
-
\includegraphics[width=
|
59
|
+
\includegraphics[width=10cm,bb= 0 0 737 553]{../figs/./hikiutils_yamane.007.jpg}
|
59
60
|
\caption{CLIの実行プロセス.}
|
61
|
+
\label{fig:007}
|
60
62
|
\label{default}\end{center}\end{figure}
|
61
63
|
optparseを用いた場合のCLIの実行プロセスは次の通りとなる.
|
62
64
|
|
@@ -67,15 +69,16 @@ optparseを用いた場合のCLIの実行プロセスは次の通りとなる.
|
|
67
69
|
optparseではHikiutils::Command.run(ARGV)を実行される.requireで呼び出されたhikiutils.rbでrunメソッドが実行される.そこでコマンドを登録しているexecuteメソッドへ移動し入力したコマンドと対応させる.そして,対応したコマンドの処理が行われるメソッドに移動することで実行される.このようにoptparseでは実行を行うためのメソッドが必要であるが,
|
68
70
|
|
69
71
|
\subsubsection{コード}
|
70
|
-
|
71
|
-
\
|
72
|
-
\end{itemize}\begin{lstlisting}[style=customRuby]
|
72
|
+
optparseの呼び出し側のexe/hikiのコードは次の通りである.
|
73
|
+
\begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
|
73
74
|
#!/usr/bin/env ruby
|
74
75
|
|
75
76
|
require "hikiutils"
|
76
77
|
|
77
78
|
HikiUtils::Command.run(ARGV)
|
78
|
-
\end{lstlisting}
|
79
|
+
\end{lstlisting}
|
80
|
+
また呼び出される側のlib/hikiutils.rbのrunおよびexecute部のコードは次の通りとなる.
|
81
|
+
\begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
|
79
82
|
def self.run(argv=[])
|
80
83
|
print "hikiutils: provide utilities for helping hiki editing.\n"
|
81
84
|
new(argv).execute
|
@@ -0,0 +1,36 @@
|
|
1
|
+
\documentclass[10pt,a4j]{article}
|
2
|
+
|
3
|
+
\def\Vec#1{\mbox{\boldmath $#1$}}
|
4
|
+
\usepackage[dvipdfmx]{graphicx}
|
5
|
+
|
6
|
+
\setlength{\textheight}{275mm}
|
7
|
+
\headheight 5mm
|
8
|
+
\topmargin -20mm
|
9
|
+
\textwidth 160mm
|
10
|
+
\textheight 250mm
|
11
|
+
\oddsidemargin -0mm
|
12
|
+
\evensidemargin -5mm
|
13
|
+
|
14
|
+
\pagestyle{empty}
|
15
|
+
\makeatletter
|
16
|
+
\def\@maketitle{%
|
17
|
+
\newpage\null
|
18
|
+
\vskip 2em%
|
19
|
+
\begin{center}%
|
20
|
+
\let\footnote\thanks
|
21
|
+
{\large\bf \@title \par}%
|
22
|
+
\vskip 1.5em%
|
23
|
+
{\large\bf \@author \par}%
|
24
|
+
\vskip 1.5em%
|
25
|
+
{\small \@date}%
|
26
|
+
\end{center}%
|
27
|
+
}
|
28
|
+
\makeatother
|
29
|
+
|
30
|
+
%\documentclass[10pt, a4j]{article}
|
31
|
+
%%\usepackage{citesort}
|
32
|
+
\usepackage{amssymb}
|
33
|
+
\usepackage[dvipdfmx]{graphicx}% 図を入れるときに使用
|
34
|
+
\usepackage{wrapfig}% 図の周りに本文を流し込みたいときに使用
|
35
|
+
\usepackage{subfigure}
|
36
|
+
\usepackage{here}
|
@@ -1,17 +1,17 @@
|
|
1
1
|
\relax
|
2
|
-
\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Thorによる実装}{
|
3
|
-
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.1}クラス初期化}{
|
4
|
-
\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Thorのinitializeでのコード}}{
|
5
|
-
\newlabel{default}{{5}{
|
6
|
-
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.2}コマンド定義}{
|
7
|
-
\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces thorにおけるコマンド記述のひな形.}}{
|
8
|
-
\newlabel{default}{{6}{
|
9
|
-
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.3}CLIの実行プロセス}{
|
10
|
-
\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces CLIの実行プロセス.}}{
|
11
|
-
\newlabel{default}{{7}{
|
12
|
-
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.4}optparseとの全体的な比較}{
|
2
|
+
\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Thorによる実装}{20}}
|
3
|
+
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.1}クラス初期化}{20}}
|
4
|
+
\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Thorのinitializeでのコード}}{20}}
|
5
|
+
\newlabel{default}{{5}{20}}
|
6
|
+
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.2}コマンド定義}{21}}
|
7
|
+
\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces thorにおけるコマンド記述のひな形.}}{22}}
|
8
|
+
\newlabel{default}{{6}{22}}
|
9
|
+
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.3}CLIの実行プロセス}{22}}
|
10
|
+
\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces CLIの実行プロセス.}}{23}}
|
11
|
+
\newlabel{default}{{7}{23}}
|
12
|
+
\@writefile{toc}{\contentsline {subsubsection}{\numberline {4.2.4}optparseとの全体的な比較}{24}}
|
13
13
|
\@setckpt{thor}{
|
14
|
-
\setcounter{page}{
|
14
|
+
\setcounter{page}{25}
|
15
15
|
\setcounter{equation}{0}
|
16
16
|
\setcounter{enumi}{2}
|
17
17
|
\setcounter{enumii}{0}
|
@@ -27,6 +27,6 @@
|
|
27
27
|
\setcounter{subparagraph}{0}
|
28
28
|
\setcounter{figure}{7}
|
29
29
|
\setcounter{table}{1}
|
30
|
-
\setcounter{lstnumber}{
|
30
|
+
\setcounter{lstnumber}{14}
|
31
31
|
\setcounter{lstlisting}{0}
|
32
32
|
}
|
@@ -8,11 +8,9 @@
|
|
8
8
|
\end{itemize}
|
9
9
|
について詳しく検討を行う.
|
10
10
|
|
11
|
-
\subsubsection{クラス初期化}
|
12
|
-
|
13
|
-
\end{verbatim}\end{quote}
|
11
|
+
\subsubsection{クラス初期化}
|
14
12
|
\begin{figure}[htbp]\begin{center}
|
15
|
-
\includegraphics[width=
|
13
|
+
\includegraphics[width=10cm,bb= 0 0 737 553]{../figs/./hikiutils_yamane.003.jpg}
|
16
14
|
\caption{Thorのinitializeでのコード}
|
17
15
|
\label{default}\end{center}\end{figure}
|
18
16
|
Thorのinitializeでのコードはつぎの通りである.
|
@@ -24,7 +22,7 @@ Thorのinitializeでのコードはつぎの通りである.
|
|
24
22
|
\item superを書くことでThorのinitializeメソッドが呼ばれる
|
25
23
|
\end{enumerate}
|
26
24
|
optparseではrequireでoptparseを呼びoptparseのinitializeを定義する必要はないが,Thorはinitializeを定義する必要がある.Thorの定義方法はrequireでThorを呼びCLIクラスで継承し,initializeメソッドにsuperを書くことでThorのinitializeが呼ばれる.initializeメソッド内ではThorの初期設定がされていないため,スーパークラスのメソッドを読み出してくれるsuperを書き加えることで図のようにinitializeメソッド内でThorのinitilalizeメソッドが呼ばれ定義される.
|
27
|
-
\begin{lstlisting}[style=customRuby]
|
25
|
+
\begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
|
28
26
|
|
29
27
|
module Hikithor
|
30
28
|
|
@@ -43,7 +41,7 @@ module Hikithor
|
|
43
41
|
\end{lstlisting}
|
44
42
|
\subsubsection{コマンド定義}
|
45
43
|
\begin{figure}[htbp]\begin{center}
|
46
|
-
\includegraphics[width=
|
44
|
+
\includegraphics[width=10cm,bb= 0 0 737 553]{../figs/./hikiutils_yamane.004.jpg}
|
47
45
|
\caption{thorにおけるコマンド記述のひな形.}
|
48
46
|
\label{default}\end{center}\end{figure}
|
49
47
|
thorではoptparseのような登録処理はない.図にある通りにコマンドが記述され,それらは以下のように構成される.
|
@@ -61,7 +59,7 @@ map A => B
|
|
61
59
|
\end{verbatim}\end{quote}
|
62
60
|
mapとはBと呼ばれるメソッドをAでも呼べるようにしてくれるものである.
|
63
61
|
よって,これを使うことでコマンドの別名を指定することができる.
|
64
|
-
\begin{lstlisting}[style=customRuby]
|
62
|
+
\begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
|
65
63
|
desc 'show,--show', 'show sources'
|
66
64
|
map "--show" => "show"
|
67
65
|
def show
|
@@ -74,7 +72,7 @@ mapとはBと呼ばれるメソッドをAでも呼べるようにしてくれる
|
|
74
72
|
|
75
73
|
\subsubsection{CLIの実行プロセス}
|
76
74
|
\begin{figure}[htbp]\begin{center}
|
77
|
-
\includegraphics[width=
|
75
|
+
\includegraphics[width=10cm,bb= 0 0 737 553]{../figs/./hikiutils_yamane.006.jpg}
|
78
76
|
\caption{CLIの実行プロセス.}
|
79
77
|
\label{default}\end{center}\end{figure}
|
80
78
|
Thorにおけるcliの実行プロセスは次の通りである.
|
@@ -84,13 +82,13 @@ Thorにおけるcliの実行プロセスは次の通りである.
|
|
84
82
|
\item hikiutils\_thor.rbのCLIクラスのメソッドを順に実行していく
|
85
83
|
\end{enumerate}
|
86
84
|
Thorではstart(ARGV)を呼び出すことでCLIを開始する.Hikithor::CLI.start(ARGV)を実行されることによりrequireで呼ばれているhikiutils\_thor.rbのCLIコマンドを順に実行する.そして,入力されたコマンドと一致するメソッドを探し,そのコマンドの処理が実行される.
|
87
|
-
\begin{lstlisting}[style=customRuby]
|
85
|
+
\begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
|
88
86
|
#!/usr/bin/env ruby
|
89
87
|
|
90
88
|
require "hikiutils_thor"
|
91
89
|
|
92
90
|
Hikithor::CLI.start(ARGV)
|
93
|
-
\end{lstlisting}\begin{
|
91
|
+
\end{lstlisting}\begin{lstlisting}[style=customRuby,basicstyle={\scriptsize\ttfamily}]
|
94
92
|
|
95
93
|
module Hikithor
|
96
94
|
|
@@ -104,7 +102,7 @@ module Hikithor
|
|
104
102
|
data_path = File.join(ENV['HOME'], '.hikirc')
|
105
103
|
DataFiles.prepare(data_path)
|
106
104
|
...以下略...
|
107
|
-
\end{
|
105
|
+
\end{lstlisting}
|
108
106
|
Thorではクラスのメソッドを順に実行していくためrunメソッドとexecuteメソッドは必要ない.また,optparseでの実行手順はメソッドの移動回数が多く複雑であるが,Thorは単純で分かりやすいものとなっている.
|
109
107
|
|
110
108
|
\subsubsection{optparseとの全体的な比較}
|
@@ -6,8 +6,8 @@ optparseの特徴は,「コマンドの登録,実行method」に分けて記
|
|
6
6
|
|
7
7
|
!!コマンドの登録と実行メソッド
|
8
8
|
|
9
|
-
!!!caption
|
10
|
-
{{attach_view(
|
9
|
+
!!!caption:(fig:005)コマンドの登録と実行メソッドの対応.
|
10
|
+
{{attach_view(hikiutils_yamane.005.jpg,hikiutils_yamane)}}
|
11
11
|
|
12
12
|
optparseでは以下の通り,コマンドの登録と実行が行われる.
|
13
13
|
#OptionParserオブジェクトoptを生成
|
@@ -15,7 +15,6 @@ optparseでは以下の通り,コマンドの登録と実行が行われる.
|
|
15
15
|
#入力されたコマンドの処理のメソッドへ移動
|
16
16
|
optparseではOptionParserオブジェクトoptの生成を行い,コマンドをoptに登録することでコマンドを作成することができる.しかし,これはコマンドを登録しているだけでコマンドの一覧ではこれを表示することができるが,コマンドの実行を行うためには実行を行うためのメソッドを作成する必要がある.optparseでのコマンドの実行はoptで登録されたコマンドが入力されることでそれぞれのコマンドの処理を行うメソッドに移動し処理を行う.しかし,このコマンド登録はハイフンを付けたコマンドしか登録ができず,ハイフンなしのコマンド登録はまた別の手段でやらなくてはいけない.
|
17
17
|
|
18
|
-
|
19
18
|
<<< ruby
|
20
19
|
def execute
|
21
20
|
@argv << '--help' if @argv.size==0
|
@@ -54,8 +53,8 @@ optparseではOptionParserオブジェクトoptの生成を行い,コマンド
|
|
54
53
|
>>>
|
55
54
|
|
56
55
|
!!CLIの実行プロセス
|
57
|
-
!!!caption:CLIの実行プロセス.
|
58
|
-
{{attach_view(
|
56
|
+
!!!caption:(fig:007)CLIの実行プロセス.
|
57
|
+
{{attach_view(hikiutils_yamane.007.jpg,hikiutils_yamane)}}
|
59
58
|
|
60
59
|
optparseを用いた場合のCLIの実行プロセスは次の通りとなる.
|
61
60
|
#HikiのHikiUtils::Command.run(ARGV)でhikiutils.rbのrunメソッドを呼ぶ
|
@@ -64,7 +63,7 @@ optparseを用いた場合のCLIの実行プロセスは次の通りとなる.
|
|
64
63
|
optparseではHikiutils::Command.run(ARGV)を実行される.requireで呼び出されたhikiutils.rbでrunメソッドが実行される.そこでコマンドを登録しているexecuteメソッドへ移動し入力したコマンドと対応させる.そして,対応したコマンドの処理が行われるメソッドに移動することで実行される.このようにoptparseでは実行を行うためのメソッドが必要であるが,
|
65
64
|
!!コード
|
66
65
|
|
67
|
-
|
66
|
+
optparseの呼び出し側のexe/hikiのコードは次の通りである.
|
68
67
|
<<< ruby
|
69
68
|
#!/usr/bin/env ruby
|
70
69
|
|
@@ -72,6 +71,8 @@ require "hikiutils"
|
|
72
71
|
|
73
72
|
HikiUtils::Command.run(ARGV)
|
74
73
|
>>>
|
74
|
+
|
75
|
+
また呼び出される側のlib/hikiutils.rbのrunおよびexecute部のコードは次の通りとなる.
|
75
76
|
<<< ruby
|
76
77
|
def self.run(argv=[])
|
77
78
|
print "hikiutils: provide utilities for helping hiki editing.\n"
|
data/hikiutils_yamane/thor.hiki
CHANGED
@@ -6,9 +6,8 @@
|
|
6
6
|
について詳しく検討を行う.
|
7
7
|
|
8
8
|
!!クラス初期化
|
9
|
-
|
10
9
|
!!!caption:Thorのinitializeでのコード
|
11
|
-
{{attach_view(
|
10
|
+
{{attach_view(hikiutils_yamane.003.jpg,hikiutils_yamane)}}
|
12
11
|
|
13
12
|
Thorのinitializeでのコードはつぎの通りである.
|
14
13
|
#Hikithor::CLI.start(ARGV)が呼ばれる
|
@@ -38,7 +37,7 @@ module Hikithor
|
|
38
37
|
!!コマンド定義
|
39
38
|
|
40
39
|
!!!caption:thorにおけるコマンド記述のひな形.
|
41
|
-
{{attach_view(
|
40
|
+
{{attach_view(hikiutils_yamane.004.jpg,hikiutils_yamane)}}
|
42
41
|
|
43
42
|
thorではoptparseのような登録処理はない.図にある通りにコマンドが記述され,それらは以下のように構成される.
|
44
43
|
#desc以降にコマンド名と,その説明が記述される.これらはコマンドhelpで一覧として表示させる
|
@@ -70,7 +69,7 @@ mapとはBと呼ばれるメソッドをAでも呼べるようにしてくれる
|
|
70
69
|
|
71
70
|
|
72
71
|
!!!caption:CLIの実行プロセス.
|
73
|
-
{{attach_view(
|
72
|
+
{{attach_view(hikiutils_yamane.006.jpg,hikiutils_yamane)}}
|
74
73
|
|
75
74
|
Thorにおけるcliの実行プロセスは次の通りである.
|
76
75
|
#hiki_thorのHikithor::CLI.start(ARGV)でhikiutils_thor.rbのCLIクラスを呼ぶ
|
@@ -86,7 +85,7 @@ require "hikiutils_thor"
|
|
86
85
|
Hikithor::CLI.start(ARGV)
|
87
86
|
>>>
|
88
87
|
|
89
|
-
<<<
|
88
|
+
<<< ruby
|
90
89
|
|
91
90
|
module Hikithor
|
92
91
|
|
data/lib/hikiutils/version.rb
CHANGED