my_help 0.8.3 → 0.8.5

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
- SHA1:
3
- metadata.gz: af669506ead4e56be3bda410c300db976b75a46e
4
- data.tar.gz: b86b7072d951a084e07a02c7141da126f24b159c
2
+ SHA256:
3
+ metadata.gz: 256d8c9ec84045cb103f0de05567c4107d7b97c48b26bbd3697df3db009e5dbc
4
+ data.tar.gz: 5be179861617eff7530d061669d36d61e4f9de3bea0bb4f32c6ff2117bb5a28d
5
5
  SHA512:
6
- metadata.gz: 779aadb940d47bf053048a26adf8feda5b16a72bff50171d975b2fbd8334ce62c2344957f562d11e2ea40439c712d87b08a827533a4b57728c7ed75a27c35dc8
7
- data.tar.gz: ec6311de9c0778e09c54df1dcf7058126ad579f654222360f64437ae11b92f51c13dd8543e62c79025c5358e2656699c676eb8942b442a42743cbd36bb526abd
6
+ metadata.gz: a5b5077ff038c414ffc5c6d13c8691d18d9706282931f406a5c36f6f61807699fa418628a0faa0a9dea422f6d17b7b3d53034edb9f71d349af5c88265d09bd04
7
+ data.tar.gz: 4050c4dda2c5e5f4e6ad0b43368a69963b5ef8e82eb8b522c119cdea2287f76efbd15f077ae86ff3a2e5b7b63e18685899e97be6632728844d885e1af520fa90
data/.rspec CHANGED
@@ -1 +1,4 @@
1
1
  --require spec_helper
2
+ --format documentation
3
+ --color
4
+
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
- gem 'ffi', '>= 1.9.24'
3
+ gem 'ffi', '~> 1.9'
4
+ gem 'aruba', '~> 0.14.12'
5
+ gem 'command_line', '~> 1.1.0'
6
+ gem 'color_echo'
data/Gemfile.lock CHANGED
@@ -1,19 +1,50 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- my_help (0.8.0)
4
+ my_help (0.8.4)
5
5
  colorize
6
- gli (= 2.17.1)
6
+ command_line
7
+ thor
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ aruba (0.14.12)
13
+ childprocess (>= 0.6.3, < 4.0.0)
14
+ contracts (~> 0.9)
15
+ cucumber (>= 1.3.19)
16
+ ffi (~> 1.9)
17
+ rspec-expectations (>= 2.99)
18
+ thor (~> 0.19)
19
+ backports (3.15.0)
20
+ builder (3.2.3)
21
+ childprocess (3.0.0)
22
+ color_echo (3.1.1)
11
23
  colorize (0.8.1)
24
+ command_line (1.1.0)
25
+ 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)
12
42
  diff-lcs (1.3)
13
- ffi (1.11.2)
14
- gli (2.17.1)
43
+ ffi (1.11.3)
44
+ gherkin (5.1.0)
45
+ multi_json (1.14.1)
46
+ multi_test (0.1.2)
15
47
  rake (13.0.1)
16
- rdoc (6.2.0)
17
48
  rspec (3.9.0)
18
49
  rspec-core (~> 3.9.0)
19
50
  rspec-expectations (~> 3.9.0)
@@ -33,12 +64,13 @@ PLATFORMS
33
64
  ruby
34
65
 
35
66
  DEPENDENCIES
36
- ffi (>= 1.9.24)
67
+ aruba (~> 0.14.12)
68
+ color_echo
69
+ command_line (~> 1.1.0)
70
+ ffi (~> 1.9)
37
71
  my_help!
38
72
  rake
39
- rdoc
40
73
  rspec
41
- thor
42
74
 
43
75
  BUNDLED WITH
44
76
  2.0.2
data/bin/my_help_thor ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+ require 'thor'
3
+ require 'my_help'
4
+ require 'colorize'
5
+ class MyCLI < Thor
6
+ desc('setup', 'set up the test database')
7
+ def setup(*args)
8
+ $control = MyHelp::Control.new()
9
+ end
10
+
11
+ desc "list", "list all helps, specific HELP, or item"
12
+ def list(*args)
13
+ invoke :setup
14
+ file = args[0]
15
+ item = args[1]
16
+ if file.nil?
17
+ puts $control.list_all # list []
18
+ elsif item.nil?
19
+ begin
20
+ puts $control.list_help(file) # list [file]
21
+ rescue => e
22
+ puts e.to_s.red
23
+ end
24
+ else
25
+ begin
26
+ puts $control.show_item(file, item) # list [file] [item]
27
+ rescue => e
28
+ puts e.to_s.red
29
+ end
30
+ end
31
+ end
32
+
33
+ desc "edit {help_name}", "edit HELP_NAME"
34
+ def edit(help_name)
35
+ invoke :setup
36
+ $control.edit_help(help_name)
37
+ end
38
+
39
+ desc "new {help_name}", "make new HELP_NAME"
40
+ def new(help_name)
41
+ invoke :setup
42
+ $control.init_help(help_name)
43
+ end
44
+
45
+ desc "delete {help_name}", "delete HELP_NAME"
46
+ def delete(help_name)
47
+ invoke :setup
48
+ $control.delete_help(help_name)
49
+ end
50
+
51
+ desc "tomo_upload {help_name}", "tomo_upload HELP_NAME"
52
+ def tomo_upload(help_name)
53
+ invoke :setup
54
+ $control.upload_help(help_name)
55
+ end
56
+
57
+ desc "search {find_char}", "search FIND_CHAR"
58
+ def search(find_char)
59
+ invoke :setup
60
+ $control.search_help(find_char)
61
+ end
62
+ end
63
+
64
+ MyCLI.start(ARGV)
65
+
66
+
data/exe/my_help CHANGED
@@ -2,6 +2,8 @@
2
2
  require 'thor'
