my_help 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/my_help/version.rb +1 -1
- data/lib/my_help.rb +1 -1
- data/lib/specific_help.rb +5 -5
- metadata +1 -8
- data/exe/t_h +0 -4
- data/exe/template_help +0 -4
- data/lib/my_help/#test.rb# +0 -26
- data/lib/my_help/.#test.rb +0 -1
- data/lib/my_help.rb~ +0 -155
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 014fbede934cc33fbfd7c6615044ff2f71d634dd
|
4
|
+
data.tar.gz: 2e39163bc019705f1a3d505f854afcb916dfe89b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50e25c3ed6cd53d978f3733a3cf9ba09839f4b3d6d60dd35acd2ffb9cd472dcc21279dee06ac77401367c40a036b0e956dfcb92c748e0df52cb4cfcf0d2302bf
|
7
|
+
data.tar.gz: 6339ebd3a21123d9690613bdc960c7d1df18b9700b81887b15fc2a973bfdb804155f925b8ee34e7141c81f3dd672085d338c14c9a83b1f6386609fa732980b75
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ task :clean_exe do
|
|
19
19
|
files = Dir.entries('exe')
|
20
20
|
files.each{|file|
|
21
21
|
next if ["my_help",".","..",".DS_Store",
|
22
|
-
"emacs_help","e_h"
|
22
|
+
"emacs_help","e_h"].include?(file)
|
23
23
|
FileUtils.rm(File.join('./exe',file), :verbose=>true)
|
24
24
|
}
|
25
25
|
end
|
data/lib/my_help/version.rb
CHANGED
data/lib/my_help.rb
CHANGED
@@ -110,7 +110,7 @@ module MyHelp
|
|
110
110
|
def clean_exe
|
111
111
|
local_help_entries.each{|file|
|
112
112
|
next if file.include?('emacs_help') or file.include?('e_h')
|
113
|
-
next if file.include?('template_help') or file.include?('t_h')
|
113
|
+
# next if file.include?('template_help') or file.include?('t_h')
|
114
114
|
[file, short_name(file)].each{|name|
|
115
115
|
p target=File.join('exe',name)
|
116
116
|
FileUtils::Verbose.rm(target)
|
data/lib/specific_help.rb
CHANGED
@@ -13,7 +13,7 @@ module SpecificHelp
|
|
13
13
|
def initialize(file,argv=[])
|
14
14
|
@source_file = file
|
15
15
|
@help_cont = YAML.load(File.read(file))
|
16
|
-
@help_cont[:head].each{|line| print line.chomp+"\n" }
|
16
|
+
@help_cont[:head].each{|line| print line.chomp+"\n" } if @help_cont[:head] != nil
|
17
17
|
@help_cont[:license].each{|line| print "#{line.chomp}\n" } if @help_cont[:license] != nil
|
18
18
|
@argv = argv
|
19
19
|
end
|
@@ -21,9 +21,9 @@ module SpecificHelp
|
|
21
21
|
def execute
|
22
22
|
if @argv.size==0
|
23
23
|
if @source_file.include?('todo')
|
24
|
-
@argv << '--all'
|
24
|
+
@argv << '--all'
|
25
25
|
else
|
26
|
-
@argv << '--help'
|
26
|
+
@argv << '--help'
|
27
27
|
end
|
28
28
|
end
|
29
29
|
command_parser = OptionParser.new do |opt|
|
@@ -111,7 +111,7 @@ module SpecificHelp
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def hiki_disp(lines)
|
114
|
-
lines.each{|line| puts "*#{line}"}
|
114
|
+
lines.each{|line| puts "*#{line}"} if lines != nil
|
115
115
|
end
|
116
116
|
|
117
117
|
def disp_help(key_word)
|
@@ -123,7 +123,7 @@ module SpecificHelp
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def disp(lines)
|
126
|
-
lines.each{|line| puts " *#{line}"}
|
126
|
+
lines.each{|line| puts " *#{line}"} if lines != nil
|
127
127
|
end
|
128
128
|
|
129
129
|
def print_separater
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_help
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeto R. Nishitani
|
@@ -129,8 +129,6 @@ executables:
|
|
129
129
|
- e_h
|
130
130
|
- emacs_help
|
131
131
|
- my_help
|
132
|
-
- t_h
|
133
|
-
- template_help
|
134
132
|
extensions: []
|
135
133
|
extra_rdoc_files: []
|
136
134
|
files:
|
@@ -148,8 +146,6 @@ files:
|
|
148
146
|
- exe/e_h
|
149
147
|
- exe/emacs_help
|
150
148
|
- exe/my_help
|
151
|
-
- exe/t_h
|
152
|
-
- exe/template_help
|
153
149
|
- hikis/README_en.hiki
|
154
150
|
- hikis/README_ja.hiki
|
155
151
|
- hikis/emacs_help.hiki
|
@@ -159,9 +155,6 @@ files:
|
|
159
155
|
- lib/daddygongon/template_help
|
160
156
|
- lib/emacs_help.rb
|
161
157
|
- lib/my_help.rb
|
162
|
-
- lib/my_help.rb~
|
163
|
-
- lib/my_help/#test.rb#
|
164
|
-
- lib/my_help/.#test.rb
|
165
158
|
- lib/my_help/test.rb
|
166
159
|
- lib/my_help/version.rb
|
167
160
|
- lib/specific_help.rb
|
data/exe/t_h
DELETED
data/exe/template_help
DELETED
data/lib/my_help/#test.rb#
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'yaml'
|
3
|
-
require 'pp'
|
4
|
-
yaml =<<EOF
|
5
|
-
:file:
|
6
|
-
:opts:
|
7
|
-
:short: "-f"
|
8
|
-
:long: "--��Ւ��������"
|
9
|
-
:desc: File������
|
10
|
-
:title: ��Ւ�������������file
|
11
|
-
:cont:
|
12
|
-
- c-x c-f, Find file, ��Ւ�������뒤���
|
13
|
-
- c-x c-s, Save file, ��Ւ�������뒤��ݒ¸
|
14
|
-
- c-x c-w, Write file NAME, ��Ւ�������뒤��̒̾��ǒ�������
|
15
|
-
EOF
|
16
|
-
pp data=YAML.load(yaml)
|
17
|
-
print YAML.dump(data)
|
18
|
-
|
19
|
-
|
20
|
-
data0={:new_item=>
|
21
|
-
{:opts=>{:short=>"-n", :long=>"--new_item", :desc=>"new item"},
|
22
|
-
:title=>"new_item",
|
23
|
-
:cont=>
|
24
|
-
["new cont"]}}
|
25
|
-
|
26
|
-
print YAML.dump(data0)
|
data/lib/my_help/.#test.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
bob@bob.local.71520
|
data/lib/my_help.rb~
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require "optparse"
|
3
|
-
require "yaml"
|
4
|
-
require "fileutils"
|
5
|
-
#require "emacs_help/version"
|
6
|
-
require "my_help/version"
|
7
|
-
require "systemu"
|
8
|
-
#require "emacs_help"
|
9
|
-
|
10
|
-
module MyHelp
|
11
|
-
class Command
|
12
|
-
|
13
|
-
def self.run(argv=[])
|
14
|
-
new(argv).execute
|
15
|
-
end
|
16
|
-
|
17
|
-
def initialize(argv=[])
|
18
|
-
@argv = argv
|
19
|
-
@default_help_dir = File.expand_path("../../lib/daddygongon", __FILE__)
|
20
|
-
@local_help_dir = File.join(ENV['HOME'],'.my_help')
|
21
|
-
set_help_dir_if_not_exists
|
22
|
-
end
|
23
|
-
|
24
|
-
def set_help_dir_if_not_exists
|
25
|
-
return if File::exists?(@local_help_dir)
|
26
|
-
FileUtils.mkdir_p(@local_help_dir, :verbose=>true)
|
27
|
-
Dir.entries(@default_help_dir).each{|file|
|
28
|
-
file_path=File.join(@local_help_dir,file)
|
29
|
-
next if File::exists?(file_path)
|
30
|
-
FileUtils.cp((File.join(@default_help_dir,file)),@local_help_dir,:verbose=>true)
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
def execute
|
35
|
-
@argv << '--help' if @argv.size==0
|
36
|
-
command_parser = OptionParser.new do |opt|
|
37
|
-
opt.on('-v', '--version','show program Version.') { |v|
|
38
|
-
opt.version = MyHelp::VERSION
|
39
|
-
puts opt.ver
|
40
|
-
}
|
41
|
-
opt.on('-l', '--list', 'list specific helps'){list_helps}
|
42
|
-
opt.on('-e NAME', '--edit NAME', 'edit NAME help(eg test_help)'){|file| edit_help(file)}
|
43
|
-
opt.on('-i NAME', '--init NAME', 'initialize NAME help(eg test_help).'){|file| init_help(file)}
|
44
|
-
opt.on('-m', '--make', 'make executables for all helps.'){make_help}
|
45
|
-
opt.on('-c', '--clean', 'clean up exe dir.'){clean_exe}
|
46
|
-
opt.on('--install_local','install local after edit helps'){install_local}
|
47
|
-
opt.on('--delete NAME','delete NAME help'){|file| delete_help(file)}
|
48
|
-
end
|
49
|
-
begin
|
50
|
-
command_parser.parse!(@argv)
|
51
|
-
rescue=> eval
|
52
|
-
p eval
|
53
|
-
end
|
54
|
-
exit
|
55
|
-
end
|
56
|
-
|
57
|
-
def delete_help(file)
|
58
|
-
del_files=[]
|
59
|
-
del_files << File.join(@local_help_dir,file)
|
60
|
-
exe_dir=File.join(File.expand_path('../..',@default_help_dir),'exe')
|
61
|
-
del_files << File.join(exe_dir,file)
|
62
|
-
p del_files << File.join(exe_dir,short_name(file))
|
63
|
-
print "Are you sure to delete these files?[yes]"
|
64
|
-
if gets.chomp=='yes' then
|
65
|
-
del_files.each{|file| FileUtils.rm(file,:verbose=>true)}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
USER_INST_DIR="USER INSTALLATION DIRECTORY:"
|
70
|
-
INST_DIR="INSTALLATION DIRECTORY:"
|
71
|
-
def install_local
|
72
|
-
Dir.chdir(File.expand_path('../..',@default_help_dir))
|
73
|
-
p pwd_dir = Dir.pwd
|
74
|
-
# check that the working dir should not the gem installed dir,
|
75
|
-
# which destroys itself.
|
76
|
-
status, stdout, stderr = systemu "gem env|grep '#{USER_INST_DIR}'"
|
77
|
-
if stdout==""
|
78
|
-
status, stdout, stderr = systemu "gem env|grep '#{INST_DIR}'"
|
79
|
-
end
|
80
|
-
p system_inst_dir = stdout.split(': ')[1].chomp
|
81
|
-
if pwd_dir == system_inst_dir
|
82
|
-
puts "Download my_help from github, and using bundle for edit helps\n"
|
83
|
-
puts "Read README in detail.\n"
|
84
|
-
exit
|
85
|
-
end
|
86
|
-
system "git add -A"
|
87
|
-
system "git commit -m 'update exe dirs'"
|
88
|
-
system "Rake install:local"
|
89
|
-
end
|
90
|
-
|
91
|
-
def short_name(file)
|
92
|
-
file_name=file.split('_')
|
93
|
-
return file_name[0][0]+"_"+file_name[1][0]
|
94
|
-
end
|
95
|
-
|
96
|
-
def make_help
|
97
|
-
local_help_entries.each{|file|
|
98
|
-
exe_cont="#!/usr/bin/env ruby\nrequire 'specific_help'\n"
|
99
|
-
exe_cont << "help_file = File.join(ENV['HOME'],'.my_help','#{file}')\n"
|
100
|
-
exe_cont << "SpecificHelp::Command.run(help_file, ARGV)\n"
|
101
|
-
[file, short_name(file)].each{|name|
|
102
|
-
p target=File.join('exe',name)
|
103
|
-
File.open(target,'w'){|file| file.print exe_cont}
|
104
|
-
FileUtils.chmod('a+x', target, :verbose => true)
|
105
|
-
}
|
106
|
-
}
|
107
|
-
install_local
|
108
|
-
end
|
109
|
-
|
110
|
-
def clean_exe
|
111
|
-
local_help_entries.each{|file|
|
112
|
-
next if file.include?('emacs_help') or file.include?('e_h')
|
113
|
-
next if file.include?('template_help') or file.include?('t_h')
|
114
|
-
[file, short_name(file)].each{|name|
|
115
|
-
p target=File.join('exe',name)
|
116
|
-
FileUtils::Verbose.rm(target)
|
117
|
-
}
|
118
|
-
}
|
119
|
-
end
|
120
|
-
|
121
|
-
def init_help(file)
|
122
|
-
p target_help=File.join(@local_help_dir,file)
|
123
|
-
if File::exists?(target_help)
|
124
|
-
puts "File exists. rm it first to initialize it."
|
125
|
-
exit
|
126
|
-
end
|
127
|
-
p template = File.join(@default_help_dir,'template_help')
|
128
|
-
FileUtils::Verbose.cp(template,target_help)
|
129
|
-
end
|
130
|
-
|
131
|
-
def edit_help(file)
|
132
|
-
p target_help=File.join(@local_help_dir,file)
|
133
|
-
system "emacs #{target_help}"
|
134
|
-
end
|
135
|
-
|
136
|
-
def local_help_entries
|
137
|
-
entries= []
|
138
|
-
Dir.entries(@local_help_dir).each{|file|
|
139
|
-
next unless file.include?('_')
|
140
|
-
next if file[0]=='#' or file[-1]=='~'
|
141
|
-
entries << file
|
142
|
-
}
|
143
|
-
return entries
|
144
|
-
end
|
145
|
-
|
146
|
-
def list_helps
|
147
|
-
print "Specific help file:\n"
|
148
|
-
local_help_entries.each{|file|
|
149
|
-
file_path=File.join(@local_help_dir,file)
|
150
|
-
help = YAML.load(File.read(file_path))
|
151
|
-
print " #{file}\t:#{help[:head][0]}\n"
|
152
|
-
}
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|