konjac 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/konjac.gemspec +1 -0
- data/lib/bash/install_vim +5 -0
- data/lib/bash/update_vim +3 -0
- data/lib/konjac/cli.rb +24 -2
- data/lib/konjac/installer.rb +102 -0
- data/lib/konjac/version.rb +1 -1
- data/lib/konjac.rb +2 -0
- data/lib/locales/en.yml +2 -0
- data/lib/locales/ja.yml +2 -0
- metadata +40 -26
data/README.rdoc
CHANGED
@@ -158,6 +158,11 @@ Should be simple enough to generate yourself:
|
|
158
158
|
mv doc/rdoc/* .
|
159
159
|
rm -rf doc
|
160
160
|
|
161
|
+
== Supplementary Stuff
|
162
|
+
|
163
|
+
{Vim integration}[https://github.com/brymck/konjac_vim]
|
164
|
+
{My dictionaries}[https://github.com/brymck/konjac_yml]
|
165
|
+
|
161
166
|
== Name
|
162
167
|
|
163
168
|
<em>Hon'yaku</em> means "translation" in Japanese. This utility relies on a
|
data/konjac.gemspec
CHANGED
data/lib/bash/update_vim
ADDED
data/lib/konjac/cli.rb
CHANGED
@@ -12,8 +12,8 @@ module Konjac
|
|
12
12
|
|
13
13
|
class << self
|
14
14
|
# A list of valid subcommands
|
15
|
-
SUB_COMMANDS = ["add", "export", "import", "
|
16
|
-
"translate", "use"]
|
15
|
+
SUB_COMMANDS = ["add", "export", "import", "install", "language", "list",
|
16
|
+
"suggest", "translate", "update", "use"]
|
17
17
|
|
18
18
|
# The minimum amount by which to offset subcommands in standard display.
|
19
19
|
# Should be equal to the length of the longest top-level flag (e.g. the
|
@@ -88,6 +88,17 @@ eos
|
|
88
88
|
opt :help, I18n.t(:help, :scope => :opts)
|
89
89
|
end
|
90
90
|
Office.import_tags ARGV, opts
|
91
|
+
when "install"
|
92
|
+
Trollop::options do
|
93
|
+
banner sc_banner % I18n.t(:word_arg)
|
94
|
+
opt :help, I18n.t(:help, :scope => :opts)
|
95
|
+
end
|
96
|
+
case ARGV[0]
|
97
|
+
when "dictionaries", "dict", "dictionary"
|
98
|
+
Installer.install_dictionaries
|
99
|
+
when "vim"
|
100
|
+
Installer.install_vim
|
101
|
+
end
|
91
102
|
when "language"
|
92
103
|
Trollop::options do
|
93
104
|
banner sc_banner % I18n.t(:word_arg)
|
@@ -135,6 +146,17 @@ eos
|
|
135
146
|
end
|
136
147
|
result = translate(ARGV, opts)
|
137
148
|
puts result if opts[:word]
|
149
|
+
when "update"
|
150
|
+
Trollop::options do
|
151
|
+
banner sc_banner % I18n.t(:word_arg)
|
152
|
+
opt :help, I18n.t(:help, :scope => :opts)
|
153
|
+
end
|
154
|
+
case ARGV[0]
|
155
|
+
when "dictionaries", "dict", "dictionary"
|
156
|
+
Installer.update_dictionaries
|
157
|
+
when "vim"
|
158
|
+
Installer.update_vim
|
159
|
+
end
|
138
160
|
when "use"
|
139
161
|
Trollop::options do
|
140
162
|
banner sc_banner % I18n.t(:word_arg)
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module Konjac
|
3
|
+
# A class to help with installing supplementary tools for Konjac
|
4
|
+
module Installer
|
5
|
+
VIM_GIT = "git://github.com/brymck/konjac_vim.git"
|
6
|
+
YML_GIT = "git://github.com/brymck/konjac_yml.git"
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# Install the supplementary {Vim plugin}[https://github.com/brymck/konjac_vim]
|
10
|
+
def install_vim
|
11
|
+
if has_pathogen?
|
12
|
+
return update_vim if vim_installed?
|
13
|
+
|
14
|
+
system File.join(File.dirname(__FILE__), "..", "bash", "install_vim")
|
15
|
+
else
|
16
|
+
dir = Dir.mktmpdir
|
17
|
+
begin
|
18
|
+
ensure
|
19
|
+
FileUtils.remove_entry_secure dir
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Install the supplementary {dictionaries}[https://github.com/brymck/konjac_yml]
|
25
|
+
def install_dictionaries
|
26
|
+
if dictionaries_installed?
|
27
|
+
update_dictionaries
|
28
|
+
else
|
29
|
+
Dir.chdir(konjac_home) do
|
30
|
+
g = Git.clone(YML_GIT, ".dictionaries", :name => ".dictionaries",
|
31
|
+
:path => konjac_home)
|
32
|
+
g.chdir do
|
33
|
+
FileUtils.cp_r Dir.glob("*.yml"), konjac_home
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Update the supplementary {Vim plugin}[https://github.com/brymck/konjac_vim]
|
40
|
+
def update_vim
|
41
|
+
if has_pathogen? && vim_installed?
|
42
|
+
system File.join(File.dirname(__FILE__), "..", "bash", "update_vim")
|
43
|
+
else
|
44
|
+
install_vim
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Update the supplementary {dictionaries}[https://github.com/brymck/konjac_yml]
|
49
|
+
def update_dictionaries
|
50
|
+
if dictionaries_installed?
|
51
|
+
g = Git.open(File.join(konjac_home, ".dictionaries"))
|
52
|
+
g.pull
|
53
|
+
g.chdir do
|
54
|
+
FileUtils.cp_r Dir.glob("*.yml"), konjac_home
|
55
|
+
end
|
56
|
+
else
|
57
|
+
install_dictionaries
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Update everything
|
62
|
+
def update
|
63
|
+
update_dictionaries
|
64
|
+
update_vim
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
# Determines the location of Vim's home directory. This is currently
|
70
|
+
# pretty naïve, but I'll build in functionality later to allow for
|
71
|
+
# customized home directories.
|
72
|
+
def vim_home
|
73
|
+
@vim_home ||= File.join(File.expand_path(Dir.home),
|
74
|
+
RUBY_PLATFORM =~ /mswin32/ ? "vimfiles" : ".vim")
|
75
|
+
end
|
76
|
+
|
77
|
+
# The path for Konjac's configuration and dictionary files
|
78
|
+
def konjac_home
|
79
|
+
@konjac_home ||= File.join(File.expand_path(Dir.home), ".konjac")
|
80
|
+
end
|
81
|
+
|
82
|
+
# Whether the user has {Pathogen}[http://www.vim.org/scripts/script.php?script_id=2332]
|
83
|
+
def has_pathogen?
|
84
|
+
File.exists? File.join(vim_home, "autoload", "pathogen.vim")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Whether the user has the Vim plugin installed
|
88
|
+
def vim_installed?
|
89
|
+
if has_pathogen?
|
90
|
+
File.exist? File.join(vim_home, "bundle", "konjac_vim")
|
91
|
+
else
|
92
|
+
File.exist? File.join(vim_home, "plugin", "konjac.vim")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Whether the user has the supplementary dictionaries installed
|
97
|
+
def dictionaries_installed?
|
98
|
+
File.exist? File.join(konjac_home, ".dictionaries", ".git")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/lib/konjac/version.rb
CHANGED
data/lib/konjac.rb
CHANGED
@@ -2,6 +2,7 @@ require "konjac/version"
|
|
2
2
|
require "konjac/exception"
|
3
3
|
autoload :Amatch, "amatch"
|
4
4
|
autoload :FileUtils, "fileutils"
|
5
|
+
autoload :Git, "git"
|
5
6
|
autoload :HighLine, "highline/system_extensions"
|
6
7
|
autoload :I18n, "i18n"
|
7
8
|
autoload :Nokogiri, "nokogiri"
|
@@ -14,6 +15,7 @@ module Konjac
|
|
14
15
|
autoload :CLI, "konjac/cli"
|
15
16
|
autoload :Config, "konjac/config"
|
16
17
|
autoload :Dictionary, "konjac/dictionary"
|
18
|
+
autoload :Installer, "konjac/installer"
|
17
19
|
autoload :Language, "konjac/language"
|
18
20
|
autoload :Office, "konjac/office"
|
19
21
|
autoload :Suggestor, "konjac/suggestor"
|
data/lib/locales/en.yml
CHANGED
@@ -18,12 +18,14 @@ en:
|
|
18
18
|
force: Automatically overwrite files
|
19
19
|
from: The language from which to translate
|
20
20
|
help: Show this message
|
21
|
+
install: Install supplementary scripts
|
21
22
|
original: The untranslated original text
|
22
23
|
output: The name of the output file
|
23
24
|
prompt: Prompt before overwriting a file
|
24
25
|
quiet: Suppress error messages
|
25
26
|
to: The language into which to translate
|
26
27
|
translation: The translated text
|
28
|
+
update: Update supplementary scripts
|
27
29
|
using: The names of dictionaries to use
|
28
30
|
use_cache: Use cached dictionary
|
29
31
|
version: Print version and exit
|
data/lib/locales/ja.yml
CHANGED
@@ -18,12 +18,14 @@ ja:
|
|
18
18
|
force: 自動にファイルを上書きする
|
19
19
|
from: ソース言語
|
20
20
|
help: このメッセージを表示する
|
21
|
+
install: スクリプトなどをインストールする
|
21
22
|
original: ソーステキスト
|
22
23
|
output: 出力ファイル名
|
23
24
|
prompt: ファイルをする場合に警告する
|
24
25
|
quiet: エラーメッセージを抑止する
|
25
26
|
to: ターゲット言語
|
26
27
|
translation: ターゲットテキスト
|
28
|
+
update: スクリプトなどをアップデートする
|
27
29
|
using: 使用したい辞書の名前
|
28
30
|
use_cache: キャッシュした翻訳メモリを適用する
|
29
31
|
version: バーションを表示し終了する
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konjac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: amatch
|
16
|
-
requirement: &
|
16
|
+
requirement: &70315284595940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70315284595940
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: git
|
27
|
+
requirement: &70315284623080 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70315284623080
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: highline
|
27
|
-
requirement: &
|
38
|
+
requirement: &70315284622660 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '0'
|
33
44
|
type: :runtime
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70315284622660
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: i18n
|
38
|
-
requirement: &
|
49
|
+
requirement: &70315284622240 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: '0'
|
44
55
|
type: :runtime
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70315284622240
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: nokogiri
|
49
|
-
requirement: &
|
60
|
+
requirement: &70315284621820 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,10 +65,10 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :runtime
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70315284621820
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: sdoc
|
60
|
-
requirement: &
|
71
|
+
requirement: &70315284621380 !ruby/object:Gem::Requirement
|
61
72
|
none: false
|
62
73
|
requirements:
|
63
74
|
- - ! '>='
|
@@ -65,10 +76,10 @@ dependencies:
|
|
65
76
|
version: '0'
|
66
77
|
type: :runtime
|
67
78
|
prerelease: false
|
68
|
-
version_requirements: *
|
79
|
+
version_requirements: *70315284621380
|
69
80
|
- !ruby/object:Gem::Dependency
|
70
81
|
name: term-ansicolor
|
71
|
-
requirement: &
|
82
|
+
requirement: &70315284620960 !ruby/object:Gem::Requirement
|
72
83
|
none: false
|
73
84
|
requirements:
|
74
85
|
- - ! '>='
|
@@ -76,10 +87,10 @@ dependencies:
|
|
76
87
|
version: '0'
|
77
88
|
type: :runtime
|
78
89
|
prerelease: false
|
79
|
-
version_requirements: *
|
90
|
+
version_requirements: *70315284620960
|
80
91
|
- !ruby/object:Gem::Dependency
|
81
92
|
name: trollop
|
82
|
-
requirement: &
|
93
|
+
requirement: &70315284620540 !ruby/object:Gem::Requirement
|
83
94
|
none: false
|
84
95
|
requirements:
|
85
96
|
- - ! '>='
|
@@ -87,10 +98,10 @@ dependencies:
|
|
87
98
|
version: '0'
|
88
99
|
type: :runtime
|
89
100
|
prerelease: false
|
90
|
-
version_requirements: *
|
101
|
+
version_requirements: *70315284620540
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
103
|
name: autotest
|
93
|
-
requirement: &
|
104
|
+
requirement: &70315284620120 !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
106
|
requirements:
|
96
107
|
- - ! '>='
|
@@ -98,10 +109,10 @@ dependencies:
|
|
98
109
|
version: '0'
|
99
110
|
type: :development
|
100
111
|
prerelease: false
|
101
|
-
version_requirements: *
|
112
|
+
version_requirements: *70315284620120
|
102
113
|
- !ruby/object:Gem::Dependency
|
103
114
|
name: autotest-fsevent
|
104
|
-
requirement: &
|
115
|
+
requirement: &70315284619700 !ruby/object:Gem::Requirement
|
105
116
|
none: false
|
106
117
|
requirements:
|
107
118
|
- - ! '>='
|
@@ -109,10 +120,10 @@ dependencies:
|
|
109
120
|
version: '0'
|
110
121
|
type: :development
|
111
122
|
prerelease: false
|
112
|
-
version_requirements: *
|
123
|
+
version_requirements: *70315284619700
|
113
124
|
- !ruby/object:Gem::Dependency
|
114
125
|
name: autotest-growl
|
115
|
-
requirement: &
|
126
|
+
requirement: &70315284619260 !ruby/object:Gem::Requirement
|
116
127
|
none: false
|
117
128
|
requirements:
|
118
129
|
- - ! '>='
|
@@ -120,10 +131,10 @@ dependencies:
|
|
120
131
|
version: '0'
|
121
132
|
type: :development
|
122
133
|
prerelease: false
|
123
|
-
version_requirements: *
|
134
|
+
version_requirements: *70315284619260
|
124
135
|
- !ruby/object:Gem::Dependency
|
125
136
|
name: bundler
|
126
|
-
requirement: &
|
137
|
+
requirement: &70315284618760 !ruby/object:Gem::Requirement
|
127
138
|
none: false
|
128
139
|
requirements:
|
129
140
|
- - ! '>='
|
@@ -131,10 +142,10 @@ dependencies:
|
|
131
142
|
version: '0'
|
132
143
|
type: :development
|
133
144
|
prerelease: false
|
134
|
-
version_requirements: *
|
145
|
+
version_requirements: *70315284618760
|
135
146
|
- !ruby/object:Gem::Dependency
|
136
147
|
name: rspec
|
137
|
-
requirement: &
|
148
|
+
requirement: &70315284618240 !ruby/object:Gem::Requirement
|
138
149
|
none: false
|
139
150
|
requirements:
|
140
151
|
- - ! '>='
|
@@ -142,7 +153,7 @@ dependencies:
|
|
142
153
|
version: '0'
|
143
154
|
type: :development
|
144
155
|
prerelease: false
|
145
|
-
version_requirements: *
|
156
|
+
version_requirements: *70315284618240
|
146
157
|
description: A Ruby command-line utility for translating files using a YAML wordlist
|
147
158
|
email:
|
148
159
|
- bryan.mckelvey@gmail.com
|
@@ -165,11 +176,14 @@ files:
|
|
165
176
|
- lib/applescripts/konjac_powerpoint_import
|
166
177
|
- lib/applescripts/konjac_word_export
|
167
178
|
- lib/applescripts/konjac_word_import
|
179
|
+
- lib/bash/install_vim
|
180
|
+
- lib/bash/update_vim
|
168
181
|
- lib/konjac.rb
|
169
182
|
- lib/konjac/cli.rb
|
170
183
|
- lib/konjac/config.rb
|
171
184
|
- lib/konjac/dictionary.rb
|
172
185
|
- lib/konjac/exception.rb
|
186
|
+
- lib/konjac/installer.rb
|
173
187
|
- lib/konjac/language.rb
|
174
188
|
- lib/konjac/office.rb
|
175
189
|
- lib/konjac/suggestor.rb
|