3
3
  require 'my_help'
4
4
  require 'colorize'
5
+ require 'command_line/global'
6
+
5
7
  class MyCLI < Thor
6
8
  desc('setup', 'set up the test database')
7
9
  def setup(*args)
@@ -59,6 +61,29 @@ class MyCLI < Thor
59
61
  invoke :setup
60
62
  $control.delete_help(help_name)
61
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
62
87
 
63
88
  # desc "search {find_char}", "search FIND_CHAR"
64
89
  # def search(find_char)
@@ -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'
15
+ @editor = 'code' #'emacs' #'vim' #default editor
16
16
  # @mini_account = File
17
17
  set_help_dir_if_not_exists
18
18
  load_conf
@@ -21,10 +21,10 @@ module MyHelp
21
21
  def set_editor(editor)
22
22
  @editor = editor
23
23
  file_name = '.my_help_conf.yml'
24
- # @conf_file = File.join(Dir.pwd, file_name)
25
24
  @conf_file = File.join(@local_help_dir, file_name)
26
25
  conf = {editor: editor}
27
26
  File.open(@conf_file, 'w'){|f| YAML.dump(conf, f)}
27
+ puts "set editor '#{@editor}'"
28
28
  end
29
29
 
30
30
  def load_conf
@@ -35,8 +35,9 @@ module MyHelp
35
35
  conf = YAML.load_file(@conf_file)
36
36
  @editor = conf[:editor]
37
37
  rescue => e
38
- p e
39
- set_editor('code')
38
+ puts e.to_s.red
39
+ puts 'make .my_help_conf.yml'.green
40
+ set_editor(@editor)
40
41
  end
41
42
  end
42
43
 
@@ -125,6 +126,7 @@ module MyHelp
125
126
  FileUtils::Verbose.cp(template,target_help)
126
127
  end
127
128
 
129
+ =begin
128
130
  def delete_help(file)
129
131
  file = File.join(@local_help_dir,file+'.org')
130
132
  print "Are you sure to delete "+file.blue+"?[Ynq] ".red
@@ -132,10 +134,27 @@ module MyHelp
132
134
  when 'Y'
133
135
  begin
134
136
  FileUtils.rm(file,:verbose=>true)
137
+ rescue => error
138
+ puts error.to_s.red
139
+ end
140
+ when 'n', 'q' ; exit
141
+ end
142
+ end
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
135
153
  rescue => error
136
154
  puts error.to_s.red
155
+ return 1
137
156
  end
138
- when 'n', 'q' ; exit
157
+ when 'n', 'q' ; return 0
139
158
  end
140
159
  end
141
160
 
@@ -1,3 +1,3 @@
1
1
  module MyHelp
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.5"
3
3
  end
data/my_help.gemspec CHANGED
@@ -17,9 +17,10 @@ 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')
20
+ # s.add_development_dependency('rdoc')
21
21
  s.add_development_dependency('rspec')
22
22
  s.add_runtime_dependency('thor')
23
23
  # s.add_runtime_dependency('gli','2.17.1')
24
24
  s.add_runtime_dependency "colorize"
25
+ s.add_runtime_dependency "command_line"
25
26
  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.3
4
+ version: 0.8.5
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: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2020-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdoc
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,13 +39,13 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
- type: :development
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: thor
56
+ name: colorize
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: colorize
70
+ name: command_line
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -105,6 +105,7 @@ files:
105
105
  - README.rdoc
106
106
  - README_en.org
107
107
  - Rakefile
108
+ - bin/my_help_thor
108
109
  - doc/MyHelp.html
109
110
  - doc/MyHelp/Control.html
110
111
  - doc/OrgToYaml.html
@@ -153,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  - !ruby/object:Gem::Version
154
155
  version: '0'
155
156
  requirements: []
156
- rubyforge_project:
157
- rubygems_version: 2.6.14
157
+ rubygems_version: 3.1.2
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: user building help