my_help 0.5.2 → 0.6.0

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
  SHA1:
3
- metadata.gz: 88d61f06babc7a337d682b36c7a5247574376af2
4
- data.tar.gz: 81166728a653450f8af97f33141ccacf8fa0f13b
3
+ metadata.gz: 839a696209b23c64ee3e55a4c2af4efa3079df43
4
+ data.tar.gz: 3a23e3580942ed5eba481be1df105bc0c806cb41
5
5
  SHA512:
6
- metadata.gz: 4c68fc3a49c482cff6f780e831a5e0539ea88c3feaca6133a6a60490a094dadd752d91cbd21ddf2cb6e68213d3238802a6e0c3fb5fc14791afb0e8925983a9aa
7
- data.tar.gz: 0ea1fc9af2aff6a01e9f7ae4abad906057df950cefc897cc77da248ece179947b99cebea3f4d90e984e7f5b647eae19745ab4a2d226b2b0091c99f6bdb912520
6
+ metadata.gz: df1c06928b11be234f42fab1e875043547eeaa8db7f5ffa6c2979ac557f72fc826b656b3a4728de0b250ff44d3348d564aef4a826478157b093440fa29082b45
7
+ data.tar.gz: 17a2637f6727e5bba3e9313a49944bda1b9f4e930b3a9710c39a3b3e34d382f101fb5ba6de62d1144b989a015b2be173da5ea49f0deabec1acac045f2266e01f
@@ -1 +1 @@
1
- 2.4.3
1
+ system
data/README.org CHANGED
@@ -471,6 +471,9 @@ Removing template_help Successfully uninstalled my_help-0.3.2 ```
471
471
 
472
472
  clean_exeは,githubへuploadする時に,開発者個人のexeファイルをrmして整頓する.
473
473
  * development memo
474
+ ** <2018-03-14 Wed>全てをorgへ変更.
475
+ どこにメモを置いたか忘れた.
476
+
474
477
  今は,元データのフォーマットとしてorgとyamlが混ざっている.
475
478
  編集に慣れてくると,orgのほうが柔軟性があって良さそう.
476
479
  codeはそのためグタグタ.そのうちに治るでしょう.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require "bundler/gem_tasks"
3
- require "rspec/core/rake_task"
3
+ #require "rspec/core/rake_task"
4
4
  require 'fileutils'
5
5
  require 'open3'
6
6
 
@@ -81,7 +81,7 @@ task :clean_exe do
81
81
  files = Dir.entries('exe')
82
82
  files.each{|file|
83
83
  next if ["my_help",".","..",".DS_Store",
84
- "emacs_help","e_h","my_todo"].include?(file)
84
+ "emacs_help","e_h","my_todo","org_help"].include?(file)
85
85
  FileUtils.rm(File.join('./exe',file), :verbose=>true)
86
86
  }
87
87
  end
data/exe/e_h CHANGED
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'specific_help'
3
- if ENV['LANG'] == "C" then
4
- help_file = File.join(ENV['HOME'],'.my_help','emacs_help_e.org')
5
- else
6
- help_file = File.join(ENV['HOME'],'.my_help','emacs_help.org')
7
- end
3
+ help_file = File.join(ENV['HOME'],'.my_help','emacs_help.org')
8
4
  SpecificHelp::Command.run(help_file, ARGV)
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'specific_help'
3
+ help_file = File.join(ENV['HOME'],'.my_help','my_todo.org')
4
+ SpecificHelp::Command.run(help_file, ARGV)
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'specific_help'
3
+ help_file = File.join(ENV['HOME'],'.my_help','org_help.org')
4
+ SpecificHelp::Command.run(help_file, ARGV)
@@ -0,0 +1 @@
1
+ lib/bob@ShigetonoMacBook.local.98720
@@ -14,8 +14,9 @@ class OrgToYaml
14
14
 
15
15
  def make_options(line)
16
16
  head, desc = line.split(':')
17
- desc ||= head
18
- { short: "-#{head[0]}", long: "--#{head}", desc: desc.to_s }
17
+ desc ||= head.to_s
18
+ short = "-#{head[0]}"
19
+ { short: short, long: "--#{head}", desc: desc }
19
20
  end
20
21
 
21
22
  def next_cont(head)
@@ -1,3 +1,3 @@
1
1
  module MyHelp
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
- require "optparse"
3
2
  require "yaml"
4
3
 
5
4
  class YmlToOrg
@@ -7,26 +6,25 @@ class YmlToOrg
7
6
 
8
7
  def initialize(file)
9
8
  @contents = ''
10
- yml_to_org(YAML.load(File.read(file)))
11
- end
12
-
13
- def head_and_licence(key, cont)
14
- cont.each { |line| @contents << "- #{line}\n" }
9
+ cont = ''
10
+ if file.kind_of?(String)
11
+ cont = YAML.load(File.read(file))
12
+ elsif file.kind_of?(Hash)
13
+ cont = file
14
+ end
15
+ yml_to_org(cont)
15
16
  end
16
17
 
17
18
  def plain_element(key, cont)
18
- cont[:cont].each { |line| @contents << "- #{line}\n" }
19
+ @contents << cont[:cont].join("\n")+"\n" if cont.include?(:cont)
19
20
  end
20
21
 
21
22
  def yml_to_org(help_cont)
23
+ pp help_cont
22
24
  @contents << "#+STARTUP: indent nolineimages\n" # nofold
23
25
  help_cont.each_pair do |key, cont|
24
26
  @contents << "* #{key.to_s}\n"
25
- if key == :head or key == :license
26
- head_and_licence(key, cont)
27
- else
28
- plain_element(key, cont)
29
- end
27
+ plain_element(key, cont)
30
28
  end
31
29
  end
32
30
  end
@@ -3,9 +3,9 @@ require "optparse"
3
3
  require "yaml"
4
4
  require "my_help/version"
5
5
  require 'fileutils'
6
- require "coderay"
7
6
  require 'colorize'
8
7
  require 'my_help/org2yml'
8
+ require 'my_help/yml2org'
9
9
 
10
10
  module SpecificHelp
11
11
  class Command
@@ -16,27 +16,10 @@ module SpecificHelp
16
16
 
17
17
  def initialize(file,argv=[])
18
18
  @source_file = file
19
- case File.extname(file)
20
- when '.yml'
21
- @help_cont = YAML.load(File.read(file))
22
- @help_cont[:head].each{|line| print line.chomp+"\n" } if @help_cont[:head] != nil
23
- @help_cont[:license].each{|line| print "#{line.chomp}\n" } if @help_cont[:license] != nil
24
- when '.org'
25
- @help_cont = OrgToYaml.new(file).help_cont
26
- [:head,:license].each do |sym|
27
- target = @help_cont[sym]
28
- if target != nil
29
- if target[:cont].kind_of?(Array)
30
- target[:cont].each{|line| print line.chomp+"\n" }
31
- else
32
- print target[:cont]
33
- end
34
- else
35
- @help_cont[sym] = sym.to_s
36
- end
37
- end
38
- else
39
- puts "Not apply on #{file}"
19
+ @help_cont = OrgToYaml.new(file).help_cont
20
+ [:head,:license].each do |sym|
21
+ target = @help_cont[sym]
22
+ print target[:cont] if target != nil
40
23
  end
41
24
  @argv = argv
42
25
  end
@@ -60,7 +43,6 @@ module SpecificHelp
60
43
  opt.on(opts[:short],opts[:long],opts[:desc]) {disp_help(key)}
61
44
  }
62
45
  opt.on('--edit','edit help contents'){edit_help}
63
- opt.on('--to_hiki','convert to hikidoc format'){to_hiki}
64
46
  opt.on('--all','display all helps'){all_help}
65
47
  opt.on('--store [item]','store [item] in backfile'){|item| store(item)}
66
48
  opt.on('--remove [item]','remove [item] and store in backfile'){|item| remove(item) }
@@ -126,9 +108,9 @@ module SpecificHelp
126
108
  def add(item='new_item')
127
109
  print "Trying to add #{item}\n"
128
110
  new_item={:opts=>{:short=>'-'+item[0], :long=>'--'+item, :desc=>item},
129
- :title=>item, :cont=> [item]}
111
+ :title=>item, :cont=> item}
130
112
  @help_cont[item.to_sym]=new_item
131
- File.open(@source_file,'w'){|file| file.print YAML.dump(@help_cont)}
113
+ File.open(@source_file,'w'){|f| f.print YmlToOrg.new(@help_cont).contents}
132
114
  end
133
115
 
134
116
  def remove(item)
@@ -139,7 +121,7 @@ module SpecificHelp
139
121
  end
140
122
 
141
123
  def edit_help
142
- p help_file =@source_file
124
+ help_file =@source_file
143
125
  begin
144
126
  p command= "emacs #{help_file}"
145
127
  exec command
@@ -147,20 +129,9 @@ module SpecificHelp
147
129
  print "\nOption edit is not executable on windows. \n"
148
130
  print "Type the following shell command;\n\n"
149
131
  print "emacs /home/#{ENV['USER']}/.my_help/#{File.basename(@source_file)}\n\n"
150
- print "M-x ruby-mode should be good for edit.\n"
151
132
  end
152
133
  end
153
134
 
154
- def to_hiki
155
- @help_cont.each_pair{|key,val|
156
- if key==:head or key==:license
157
- hiki_disp(val)
158
- else
159
- hiki_help(key)
160
- end
161
- }
162
- end
163
-
164
135
  def all_help
165
136
  @help_cont.each_pair{|key,val|
166
137
  if key==:head or key==:license
@@ -176,16 +147,6 @@ module SpecificHelp
176
147
  }
177
148
  end
178
149
 
179
- def hiki_help(key_word)
180
- items =@help_cont[key_word]
181
- puts "\n!!"+items[:title]+"\n"
182
- hiki_disp(items[:cont])
183
- end
184
-
185
- def hiki_disp(lines)
186
- lines.each{|line| puts "* #{line}"} if lines != nil
187
- end
188
-
189
150
  def disp_help(key_word)
190
151
  print_separater
191
152
  items =@help_cont[key_word]
@@ -205,5 +166,6 @@ module SpecificHelp
205
166
  def print_separater
206
167
  print "---\n"
207
168
  end
169
+
208
170
  end
209
171
  end
@@ -0,0 +1,61 @@
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
+ - #+BEGIN_QUOTE -- #+END_QUOTE
17
+ - #+BEGIN_SRC bash -- #+END_SRC
18
+ - #+TITLE: 格子欠陥について最近の研究から
19
+ - #+AUTHOR: 関西学院大学・理工学部・情報科学科 西谷滋人 2017
20
+ * key_bind
21
+ - tabでtoggle
22
+ - shift-tabで全部に対するtoggle
23
+ - shift-矢印でkeyを切り替え
24
+ - M-shift-<left, right>アウトラインのレベルをツリーごと移動
25
+ - beamer出力はc-c c-eでlbを選択
26
+ * markdown
27
+ - in emacs, M-x org-md-export-as-markdown
28
+ - pandoc -f markdown -t org -o tmp.md sample.org
29
+ - 行の折り返し,M-x toggle-truncate-lines
30
+ * format
31
+ - #+OPTIONS: ^:{}でsub, superを抑制.
32
+ * list
33
+ - 項目- 子項目1
34
+ - 番号付き1. 2.
35
+ - 名前付き - 名前1 :: 内容1
36
+ * link
37
+ - [[file:./tmp/tmp.txt][Link to file]]
38
+ - to edit, c-c c-l
39
+ - to open, c-c c-o
40
+ * latex
41
+ - latex出力はc-c c-eでllを選択
42
+ - 日本語と数式が混じる時には,$の前後に半角スペースを入れる
43
+ - [[https://www-he.scphys.kyoto-u.ac.jp/member/shotakaha/dokuwiki/doku.php?id=toolbox:emacs:org:export:latex:start~]]
44
+ - https://orgmode.org/worg/org-tutorials/org-latex-export.html
45
+ * todo
46
+ - c-c c-tでno_head->TODO->DONEをloop
47
+ - m-x agenda-modeでschedule操作可能コマンドを表示
48
+ * verbose
49
+ - ': 'を頭に
50
+ - #+BEGIN_EXAMPLE...#+END_EXAMPLE
51
+ * date_and_time
52
+ - c-c .でカレンダーと日付表示<2018-03-14 Wed>
53
+ - +7とか-1を入力してreturnするとその日付が出力
54
+ - c-u c-c . で日付と時間の入力<2018-03-14 Wed 12:38>こんな感じ
55
+ * agenda
56
+ - (setq org-agenda-files (list "~/org/work.org"
57
+ "~/org/school.org"
58
+ "~/org/home.org"))
59
+ - C-c a t to enter the global todo list.
60
+ * move
61
+ - c-c c-u 上位のlevelへ
@@ -29,13 +29,11 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency "bundler", "~> 1.11"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
- spec.add_development_dependency "minitest", "~> 5.0"
33
- spec.add_development_dependency "yard"
34
- spec.add_development_dependency "hiki2md"
35
- spec.add_development_dependency "rspec", "~> 3.0"
36
- spec.add_development_dependency "aruba", '~> 1.3.20'
32
+ # spec.add_development_dependency "minitest", "~> 5.0"
33
+ # spec.add_development_dependency "yard"
34
+ # spec.add_development_dependency "hiki2md"
35
+ # spec.add_development_dependency "rspec", "~> 3.0"
36
+ # spec.add_development_dependency "aruba", '~> 1.3.20'
37
37
  spec.add_dependency "systemu"
38
- spec.add_dependency "coderay"
39
38
  spec.add_dependency "colorize"
40
-
41
39
  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.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shigeto R. Nishitani
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-13 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,76 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.0'
55
- - !ruby/object:Gem::Dependency
56
- name: yard
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: hiki2md
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.0'
97
- - !ruby/object:Gem::Dependency
98
- name: aruba
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 1.3.20
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 1.3.20
111
41
  - !ruby/object:Gem::Dependency
112
42
  name: systemu
113
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +52,6 @@ dependencies:
122
52
  - - ">="
123
53
  - !ruby/object:Gem::Version
124
54
  version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: coderay
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
55
  - !ruby/object:Gem::Dependency
140
56
  name: colorize
141
57
  requirement: !ruby/object:Gem::Requirement
@@ -156,8 +72,9 @@ email:
156
72
  executables:
157
73
  - e_h
158
74
  - emacs_help
159
- - m_h
160
75
  - my_help
76
+ - my_todo
77
+ - org_help
161
78
  extensions: []
162
79
  extra_rdoc_files: []
163
80
  files:
@@ -559,8 +476,10 @@ files:
559
476
  - docs/yagi/thor_task.ipynb
560
477
  - exe/e_h
561
478
  - exe/emacs_help
562
- - exe/m_h
563
479
  - exe/my_help
480
+ - exe/my_todo
481
+ - exe/org_help
482
+ - lib/.#my_help.rb
564
483
  - lib/emacs_help.rb
565
484
  - lib/my_help.rb
566
485
  - lib/my_help/org2yml.rb
@@ -575,6 +494,7 @@ files:
575
494
  - lib/specific_help_thor.rb
576
495
  - lib/templates/emacs_help.org
577
496
  - lib/templates/my_todo.org
497
+ - lib/templates/org_help.org
578
498
  - lib/templates/template_help.org
579
499
  - lib/todo.rb
580
500
  - make_docker.sh
data/exe/m_h DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'specific_help'
3
- if ENV['LANG'] == "C" then
4
- help_file = File.join(ENV['HOME'],'.my_help','md_help_e.org')
5
- else
6
- help_file = File.join(ENV['HOME'],'.my_help','md_help.org')
7
- end
8
- SpecificHelp::Command.run(help_file, ARGV)