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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 256d8c9ec84045cb103f0de05567c4107d7b97c48b26bbd3697df3db009e5dbc
4
- data.tar.gz: 5be179861617eff7530d061669d36d61e4f9de3bea0bb4f32c6ff2117bb5a28d
3
+ metadata.gz: 871927da25328b86ac258c721aa91c4001caefcb8a0e07a170af5ac241561d07
4
+ data.tar.gz: 1a7639867760309d36cd71a0696dd2bde8ab2d9d78b912984abc88dd72458dc5
5
5
  SHA512:
6
- metadata.gz: a5b5077ff038c414ffc5c6d13c8691d18d9706282931f406a5c36f6f61807699fa418628a0faa0a9dea422f6d17b7b3d53034edb9f71d349af5c88265d09bd04
7
- data.tar.gz: 4050c4dda2c5e5f4e6ad0b43368a69963b5ef8e82eb8b522c119cdea2287f76efbd15f077ae86ff3a2e5b7b63e18685899e97be6632728844d885e1af520fa90
6
+ metadata.gz: 7a598090a7eaa81d6c355168a6a2e41d5ac816119a2c50813047dd37c169418af1198fac09fb1c739cb7d69066980eb5a7bd0766cd4a64d6982b5cb42712b68d
7
+ data.tar.gz: 972696bf11ff387fb23f5e954d0b24cf6c1d66b8776f92a0a222dc18103835f2b3108021f73715526ae5f1e468e595b221e6e0126ceea4498824e9a5ffa8cd3b
data/.gitignore CHANGED
@@ -7,4 +7,4 @@
7
7
  *~
8
8
  \#*
9
9
 
10
-
10
+ .ruby-version
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- my_help (0.8.4)
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
- aruba (0.14.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 (~> 0.19)
19
- backports (3.15.0)
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 (3.1.2)
27
- builder (>= 2.1.2)
28
- cucumber-core (~> 3.2.0)
29
- cucumber-expressions (~> 6.0.1)
30
- cucumber-wire (~> 0.0.1)
31
- diff-lcs (~> 1.3)
32
- gherkin (~> 5.1.0)
33
- multi_json (>= 1.7.5, < 2.0)
34
- multi_test (>= 0.1.2)
35
- cucumber-core (3.2.1)
36
- backports (>= 3.8.0)
37
- cucumber-tag_expressions (~> 1.1.0)
38
- gherkin (~> 5.0)
39
- cucumber-expressions (6.0.1)
40
- cucumber-tag_expressions (1.1.1)
41
- cucumber-wire (0.0.1)
42
- diff-lcs (1.3)
43
- ffi (1.11.3)
44
- gherkin (5.1.0)
45
- multi_json (1.14.1)
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.0)
53
- rspec-support (~> 3.9.0)
54
- rspec-expectations (3.9.0)
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.0)
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.0)
61
- thor (0.20.3)
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.0.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
+
@@ -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
- # desc "search {find_char}", "search FIND_CHAR"
89
- # def search(find_char)
90
- # invoke :setup
91
- # $control.search_help(find_char)
92
- # end
93
- end
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 = 'code' #'emacs' #'vim' #default 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
- local_help_entries.each do |file|
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
- 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
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
- when 'n', 'q' ; exit
141
- end
142
- end
142
+ end
143
143
  =end
144
-
145
- def delete_help(file)
146
- file = File.join(@local_help_dir,file+'.org')
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
- end
160
-
161
- def search_help(word)
162
- p find_char = word
163
- system "ls #{@local_help_dir} | grep #{find_char}"
164
- end
165
-
166
- private
167
- def select_item(help, item)
168
- o_key = nil
169
- help.each_pair do |key, cont|
170
- next if key==:license or key==:head
171
- if cont[:opts][:short] == item or cont[:opts][:long] == item
172
- o_key = key
173
- break
174
- end
175
- end
176
- o_key
177
- end
178
-
179
- def disp_opts( conts )
180
- output = ''
181
- col = 0
182
- conts.each_pair do |key, item|
183
- col_length = case col
184
- when 0; output << item.rjust(5)+", "
185
- when 1; output << item.ljust(15)+": "
186
- else; output << item
187
- end
188
- col += 1
189
- end
190
- output << "\n"
191
- end
192
-
193
- def local_help_entries
194
- entries= []
195
- Dir.entries(@local_help_dir).each{|file|
196
- # next unless file.include?('_')
197
- next if file[0]=='#' or file[-1]=='~' or file[0]=='.'
198
- # next if file.match(/(.+)_e\.org/) # OK?
199
- # next if file.match(/(.+)\.html/)
200
- if file.match(/(.+)\.org$/) # OK?
201
- entries << file
202
- end
203
- }
204
- return entries
205
- end
206
-
207
- def auto_load(file_path)
208
- case File.extname(file_path)
209
- # when '.yml'
210
- # cont = YAML.load(File.read(file_path))
211
- when '.org'
212
- cont = OrgToYaml.new(file_path).help_cont
213
- else
214
- puts "Not handling file types of #{file_path}"
215
- cont = nil
216
- end
217
- cont
218
- end
219
- end
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
@@ -37,7 +37,8 @@ class OrgToYaml
37
37
 
38
38
  def org_to_yaml(lines)
39
39
  lines.each do |line|
40
- if m = line.match(/^\* (.+)/)
40
+ m = line.force_encoding(Encoding::UTF_8).match(/^\* (.+)/u)
41
+ if m
41
42
  next_cont m[1]
42
43
  else
43
44
  @conts << line
@@ -1,3 +1,3 @@
1
1
  module MyHelp
2
- VERSION = "0.8.5"
2
+ VERSION = "0.8.6"
3
3
  end
@@ -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.5
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-01-10 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake