my_help 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +66 -32
- data/README.org +18 -0
- data/exe/my_help +81 -31
- data/lib/my_help/my_help_controll.rb +95 -93
- data/lib/my_help/org2yml.rb +2 -1
- data/lib/my_help/version.rb +1 -1
- data/my_help.gemspec +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 871927da25328b86ac258c721aa91c4001caefcb8a0e07a170af5ac241561d07
|
4
|
+
data.tar.gz: 1a7639867760309d36cd71a0696dd2bde8ab2d9d78b912984abc88dd72458dc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a598090a7eaa81d6c355168a6a2e41d5ac816119a2c50813047dd37c169418af1198fac09fb1c739cb7d69066980eb5a7bd0766cd4a64d6982b5cb42712b68d
|
7
|
+
data.tar.gz: 972696bf11ff387fb23f5e954d0b24cf6c1d66b8776f92a0a222dc18103835f2b3108021f73715526ae5f1e468e595b221e6e0126ceea4498824e9a5ffa8cd3b
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
my_help (0.8.
|
4
|
+
my_help (0.8.5)
|
5
5
|
colorize
|
6
6
|
command_line
|
7
7
|
thor
|
@@ -9,56 +9,90 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
|
12
|
+
activesupport (6.0.3.3)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
+
aruba (0.14.14)
|
13
19
|
childprocess (>= 0.6.3, < 4.0.0)
|
14
20
|
contracts (~> 0.9)
|
15
21
|
cucumber (>= 1.3.19)
|
16
22
|
ffi (~> 1.9)
|
17
23
|
rspec-expectations (>= 2.99)
|
18
|
-
thor (
|
19
|
-
|
20
|
-
builder (3.2.3)
|
24
|
+
thor (>= 0.19, < 2.0)
|
25
|
+
builder (3.2.4)
|
21
26
|
childprocess (3.0.0)
|
22
27
|
color_echo (3.1.1)
|
23
28
|
colorize (0.8.1)
|
24
29
|
command_line (1.1.0)
|
30
|
+
concurrent-ruby (1.1.7)
|
25
31
|
contracts (0.16.0)
|
26
|
-
cucumber (
|
27
|
-
builder (>= 2.
|
28
|
-
cucumber-core (~>
|
29
|
-
cucumber-
|
30
|
-
cucumber-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
32
|
+
cucumber (5.1.2)
|
33
|
+
builder (~> 3.2, >= 3.2.4)
|
34
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
35
|
+
cucumber-create-meta (~> 2.0, >= 2.0.2)
|
36
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
37
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
38
|
+
cucumber-html-formatter (~> 9.0, >= 9.0.0)
|
39
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
40
|
+
cucumber-wire (~> 4.0, >= 4.0.1)
|
41
|
+
diff-lcs (~> 1.4, >= 1.4.4)
|
42
|
+
multi_test (~> 0.1, >= 0.1.2)
|
43
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
44
|
+
cucumber-core (8.0.1)
|
45
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
46
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
47
|
+
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
48
|
+
cucumber-create-meta (2.0.2)
|
49
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
50
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
51
|
+
cucumber-cucumber-expressions (10.3.0)
|
52
|
+
cucumber-gherkin (15.0.2)
|
53
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
54
|
+
cucumber-html-formatter (9.0.0)
|
55
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
56
|
+
cucumber-messages (13.1.0)
|
57
|
+
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
58
|
+
cucumber-tag-expressions (2.0.4)
|
59
|
+
cucumber-wire (4.0.1)
|
60
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
61
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
62
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
63
|
+
diff-lcs (1.4.4)
|
64
|
+
ffi (1.13.1)
|
65
|
+
i18n (1.8.5)
|
66
|
+
concurrent-ruby (~> 1.0)
|
67
|
+
middleware (0.1.0)
|
68
|
+
minitest (5.14.2)
|
46
69
|
multi_test (0.1.2)
|
70
|
+
protobuf-cucumber (3.10.8)
|
71
|
+
activesupport (>= 3.2)
|
72
|
+
middleware
|
73
|
+
thor
|
74
|
+
thread_safe
|
47
75
|
rake (13.0.1)
|
48
76
|
rspec (3.9.0)
|
49
77
|
rspec-core (~> 3.9.0)
|
50
78
|
rspec-expectations (~> 3.9.0)
|
51
79
|
rspec-mocks (~> 3.9.0)
|
52
|
-
rspec-core (3.9.
|
53
|
-
rspec-support (~> 3.9.
|
54
|
-
rspec-expectations (3.9.
|
80
|
+
rspec-core (3.9.2)
|
81
|
+
rspec-support (~> 3.9.3)
|
82
|
+
rspec-expectations (3.9.2)
|
55
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
84
|
rspec-support (~> 3.9.0)
|
57
|
-
rspec-mocks (3.9.
|
85
|
+
rspec-mocks (3.9.1)
|
58
86
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
87
|
rspec-support (~> 3.9.0)
|
60
|
-
rspec-support (3.9.
|
61
|
-
|
88
|
+
rspec-support (3.9.3)
|
89
|
+
sys-uname (1.2.1)
|
90
|
+
ffi (>= 1.0.0)
|
91
|
+
thor (1.0.1)
|
92
|
+
thread_safe (0.3.6)
|
93
|
+
tzinfo (1.2.7)
|
94
|
+
thread_safe (~> 0.1)
|
95
|
+
zeitwerk (2.4.0)
|
62
96
|
|
63
97
|
PLATFORMS
|
64
98
|
ruby
|
@@ -73,4 +107,4 @@ DEPENDENCIES
|
|
73
107
|
rspec
|
74
108
|
|
75
109
|
BUNDLED WITH
|
76
|
-
2.
|
110
|
+
2.1.4
|
data/README.org
CHANGED
@@ -135,3 +135,21 @@ testは[[/Users/bob/github/ruby_docs/testing_frameworks/test_unit/README.org]]
|
|
135
135
|
「Rubyベストプラクティス」にあるmustを使ったextension
|
136
136
|
を組み込んで,DSLにしている.
|
137
137
|
[[https://github.com/practicingruby/rbp/blob/master/testing/test_unit_extensions.rb]]
|
138
|
+
|
139
|
+
* rspec <2020-09-30 水>
|
140
|
+
shuheiがrspecを組み込んでくれていたはずだが,うまく動いていないみたい.
|
141
|
+
: gem install ffi -v "1.12.1"
|
142
|
+
でerrorが出る.
|
143
|
+
|
144
|
+
#+begin_example
|
145
|
+
brew reinstall libffi
|
146
|
+
set -gx PKG_CONFIG_PATH "/usr/local/opt/libffi/lib/pkgconfig"
|
147
|
+
set -gx CPPFLAGS "-I/usr/local/opt/libffi/include"
|
148
|
+
set -gx LDFLAGS "-L/usr/local/opt/libffi/lib"
|
149
|
+
gem install ffi
|
150
|
+
#+end_example
|
151
|
+
で解消.
|
152
|
+
: bundle update
|
153
|
+
: bundle exec rspec
|
154
|
+
で試したが,相対パスでなく絶対パス的な設定がされているようでダメ.
|
155
|
+
|
data/exe/my_help
CHANGED
@@ -24,7 +24,7 @@ class MyCLI < Thor
|
|
24
24
|
puts e.to_s.red
|
25
25
|
end
|
26
26
|
else
|
27
|
-
begin
|
27
|
+
begin
|
28
28
|
puts $control.show_item(file, item) # list [file] [item]
|
29
29
|
rescue => e
|
30
30
|
puts e.to_s.red
|
@@ -61,35 +61,85 @@ class MyCLI < Thor
|
|
61
61
|
invoke :setup
|
62
62
|
$control.delete_help(help_name)
|
63
63
|
end
|
64
|
-
desc "git [push|pull]", "git push or pull"
|
65
|
-
def git(push_or_pull)
|
66
|
-
p push_or_pull
|
67
|
-
invoke :setup
|
68
|
-
dir = $control.local_help_dir
|
69
|
-
Dir.chdir(dir) do
|
70
|
-
case push_or_pull
|
71
|
-
when 'push'
|
72
|
-
comms = ['git add -A',
|
73
|
-
"git commit -m 'git push from my_help'",
|
74
|
-
"git push origin master"]
|
75
|
-
when 'pull'
|
76
|
-
comms = ['git pull origin master']
|
77
|
-
else
|
78
|
-
raise "my_help git was called by the other than 'push or pull'"
|
79
|
-
end
|
80
|
-
comms.each do |comm|
|
81
|
-
c = command_line(comm)
|
82
|
-
puts c.stdout.blue
|
83
|
-
puts c.stderr.red
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
64
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
65
|
+
=begin
|
66
|
+
desc "git [push|pull]", "git push or pull"
|
67
|
+
def git(push_or_pull)
|
68
|
+
p push_or_pull
|
69
|
+
invoke :setup
|
70
|
+
dir = $control.local_help_dir
|
71
|
+
Dir.chdir(dir) do
|
72
|
+
case push_or_pull
|
73
|
+
when 'push'
|
74
|
+
comms = ['git add -A',
|
75
|
+
"git commit -m 'git push from my_help'",
|
76
|
+
"git push origin master"]
|
77
|
+
when 'pull'
|
78
|
+
comms = ['git pull origin master']
|
79
|
+
else
|
80
|
+
raise "my_help git was called by the other than 'push or pull'"
|
81
|
+
end
|
82
|
+
comms.each do |comm|
|
83
|
+
c = command_line(comm)
|
84
|
+
puts c.stdout.blue
|
85
|
+
puts c.stderr.red
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
=end
|
90
|
+
|
91
|
+
desc "git [push|pull]", "git push or pull"
|
92
|
+
def git(push_or_pull,*args)
|
93
|
+
p push_or_pull
|
94
|
+
invoke :setup
|
95
|
+
argument_size = args.size
|
96
|
+
Dir.chdir($control.local_help_dir) do
|
97
|
+
case push_or_pull
|
98
|
+
when 'push'
|
99
|
+
if argument_size == 0
|
100
|
+
comms = ['git add -A',
|
101
|
+
"git commit -m 'git push from my_help'",
|
102
|
+
"git push origin master"]
|
103
|
+
else
|
104
|
+
p args
|
105
|
+
argument_size.times do |i|
|
106
|
+
orgfile = args[i] + '.org'
|
107
|
+
file = File.join($control.local_help_dir,orgfile)
|
108
|
+
if File.exist?(file) == true
|
109
|
+
puts orgfile.green
|
110
|
+
dir = $control.local_help_dir
|
111
|
+
Dir.chdir(dir) do
|
112
|
+
comm = 'git add ' + file
|
113
|
+
puts c
|
114
|
+
c = command_line(comm)
|
115
|
+
puts c.stdout.blue
|
116
|
+
puts c.stderr.red
|
117
|
+
end
|
118
|
+
else
|
119
|
+
puts (orgfile + " does not existed").red
|
120
|
+
end
|
121
|
+
end
|
122
|
+
comms = ["git commit -m 'git push from my_help'",
|
123
|
+
"git push origin master"]
|
124
|
+
end
|
125
|
+
when 'pull'
|
126
|
+
comms = ['git pull origin master']
|
127
|
+
else
|
128
|
+
raise "my_help git was called by the other than 'push or pull'"
|
129
|
+
end
|
130
|
+
comms.each do |comm|
|
131
|
+
puts comm
|
132
|
+
c = command_line(comm)
|
133
|
+
puts c.stdout.blue
|
134
|
+
puts c.stderr.red
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
# desc "search {find_char}", "search FIND_CHAR"
|
139
|
+
# def search(find_char)
|
140
|
+
# invoke :setup
|
141
|
+
# $control.search_help(find_char)
|
142
|
+
# end
|
143
|
+
end
|
94
144
|
|
95
|
-
MyCLI.start(ARGV)
|
145
|
+
MyCLI.start(ARGV)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# coding: utf-8
|
1
|
+
# -*- coding: utf-8 -*-
|
2
2
|
require 'fileutils'
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
module MyHelp
|
6
|
-
class Control
|
6
|
+
class Control
|
7
7
|
attr_accessor :local_help_dir, :editor
|
8
8
|
def initialize()
|
9
9
|
# for configuration setups
|
@@ -12,7 +12,7 @@ module MyHelp
|
|
12
12
|
@template_dir = File.expand_path("../../templates", __FILE__)
|
13
13
|
@exe_dir = File.expand_path("../../exe", __FILE__)
|
14
14
|
@local_help_dir = File.join(ENV['HOME'],'.my_help')
|
15
|
-
@editor = '
|
15
|
+
@editor = ENV['EDITOR'] || 'emacs' #'code', 'emacs' #'vim' #default editor
|
16
16
|
# @mini_account = File
|
17
17
|
set_help_dir_if_not_exists
|
18
18
|
load_conf
|
@@ -54,7 +54,7 @@ module MyHelp
|
|
54
54
|
|
55
55
|
def list_all
|
56
56
|
output = "\nList all helps\n"
|
57
|
-
|
57
|
+
local_help_entries.each do |file|
|
58
58
|
file_path=File.join(@local_help_dir,file)
|
59
59
|
title = file.split('.')[0]
|
60
60
|
help = auto_load(file_path)
|
@@ -127,94 +127,96 @@ module MyHelp
|
|
127
127
|
end
|
128
128
|
|
129
129
|
=begin
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
130
|
+
def delete_help(file)
|
131
|
+
file = File.join(@local_help_dir,file+'.org')
|
132
|
+
print "Are you sure to delete "+file.blue+"?[Ynq] ".red
|
133
|
+
case STDIN.gets.chomp
|
134
|
+
when 'Y'
|
135
|
+
begin
|
136
|
+
FileUtils.rm(file,:verbose=>true)
|
137
|
+
rescue => error
|
138
|
+
puts error.to_s.red
|
139
|
+
end
|
140
|
+
when 'n', 'q' ; exit
|
139
141
|
end
|
140
|
-
|
141
|
-
end
|
142
|
-
end
|
142
|
+
end
|
143
143
|
=end
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
if file.match(/(.+)\.org
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
when '.
|
212
|
-
cont =
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
end
|
144
|
+
def delete_help(file)
|
145
|
+
file = File.join(@local_help_dir,file+'.org')
|
146
|
+
if File.exist?(file) == true
|
147
|
+
print "Are you sure to delete "+file.blue+"?[Yn] ".red
|
148
|
+
case STDIN.gets.chomp
|
149
|
+
when 'Y'
|
150
|
+
begin
|
151
|
+
FileUtils.rm(file,:verbose=>true)
|
152
|
+
return 0
|
153
|
+
rescue => error
|
154
|
+
puts error.to_s.red
|
155
|
+
return 1
|
156
|
+
end
|
157
|
+
when 'n', 'q' ; return 0
|
158
|
+
end
|
159
|
+
else
|
160
|
+
print file + " is a non-existent file"
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def search_help(word)
|
165
|
+
p find_char = word
|
166
|
+
system "ls #{@local_help_dir} | grep #{find_char}"
|
167
|
+
end
|
168
|
+
|
169
|
+
private
|
170
|
+
def select_item(help, item)
|
171
|
+
o_key = nil
|
172
|
+
help.each_pair do |key, cont|
|
173
|
+
next if key==:license or key==:head
|
174
|
+
if cont[:opts][:short] == item or cont[:opts][:long] == item
|
175
|
+
o_key = key
|
176
|
+
break
|
177
|
+
end
|
178
|
+
end
|
179
|
+
o_key
|
180
|
+
end
|
181
|
+
|
182
|
+
def disp_opts( conts )
|
183
|
+
output = ''
|
184
|
+
col = 0
|
185
|
+
conts.each_pair do |key, item|
|
186
|
+
col_length = case col
|
187
|
+
when 0; output << item.rjust(5)+", "
|
188
|
+
when 1; output << item.ljust(15)+": "
|
189
|
+
else; output << item
|
190
|
+
end
|
191
|
+
col += 1
|
192
|
+
end
|
193
|
+
output << "\n"
|
194
|
+
end
|
195
|
+
def local_help_entries
|
196
|
+
entries= []
|
197
|
+
Dir.entries(@local_help_dir).each{|file|
|
198
|
+
# next unless file.include?('_')
|
199
|
+
next if file[0]=='#' or file[-1]=='~' or file[0]=='.'
|
200
|
+
# next if file.match(/(.+)_e\.org/) # OK?
|
201
|
+
# next if file.match(/(.+)\.html/)
|
202
|
+
if file.match(/(.+)\.org$/) # OK?
|
203
|
+
entries << file
|
204
|
+
end
|
205
|
+
}
|
206
|
+
return entries
|
207
|
+
end
|
208
|
+
|
209
|
+
def auto_load(file_path)
|
210
|
+
case File.extname(file_path)
|
211
|
+
# when '.yml'
|
212
|
+
# cont = YAML.load(File.read(file_path))
|
213
|
+
when '.org'
|
214
|
+
cont = OrgToYaml.new(file_path).help_cont
|
215
|
+
else
|
216
|
+
puts "Not handling file types of #{file_path}"
|
217
|
+
cont = nil
|
218
|
+
end
|
219
|
+
cont
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
data/lib/my_help/org2yml.rb
CHANGED
data/lib/my_help/version.rb
CHANGED
data/my_help.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ensure we require the local version and not one we might have installed already
|
2
2
|
require File.join([File.dirname(__FILE__),'lib','my_help','version.rb'])
|
3
|
-
spec = Gem::Specification.new do |s|
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
4
|
s.name = 'my_help'
|
5
5
|
s.version = MyHelp::VERSION
|
6
6
|
s.author = 'Shigeot R. Nishitani'
|
@@ -17,10 +17,8 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.bindir = "exe"
|
18
18
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
s.add_development_dependency('rake')
|
20
|
-
# s.add_development_dependency('rdoc')
|
21
20
|
s.add_development_dependency('rspec')
|
22
21
|
s.add_runtime_dependency('thor')
|
23
|
-
# s.add_runtime_dependency('gli','2.17.1')
|
24
22
|
s.add_runtime_dependency "colorize"
|
25
23
|
s.add_runtime_dependency "command_line"
|
26
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_help
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeot R. Nishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|