my_help 1.1a → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +0 -1
- data/.yardoc/checksums +11 -5
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/doc/MyHelp/CLI.html +749 -0
- data/doc/MyHelp/Config.html +693 -0
- data/doc/MyHelp/Error.html +124 -0
- data/doc/MyHelp/GetConfig.html +196 -0
- data/doc/MyHelp/Git.html +291 -0
- data/doc/MyHelp/Init.html +449 -0
- data/doc/MyHelp/List.html +577 -0
- data/doc/MyHelp/Md2Hash.html +632 -0
- data/doc/MyHelp/Modify.html +393 -0
- data/doc/MyHelp/Org2Hash.html +542 -0
- data/doc/MyHelp.html +10 -8
- data/doc/Org2Yaml.html +497 -0
- data/doc/_index.html +102 -7
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +81 -412
- data/doc/frames.html +1 -1
- data/doc/index.html +81 -412
- data/doc/method_list.html +292 -36
- data/doc/top-level-namespace.html +5 -5
- data/lib/my_help/version.rb +1 -1
- data/pkg/my_help-0.8.6.gem +0 -0
- data/pkg/my_help-0.9.0.gem +0 -0
- data/pkg/my_help-1.0b.gem +0 -0
- data/pkg/my_help-1.0c.gem +0 -0
- data/pkg/my_help-1.1.gem +0 -0
- data/pkg/my_help-1.1a.gem +0 -0
- metadata +21 -25
- data/'../test'/.my_help/.my_help_conf.yml +0 -2
- data/'../test'/.my_help/emacs.org +0 -50
- data/'../test'/.my_help/org.org +0 -64
- data/'../test'/.my_help/todo.org +0 -11
- data/docs/README.html +0 -218
- data/docs/README.org +0 -202
- data/docs/old_docs/16b_nasu.pdf +0 -0
- data/docs/old_docs/17b_oyagi.pdf +0 -0
- data/docs/old_docs/19b_okabata.pdf +0 -0
- data/docs/old_docs/19b_yamaguchi.pdf +0 -0
- data/docs/old_docs/features/delete.feature +0 -7
- data/docs/old_docs/features/edit.feature +0 -7
- data/docs/old_docs/features/list.feature +0 -6
- data/docs/old_docs/features/new.feature +0 -7
- data/docs/old_docs/features/step_definitions/delete_spec.rb +0 -12
- data/docs/old_docs/features/step_definitions/edit_spec.rb +0 -14
- data/docs/old_docs/features/step_definitions/list_spec.rb +0 -10
- data/docs/old_docs/features/step_definitions/new_spec.rb +0 -12
- data/docs/old_docs/features/support/env.rb +0 -3
- data/docs/old_docs/fukumori_symp/18_human_interface_fukumori_workshop.pdf +0 -0
- data/docs/old_docs/fukumori_symp/memo_perp_magician.pdf +0 -0
- data/docs/old_docs/fukumori_symp//347/237/245/350/255/230/343/201/256/347/233/264/344/272/244/350/243/234/347/251/272/351/226/223.png +0 -0
data/'../test'/.my_help/org.org
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
#+STARTUP: indent nolineimages
|
2
|
-
* head
|
3
|
-
- emacs org-modeのhelp
|
4
|
-
- [[http://akisute3.hatenablog.com/entry/2013/12/28/144918][org-mode による論文作成入門]]
|
5
|
-
- [[http://d.hatena.ne.jp/tamura70/20100209/org]]
|
6
|
-
- org-modeでc-h mでhelpがでる.
|
7
|
-
- https://orgmode.org/worg/org-tutorials/orgtutorial_dto.html
|
8
|
-
* license
|
9
|
-
- cc by Shigeto R. Nishitani, 2017
|
10
|
-
* item
|
11
|
-
- m-x org-mode
|
12
|
-
- emacs hogehoge.orgで起動
|
13
|
-
- - でitem追加
|
14
|
-
- * でitem追加
|
15
|
-
- #+STARTUP: indent nolineimages nofold
|
16
|
-
- #+TITLE: 格子欠陥について最近の研究から
|
17
|
-
- #+AUTHOR: 関西学院大学・理工学部・情報科学科 西谷滋人 2017
|
18
|
-
* key_bind
|
19
|
-
- tabでtoggle
|
20
|
-
- shift-tabで全部に対するtoggle
|
21
|
-
- shift-矢印でkeyを切り替え
|
22
|
-
- M-shift-<left, right>アウトラインのレベルをツリーごと移動
|
23
|
-
* convert
|
24
|
-
- #+OPTIONS: ^:{} でsub, superを抑制.
|
25
|
-
- markdown
|
26
|
-
1. in emacs, M-x org-md-export-as-markdown
|
27
|
-
2. pandoc -f markdown -t org -o tmp.md sample.org
|
28
|
-
3. 行の折り返し,M-x toggle-truncate-lines
|
29
|
-
- latex出力
|
30
|
-
1. c-c c-eでllを選択
|
31
|
-
2. 日本語と数式が混じる時には,$の前後に半角スペースを入れる
|
32
|
-
3. [[https://www-he.scphys.kyoto-u.ac.jp/member/shotakaha/dokuwiki/doku.php?id=toolbox:emacs:org:export:latex:start~]]
|
33
|
-
4. https://orgmode.org/worg/org-tutorials/org-latex-export.html
|
34
|
-
- beamer出力
|
35
|
-
1. c-c c-eでlbを選択
|
36
|
-
* list
|
37
|
-
- 項目- 子項目1
|
38
|
-
- 番号付き1. 2.
|
39
|
-
- 名前付き - 名前1 :: 内容1
|
40
|
-
* link
|
41
|
-
- [[file:./tmp/tmp.txt][Link to file]]
|
42
|
-
- [[link][name]]
|
43
|
-
- to edit, c-c c-l
|
44
|
-
- to open, c-c c-o
|
45
|
-
- org-return-follows-linkが設定されていたらRETでも開く
|
46
|
-
* todo
|
47
|
-
- c-c c-tでno_head->TODO->DONEをloop
|
48
|
-
- m-x agenda-modeでschedule操作可能コマンドを表示
|
49
|
-
* verb_and_source
|
50
|
-
- ': 'を頭に
|
51
|
-
- #+BEGIN_EXAMPLE...#+END_EXAMPLE
|
52
|
-
- #+BEGIN_QUOTE -- #+END_QUOTE
|
53
|
-
- #+BEGIN_SRC bash -- #+END_SRC
|
54
|
-
* date_and_time
|
55
|
-
- c-c .でカレンダーと日付表示<2018-03-14 Wed>
|
56
|
-
- +7とか-1を入力してreturnするとその日付が出力
|
57
|
-
- c-u c-c . で日付と時間の入力<2018-03-14 Wed 12:38>こんな感じ
|
58
|
-
* agenda
|
59
|
-
- (setq org-agenda-files (list "~/org/work.org"
|
60
|
-
"~/org/school.org"
|
61
|
-
"~/org/home.org"))
|
62
|
-
- C-c a t to enter the global todo list.
|
63
|
-
* move
|
64
|
-
- c-c c-u 上位のlevelへ
|
data/'../test'/.my_help/todo.org
DELETED
data/docs/README.html
DELETED
@@ -1,218 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" lang="jp" xml:lang="jp">
|
5
|
-
<head>
|
6
|
-
<!-- 2023-01-05 Thu 15:58 -->
|
7
|
-
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
8
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
9
|
-
<title>my_help 開発メモ</title>
|
10
|
-
<meta name="author" content="Shigeto R. Nishitani" />
|
11
|
-
<meta name="generator" content="Org Mode" />
|
12
|
-
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css"/>
|
13
|
-
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css"/>
|
14
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
15
|
-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
16
|
-
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
|
17
|
-
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js"></script>
|
18
|
-
</head>
|
19
|
-
<body>
|
20
|
-
<div id="content" class="content">
|
21
|
-
<h1 class="title">my_help 開発メモ</h1>
|
22
|
-
<div id="table-of-contents" role="doc-toc">
|
23
|
-
<h2>Table of Contents</h2>
|
24
|
-
<div id="text-table-of-contents" role="doc-toc">
|
25
|
-
<ul>
|
26
|
-
<li><a href="#orge4fa5d5">1. <span class="timestamp-wrapper"><span class="timestamp"><2022-12-15 Thu> </span></span> subcommand and options</a></li>
|
27
|
-
<li><a href="#org66ec027">2. <span class="timestamp-wrapper"><span class="timestamp"><2022-12-15 Thu> </span></span> rspecでerror</a>
|
28
|
-
<ul>
|
29
|
-
<li><a href="#orgab3a666">2.1. 解決!!</a></li>
|
30
|
-
</ul>
|
31
|
-
</li>
|
32
|
-
<li><a href="#org18dc25e">3. <span class="timestamp-wrapper"><span class="timestamp"><2021-10-18 Mon> </span></span> conf_pathの追加</a></li>
|
33
|
-
<li><a href="#org2aec50d">4. <span class="timestamp-wrapper"><span class="timestamp"><2021-11-08 Mon> </span></span> conf_pathをactivate</a></li>
|
34
|
-
<li><a href="#org20943ec">5. <span class="timestamp-wrapper"><span class="timestamp"><2021-11-08 Mon> </span></span> bundle exec exe/my_help editでエラー</a></li>
|
35
|
-
</ul>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
|
39
|
-
<div id="outline-container-orge4fa5d5" class="outline-2">
|
40
|
-
<h2 id="orge4fa5d5"><span class="section-number-2">1.</span> <span class="timestamp-wrapper"><span class="timestamp"><2022-12-15 Thu> </span></span> subcommand and options</h2>
|
41
|
-
<div class="outline-text-2" id="text-1">
|
42
|
-
<ul class="org-ul">
|
43
|
-
<li><a href="https://hawksnowlog.blogspot.com/2020/09/ruby-thor-tutorial.html#hello-thor">Ruby thor で CLI ツールの開発に入門してみる</a></li>
|
44
|
-
</ul>
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
|
48
|
-
<div id="outline-container-org66ec027" class="outline-2">
|
49
|
-
<h2 id="org66ec027"><span class="section-number-2">2.</span> <span class="timestamp-wrapper"><span class="timestamp"><2022-12-15 Thu> </span></span> rspecでerror</h2>
|
50
|
-
<div class="outline-text-2" id="text-2">
|
51
|
-
<p>
|
52
|
-
Arubaでrspecするとpwd directoryが/tmp/arubaになる?
|
53
|
-
そうすると今のままではrspecが通らなくなる.
|
54
|
-
example2.orgの置き場が不定.
|
55
|
-
spec側で強引に作るか...
|
56
|
-
</p>
|
57
|
-
|
58
|
-
<p>
|
59
|
-
それもsmartにしたいよね.
|
60
|
-
newでは後ろにoptionがあって,#{temp_dir}での作成とできるが,
|
61
|
-
これをその他のoptionsでやるのは難しそう.
|
62
|
-
</p>
|
63
|
-
</div>
|
64
|
-
|
65
|
-
<div id="outline-container-orgab3a666" class="outline-3">
|
66
|
-
<h3 id="orgab3a666"><span class="section-number-3">2.1.</span> 解決!!</h3>
|
67
|
-
<div class="outline-text-3" id="text-2-1">
|
68
|
-
<p>
|
69
|
-
Arubaだけの問題なので,テストの時用にhelp_dirを
|
70
|
-
Thorのoptionとして引けるようにした.
|
71
|
-
</p>
|
72
|
-
<div class="org-src-container">
|
73
|
-
<pre class="src src-ruby"><span class="linenr"> 1: </span> desc <span style="color: #8b7355;">"list [HELP] [ITEM]"</span>, <span style="color: #8b7355;">"list helps"</span>
|
74
|
-
<span class="linenr"> 2: </span> option <span style="color: #6e8b3d;">:help_dir</span>, <span style="color: #6e8b3d;">:type</span> => <span style="color: #6e8b3d;">:string</span>
|
75
|
-
<span class="linenr"> 3: </span> <span style="color: #7f7f7f;"># </span><span style="color: #7f7f7f;">use method_options [[https://github.com/rails/thor/wiki/Method-Options]]</span>
|
76
|
-
<span class="linenr"> 4: </span> <span style="color: #1c86ee;">def</span> <span style="color: #cd9b1d;">list</span>(*args)
|
77
|
-
<span class="linenr"> 5: </span> config = get_config(args).config
|
78
|
-
<span class="linenr"> 6: </span> help_dir = options[<span style="color: #8b7355;">"help_dir"</span>] || config[<span style="color: #6e8b3d;">:local_help_dir</span>]
|
79
|
-
<span class="linenr"> 7: </span> <span style="color: #cd6600;">puts</span> <span style="color: #00688b;">List</span>.new(help_dir,
|
80
|
-
<span class="linenr"> 8: </span> config[<span style="color: #6e8b3d;">:ext</span>]).list(*args.join(<span style="color: #8b7355;">" "</span>))
|
81
|
-
<span class="linenr"> 9: </span> <span style="color: #1c86ee;">end</span>
|
82
|
-
<span class="linenr">10: </span>...
|
83
|
-
<span class="linenr">11: </span> context <span style="color: #8b7355;">"list command"</span> <span style="color: #1c86ee;">do</span>
|
84
|
-
<span class="linenr">12: </span> temp_dir = <span style="color: #00688b;">Dir</span>.pwd
|
85
|
-
<span class="linenr">13: </span> let(<span style="color: #6e8b3d;">:help_name</span>) { <span style="color: #8b7355;">"example"</span> }
|
86
|
-
<span class="linenr">14: </span> let(<span style="color: #6e8b3d;">:help_dir</span>) { <span style="color: #00688b;">File</span>.join(temp_dir, <span style="color: #8b7355;">"lib"</span>, <span style="color: #8b7355;">"templates"</span>) }
|
87
|
-
<span class="linenr">15: </span>
|
88
|
-
<span class="linenr">16: </span> it <span style="color: #8b7355;">"list with name"</span> <span style="color: #1c86ee;">do</span>
|
89
|
-
<span class="linenr">17: </span> run_command(<span style="color: #8b7355;">"my_help list </span><span style="color: #2e8b57;">#{help_name}</span><span style="color: #8b7355;"> a_item --help_dir=</span><span style="color: #2e8b57;">#{help_dir}</span><span style="color: #8b7355;">"</span>)
|
90
|
-
<span class="linenr">18: </span> stop_all_commands
|
91
|
-
<span class="linenr">19: </span> expect(last_command_started).to have_output(<span style="color: #8b7355;">/a_item/</span>)
|
92
|
-
<span class="linenr">20: </span> <span style="color: #1c86ee;">end</span>
|
93
|
-
<span class="linenr">21: </span> <span style="color: #1c86ee;">end</span>
|
94
|
-
<span class="linenr">22: </span>
|
95
|
-
</pre>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
</div>
|
99
|
-
</div>
|
100
|
-
|
101
|
-
<div id="outline-container-org18dc25e" class="outline-2">
|
102
|
-
<h2 id="org18dc25e"><span class="section-number-2">3.</span> <span class="timestamp-wrapper"><span class="timestamp"><2021-10-18 Mon> </span></span> conf_pathの追加</h2>
|
103
|
-
<div class="outline-text-2" id="text-3">
|
104
|
-
<p>
|
105
|
-
my_help.confの場所を指定するconf_pathをnewで指定できるようにする.
|
106
|
-
</p>
|
107
|
-
|
108
|
-
<div class="org-src-container">
|
109
|
-
<pre class="src src-diff"><span class="linenr"> 1: </span><span style="color: #22aa22; background-color: #ddffdd;">></span><span style="background-color: #ddffdd;"> git diff</span>
|
110
|
-
<span class="linenr"> 2: </span><span style="background-color: #d9d9d9;">--- </span><span style="background-color: #bfbfbf; font-weight: bold;">a/lib/my_help/my_help_controll.rb</span>
|
111
|
-
<span class="linenr"> 3: </span><span style="background-color: #d9d9d9;">+++ </span><span style="background-color: #bfbfbf; font-weight: bold;">b/lib/my_help/my_help_controll.rb</span>
|
112
|
-
<span class="linenr"> 4: </span><span style="background-color: #d9d9d9;">@@ -5,13 +5,14 @@</span><span style="background-color: #d9d9d9;"> require 'yaml'</span>
|
113
|
-
<span class="linenr"> 5: </span> module MyHelp
|
114
|
-
<span class="linenr"> 6: </span> class Control
|
115
|
-
<span class="linenr"> 7: </span> attr_accessor :local_help_dir, :editor
|
116
|
-
<span class="linenr"> 8: </span><span style="color: #aa2222; background-color: #ffdddd;">-</span><span style="background-color: #ffdddd;"> def initialize()</span>
|
117
|
-
<span class="linenr"> 9: </span><span style="color: #22aa22; background-color: #ddffdd;">+</span><span style="background-color: #ddffdd;"> def initialize(</span><span style="background-color: #aaffaa;">conf_path=nil</span><span style="background-color: #ddffdd;">)</span>
|
118
|
-
<span class="linenr">10: </span> # for configuration setups
|
119
|
-
<span class="linenr">11: </span> # see https://stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem
|
120
|
-
<span class="linenr">12: </span><span style="color: #aa2222; background-color: #ffdddd;">-</span>
|
121
|
-
<span class="linenr">13: </span><span style="color: #22aa22; background-color: #ddffdd;">+</span><span style="background-color: #ddffdd;"> </span><span style="background-color: #aaffaa;">@conf_path = conf_path || ENV['HOME']</span>
|
122
|
-
<span class="linenr">14: </span> @template_dir = File.expand_path("../../templates", __FILE__)
|
123
|
-
<span class="linenr">15: </span> @exe_dir = File.expand_path("../../exe", __FILE__)
|
124
|
-
<span class="linenr">16: </span><span style="color: #aa2222; background-color: #ffdddd;">-</span><span style="background-color: #ffdddd;"> @local_help_dir = File.join(</span><span style="background-color: #ffbbbb;">ENV[</span><span style="background-color: #ffdddd;">'</span><span style="background-color: #ffbbbb;">HOME</span><span style="background-color: #ffdddd;">'</span><span style="background-color: #ffbbbb;">]</span><span style="background-color: #ffdddd;">,'.my_help')</span>
|
125
|
-
<span class="linenr">17: </span><span style="color: #22aa22; background-color: #ddffdd;">+</span><span style="background-color: #ddffdd;"> @local_help_dir = File.join(</span><span style="background-color: #aaffaa;">@conf_path,</span><span style="background-color: #ddffdd;"> '</span><span style="background-color: #aaffaa;">.my_help</span><span style="background-color: #ddffdd;">'</span><span style="background-color: #aaffaa;">)</span><span style="background-color: #aaffaa;">
|
126
|
-
<span class="linenr">18: </span></span><span style="color: #22aa22; background-color: #aaffaa;">+</span><span style="background-color: #aaffaa;"> @conf_file = File.join(@local_help_dir</span><span style="background-color: #ddffdd;">, '.my_help</span><span style="background-color: #aaffaa;">_conf.yml</span><span style="background-color: #ddffdd;">')</span>
|
127
|
-
<span class="linenr">19: </span> @editor = ENV['EDITOR'] || 'emacs' #'code', 'emacs' #'vim' #default editor
|
128
|
-
<span class="linenr">20: </span> # @mini_account = File
|
129
|
-
<span class="linenr">21: </span> set_help_dir_if_not_exists
|
130
|
-
<span class="linenr">22: </span><span style="background-color: #d9d9d9;">@@ -28,9 +29,6 @@</span><span style="background-color: #d9d9d9;"> module MyHelp</span>
|
131
|
-
<span class="linenr">23: </span> end
|
132
|
-
<span class="linenr">24: </span>
|
133
|
-
<span class="linenr">25: </span> def load_conf
|
134
|
-
<span class="linenr">26: </span><span style="color: #aa2222; background-color: #ffdddd;">-</span><span style="background-color: #ffdddd;"> file_name = '.my_help_conf.yml'</span>
|
135
|
-
<span class="linenr">27: </span><span style="color: #aa2222; background-color: #ffdddd;">-</span><span style="background-color: #ffdddd;"> # @conf_file = File.join(Dir.pwd, file_name)</span>
|
136
|
-
<span class="linenr">28: </span><span style="color: #aa2222; background-color: #ffdddd;">-</span><span style="background-color: #ffdddd;"> @conf_file = File.join(@local_help_dir, file_name)</span>
|
137
|
-
<span class="linenr">29: </span> begin
|
138
|
-
<span class="linenr">30: </span> conf = YAML.load_file(@conf_file)
|
139
|
-
<span class="linenr">31: </span> @editor = conf[:editor]
|
140
|
-
</pre>
|
141
|
-
</div>
|
142
|
-
|
143
|
-
<p>
|
144
|
-
変更箇所は次の通り.
|
145
|
-
</p>
|
146
|
-
<ul class="org-ul">
|
147
|
-
<li>initializeはconf_pathを受け取るが,指定されてない時はnil</li>
|
148
|
-
<li>これを@conf_pathに受け渡すが,defaultをENV['HOME']に指定</li>
|
149
|
-
<li>これでデフォルトのconfigurationを変更していく
|
150
|
-
やり方は,
|
151
|
-
<a href="https://stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem">Where to place/access config file in gem?</a>
|
152
|
-
を参照する.</li>
|
153
|
-
</ul>
|
154
|
-
|
155
|
-
<p>
|
156
|
-
これによってTest::unitでのtest環境独自のmy_help環境を構築することが
|
157
|
-
できる.
|
158
|
-
</p>
|
159
|
-
</div>
|
160
|
-
</div>
|
161
|
-
|
162
|
-
<div id="outline-container-org2aec50d" class="outline-2">
|
163
|
-
<h2 id="org2aec50d"><span class="section-number-2">4.</span> <span class="timestamp-wrapper"><span class="timestamp"><2021-11-08 Mon> </span></span> conf_pathをactivate</h2>
|
164
|
-
<div class="outline-text-2" id="text-4">
|
165
|
-
<p>
|
166
|
-
testが進んできたので,conf_pathをactivateした.
|
167
|
-
そのためのテストが必要かも.
|
168
|
-
</p>
|
169
|
-
|
170
|
-
<ol class="org-ol">
|
171
|
-
<li>ENV['HOME']で指定した時と...</li>
|
172
|
-
<li>pwdで何もない時のoptionsがどうなっている?</li>
|
173
|
-
</ol>
|
174
|
-
|
175
|
-
<div class="org-src-container">
|
176
|
-
<pre class="src src-yaml"><span style="color: #2e8b57;">config</span>:
|
177
|
-
<span style="color: #2e8b57;">:template_dir</span>: <span style="color: #8b7355;">"/Users/bob/git_hub/my_help/lib/templates"</span>
|
178
|
-
<span style="color: #2e8b57;">:local_help_dir</span>: <span style="color: #8b7355;">"/Users/bob/git_hub/my_help/test/.my_help"</span>
|
179
|
-
<span style="color: #2e8b57;">:conf_file</span>: <span style="color: #8b7355;">"/Users/bob/git_hub/my_help/test/.my_help/.my_help_conf.yml"</span>
|
180
|
-
<span style="color: #2e8b57;">:editor</span>: emacs
|
181
|
-
</pre>
|
182
|
-
</div>
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div id="outline-container-org20943ec" class="outline-2">
|
187
|
-
<h2 id="org20943ec"><span class="section-number-2">5.</span> <span class="timestamp-wrapper"><span class="timestamp"><2021-11-08 Mon> </span></span> bundle exec exe/my_help editでエラー</h2>
|
188
|
-
<div class="outline-text-2" id="text-5">
|
189
|
-
<div class="org-src-container">
|
190
|
-
<pre class="src src-shell">Could not find ffi-1.15.4<span style="color: #1c86ee;"> in</span> any of the sources
|
191
|
-
Run <span style="color: #ff00ff;">`bundle install`</span> to install missing gems.
|
192
|
-
</pre>
|
193
|
-
</div>
|
194
|
-
<p>
|
195
|
-
とのエラー.
|
196
|
-
なんだろう.
|
197
|
-
</p>
|
198
|
-
|
199
|
-
<p>
|
200
|
-
さらに,command_lineで呼ぶと,
|
201
|
-
</p>
|
202
|
-
<pre class="example">
|
203
|
-
emacs: standard input is not a tty
|
204
|
-
</pre>
|
205
|
-
|
206
|
-
<p>
|
207
|
-
というエラーが出る.これまたなんだろう???
|
208
|
-
</p>
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
</div>
|
212
|
-
<div id="postamble" class="status">
|
213
|
-
<p class="author">Author: Shigeto R. Nishitani</p>
|
214
|
-
<p class="date">Created: 2023-01-05 Thu 15:58</p>
|
215
|
-
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
216
|
-
</div>
|
217
|
-
</body>
|
218
|
-
</html>
|
data/docs/README.org
DELETED
@@ -1,202 +0,0 @@
|
|
1
|
-
#+qiita_teams: 5e172c4b5167abe35a3e
|
2
|
-
#+qiita_private: 6487b0b54e4eda26e9f6
|
3
|
-
#+OPTIONS: ^:{}
|
4
|
-
#+STARTUP: indent nolineimages
|
5
|
-
#+TITLE: my_help 開発メモ
|
6
|
-
#+AUTHOR: Shigeto R. Nishitani
|
7
|
-
#+EMAIL: (concat "shigeto_nishitani@mac.com")
|
8
|
-
#+LANGUAGE: jp
|
9
|
-
#+OPTIONS: H:4 toc:t num:2
|
10
|
-
# +OPTIONS: toc:nil
|
11
|
-
#+TAG: ruby, test, my_help
|
12
|
-
#+TWITTER: off
|
13
|
-
#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup
|
14
|
-
|
15
|
-
* <2023-01-06 Fri> get_configの置き場所
|
16
|
-
thorのsubcommandを使って
|
17
|
-
* <2023-01-05 Thu> cli directory指定
|
18
|
-
** directory指定
|
19
|
-
テスト環境と本番環境でのhelp_dirあるいはconfig_dir指定の
|
20
|
-
差異の吸収メモ.
|
21
|
-
- --help_dirでcliはhelp_dirを指定できる.
|
22
|
-
- 全て変更したはず.
|
23
|
-
- configが混乱しやすい...config[:ext]なんかを自動で返すといいが.
|
24
|
-
- rspec/unitでは
|
25
|
-
- config_spec.rb, modify_spec.rbではtmp_confをtemp_dirに作成
|
26
|
-
- list_spec.rbではtemplates_pathを絶対パスで参照
|
27
|
-
|
28
|
-
** Thorでのdirectory指定の変更
|
29
|
-
Thorのdirectory指定をしっかりやってみる.
|
30
|
-
|
31
|
-
#+begin_src bash
|
32
|
-
bundle exec rspec --format documentation -e list spec/cli_spec.rb --help_dir='./tmp/.my_Help'
|
33
|
-
invalid option: --help_dir=./tmp/.my_Help
|
34
|
-
|
35
|
-
Please use --help for a listing of valid options
|
36
|
-
#+end_src
|
37
|
-
これはだめ.なぜなら,--help_dirはmy_helpのlistのoptionであって,
|
38
|
-
rspecは解釈してくれない.
|
39
|
-
|
40
|
-
ここは,cli_spec.rbで
|
41
|
-
#+begin_src ruby
|
42
|
-
temp_dir = Dir.pwd
|
43
|
-
let(:help_name) { "example" }
|
44
|
-
let(:help_dir) { File.join(temp_dir, "lib", "templates") }
|
45
|
-
|
46
|
-
it "list with name" do
|
47
|
-
run_command("my_help list #{help_name} a_item --help_dir=#{help_dir}")
|
48
|
-
stop_all_commands
|
49
|
-
expect(last_command_started).to have_output(/a_item/)
|
50
|
-
end
|
51
|
-
#+end_src
|
52
|
-
とすべき.
|
53
|
-
|
54
|
-
そうすると
|
55
|
-
#+begin_src bash
|
56
|
-
bundle exec exe/my_help list --help_dir='/Users/bob/git_hub/my_help/lib/templates'
|
57
|
-
#+end_src
|
58
|
-
でも動く.
|
59
|
-
そうしておいて,optionsを移動.
|
60
|
-
|
61
|
-
今は,
|
62
|
-
#+begin_src bash
|
63
|
-
> bundle exec exe/my_help help list
|
64
|
-
Usage:
|
65
|
-
my_help list [HELP] [ITEM]
|
66
|
-
|
67
|
-
Options:
|
68
|
-
[--help-dir=HELP_DIR]
|
69
|
-
[--layer=N]
|
70
|
-
|
71
|
-
list helps
|
72
|
-
#+end_src
|
73
|
-
となっていたが,
|
74
|
-
|
75
|
-
#+begin_src bash
|
76
|
-
bundle exec exe/my_help
|
77
|
-
Commands:
|
78
|
-
my_help delete [HELP] # delete HELP
|
79
|
-
my_help edit [HELP] # edit help
|
80
|
-
...
|
81
|
-
Options:
|
82
|
-
[--help-dir=HELP_DIR]
|
83
|
-
#+end_src
|
84
|
-
とclass_optionとすることで,共通して指定できるように変更.
|
85
|
-
|
86
|
-
* <2022-12-15 Thu> subcommand and options
|
87
|
-
- [[https://hawksnowlog.blogspot.com/2020/09/ruby-thor-tutorial.html#hello-thor][Ruby thor で CLI ツールの開発に入門してみる]]
|
88
|
-
|
89
|
-
* <2022-12-15 Thu> rspecでerror
|
90
|
-
Arubaでrspecするとpwd directoryが/tmp/arubaになる?
|
91
|
-
そうすると今のままではrspecが通らなくなる.
|
92
|
-
example2.orgの置き場が不定.
|
93
|
-
spec側で強引に作るか...
|
94
|
-
|
95
|
-
それもsmartにしたいよね.
|
96
|
-
newでは後ろにoptionがあって,#{temp_dir}での作成とできるが,
|
97
|
-
これをその他のoptionsでやるのは難しそう.
|
98
|
-
|
99
|
-
** 解決!!
|
100
|
-
Arubaだけの問題なので,テストの時用にhelp_dirを
|
101
|
-
Thorのoptionとして引けるようにした.
|
102
|
-
#+begin_src ruby -n
|
103
|
-
desc "list [HELP] [ITEM]", "list helps"
|
104
|
-
option :help_dir, :type => :string
|
105
|
-
# use method_options [[https://github.com/rails/thor/wiki/Method-Options]]
|
106
|
-
def list(*args)
|
107
|
-
config = get_config(args).config
|
108
|
-
help_dir = options["help_dir"] || config[:local_help_dir]
|
109
|
-
puts List.new(help_dir,
|
110
|
-
config[:ext]).list(*args.join(" "))
|
111
|
-
end
|
112
|
-
...
|
113
|
-
context "list command" do
|
114
|
-
temp_dir = Dir.pwd
|
115
|
-
let(:help_name) { "example" }
|
116
|
-
let(:help_dir) { File.join(temp_dir, "lib", "templates") }
|
117
|
-
|
118
|
-
it "list with name" do
|
119
|
-
run_command("my_help list #{help_name} a_item --help_dir=#{help_dir}")
|
120
|
-
stop_all_commands
|
121
|
-
expect(last_command_started).to have_output(/a_item/)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
#+end_src
|
126
|
-
|
127
|
-
* <2021-10-18 月> conf_pathの追加
|
128
|
-
my_help.confの場所を指定するconf_pathをnewで指定できるようにする.
|
129
|
-
|
130
|
-
#+begin_src diff -n -i
|
131
|
-
> git diff
|
132
|
-
--- a/lib/my_help/my_help_controll.rb
|
133
|
-
+++ b/lib/my_help/my_help_controll.rb
|
134
|
-
@@ -5,13 +5,14 @@ require 'yaml'
|
135
|
-
module MyHelp
|
136
|
-
class Control
|
137
|
-
attr_accessor :local_help_dir, :editor
|
138
|
-
- def initialize()
|
139
|
-
+ def initialize(conf_path=nil)
|
140
|
-
# for configuration setups
|
141
|
-
# see https://stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem
|
142
|
-
-
|
143
|
-
+ @conf_path = conf_path || ENV['HOME']
|
144
|
-
@template_dir = File.expand_path("../../templates", __FILE__)
|
145
|
-
@exe_dir = File.expand_path("../../exe", __FILE__)
|
146
|
-
- @local_help_dir = File.join(ENV['HOME'],'.my_help')
|
147
|
-
+ @local_help_dir = File.join(@conf_path, '.my_help')
|
148
|
-
+ @conf_file = File.join(@local_help_dir, '.my_help_conf.yml')
|
149
|
-
@editor = ENV['EDITOR'] || 'emacs' #'code', 'emacs' #'vim' #default editor
|
150
|
-
# @mini_account = File
|
151
|
-
set_help_dir_if_not_exists
|
152
|
-
@@ -28,9 +29,6 @@ module MyHelp
|
153
|
-
end
|
154
|
-
|
155
|
-
def load_conf
|
156
|
-
- file_name = '.my_help_conf.yml'
|
157
|
-
- # @conf_file = File.join(Dir.pwd, file_name)
|
158
|
-
- @conf_file = File.join(@local_help_dir, file_name)
|
159
|
-
begin
|
160
|
-
conf = YAML.load_file(@conf_file)
|
161
|
-
@editor = conf[:editor]
|
162
|
-
#+end_src
|
163
|
-
|
164
|
-
変更箇所は次の通り.
|
165
|
-
- initializeはconf_pathを受け取るが,指定されてない時はnil
|
166
|
-
- これを@conf_pathに受け渡すが,defaultをENV['HOME']に指定
|
167
|
-
- これでデフォルトのconfigurationを変更していく
|
168
|
-
やり方は,
|
169
|
-
[[https://stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem][Where to place/access config file in gem?]]
|
170
|
-
を参照する.
|
171
|
-
|
172
|
-
これによってTest::unitでのtest環境独自のmy_help環境を構築することが
|
173
|
-
できる.
|
174
|
-
|
175
|
-
* <2021-11-08 月> conf_pathをactivate
|
176
|
-
testが進んできたので,conf_pathをactivateした.
|
177
|
-
そのためのテストが必要かも.
|
178
|
-
|
179
|
-
1. ENV['HOME']で指定した時と...
|
180
|
-
1. pwdで何もない時のoptionsがどうなっている?
|
181
|
-
|
182
|
-
#+begin_src yaml
|
183
|
-
config:
|
184
|
-
:template_dir: "/Users/bob/git_hub/my_help/lib/templates"
|
185
|
-
:local_help_dir: "/Users/bob/git_hub/my_help/test/.my_help"
|
186
|
-
:conf_file: "/Users/bob/git_hub/my_help/test/.my_help/.my_help_conf.yml"
|
187
|
-
:editor: emacs
|
188
|
-
#+end_src
|
189
|
-
|
190
|
-
* <2021-11-08 月> bundle exec exe/my_help editでエラー
|
191
|
-
#+begin_src shell
|
192
|
-
Could not find ffi-1.15.4 in any of the sources
|
193
|
-
Run `bundle install` to install missing gems.
|
194
|
-
#+end_src
|
195
|
-
とのエラー.
|
196
|
-
なんだろう.
|
197
|
-
|
198
|
-
さらに,command_lineで呼ぶと,
|
199
|
-
: emacs: standard input is not a tty
|
200
|
-
というエラーが出る.これまたなんだろう???
|
201
|
-
|
202
|
-
|
data/docs/old_docs/16b_nasu.pdf
DELETED
Binary file
|
data/docs/old_docs/17b_oyagi.pdf
DELETED
Binary file
|
Binary file
|
Binary file
|
@@ -1,7 +0,0 @@
|
|
1
|
-
Feature: helpの編集
|
2
|
-
|
3
|
-
Scenario: help を編集する.
|
4
|
-
Given `$ bundle exec bin/my_help_thor list`でnew_helpが存在しない.
|
5
|
-
When `$ bundle exec bin/my_help_thor new new_help`を実行する.
|
6
|
-
And `$ bundle exec bin/my_help_thor edit new_help`実行して、全ての記述を削除する.
|
7
|
-
Then ~/.my_help/new_help.orgが空ファイルである.
|
@@ -1,6 +0,0 @@
|
|
1
|
-
Feature: helpの一覧表示
|
2
|
-
|
3
|
-
Scenario: help の一覧を表示する
|
4
|
-
Given `$ find ~/.my_help -name "*.org" | xargs head -n 1 | grep -v '#+STARTUP: indent nolineimages'`で確認できるhelpがファイルが~/.my_helpに存在する.
|
5
|
-
When `$ bundle exec bin/my_help_thor list`を実行する.
|
6
|
-
Then ~/.my_helpのファイル名相当の項目がlistに全て存在する.
|
Binary file
|
Binary file
|