konjac 0.2.6.5 → 0.2.6.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/konjac/cli.rb CHANGED
@@ -15,6 +15,11 @@ module Konjac
15
15
  SUB_COMMANDS = ["add", "edit", "export", "import", "language", "list",
16
16
  "suggest", "translate", "use"]
17
17
 
18
+ # The minimum amount by which to offset subcommands in standard display.
19
+ # Should be equal to the length of the longest top-level flag (e.g. the
20
+ # +version+ in opt :version) plus 6
21
+ SC_MIN_OFFSET = 13 # :nodoc:
22
+
18
23
  # The banner to displaying when requesting help through the command line
19
24
  BANNER = <<-eos
20
25
  #{Color.bold { Color.underscore { "KONJAC" } }}
@@ -155,7 +160,7 @@ eos
155
160
  # Describe the subcommands available to the command line interface
156
161
  def describe_subcommands
157
162
  text = []
158
- leftcol_width = SUB_COMMANDS.map(&:length).max
163
+ leftcol_width = [SUB_COMMANDS.map(&:length).max, SC_MIN_OFFSET].max
159
164
  SUB_COMMANDS.each do |sc|
160
165
  text << " %#{leftcol_width}s: %s" % [sc, I18n.t(sc, :scope => :subcommands)]
161
166
  end
@@ -164,6 +169,8 @@ eos
164
169
 
165
170
  private
166
171
 
172
+ # Suggests a translation based on the provided word and the supplied
173
+ # optional arguments
167
174
  def suggest(word, opts = {})
168
175
  to_lang = Language.find(opts[:to]).to_s
169
176
  from_lang = Language.find(opts[:from]).to_s
@@ -6,9 +6,11 @@ module Konjac
6
6
  attr_accessor :tags
7
7
 
8
8
  # A regex to match lines that start with <tt>-</tt>, that is, lines that
9
- # indicate original text in .konjac files
9
+ # indicate removed text in .diff files
10
10
  OLD_TAG = /^-[^-]/
11
11
 
12
+ # A regex to match lines that start with <tt>+</tt>, that is, lines that
13
+ # indicate added text in .diff files
12
14
  NEW_TAG = /^\+[^+]/
13
15
 
14
16
  # Regex for matching index numbers
@@ -2,7 +2,10 @@
2
2
  module Konjac
3
3
  # A class consisting of functions for translation
4
4
  module Translator
5
+ # A regex to identify whether the specific line in a diff file is an add
6
+ # line
5
7
  DIFF_ADD = /^\+(?!\+\+ )/
8
+
6
9
  class << self
7
10
  # Translates a file or list of files
8
11
  #
@@ -1,4 +1,4 @@
1
1
  module Konjac
2
2
  # The current version number of Konjac
3
- VERSION = "0.2.6.5"
3
+ VERSION = "0.2.6.6"
4
4
  end
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.6.5
4
+ version: 0.2.6.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amatch
16
- requirement: &70254354401440 !ruby/object:Gem::Requirement
16
+ requirement: &70309718912920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70254354401440
24
+ version_requirements: *70309718912920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &70254354401020 !ruby/object:Gem::Requirement
27
+ requirement: &70309718912500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70254354401020
35
+ version_requirements: *70309718912500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &70254354400600 !ruby/object:Gem::Requirement
38
+ requirement: &70309718912080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70254354400600
46
+ version_requirements: *70309718912080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &70254354400160 !ruby/object:Gem::Requirement
49
+ requirement: &70309718911660 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70254354400160
57
+ version_requirements: *70309718911660
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sdoc
60
- requirement: &70254354399660 !ruby/object:Gem::Requirement
60
+ requirement: &70309718911240 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70254354399660
68
+ version_requirements: *70309718911240
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: term-ansicolor
71
- requirement: &70254354399080 !ruby/object:Gem::Requirement
71
+ requirement: &70309718927020 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70254354399080
79
+ version_requirements: *70309718927020
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: trollop
82
- requirement: &70254354398480 !ruby/object:Gem::Requirement
82
+ requirement: &70309718926460 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70254354398480
90
+ version_requirements: *70309718926460
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: autotest
93
- requirement: &70254354414360 !ruby/object:Gem::Requirement
93
+ requirement: &70309718925760 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70254354414360
101
+ version_requirements: *70309718925760
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: autotest-fsevent
104
- requirement: &70254354413760 !ruby/object:Gem::Requirement
104
+ requirement: &70309718925300 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70254354413760
112
+ version_requirements: *70309718925300
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: autotest-growl
115
- requirement: &70254354413080 !ruby/object:Gem::Requirement
115
+ requirement: &70309718924880 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70254354413080
123
+ version_requirements: *70309718924880
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: bundler
126
- requirement: &70254354412480 !ruby/object:Gem::Requirement
126
+ requirement: &70309718924280 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70254354412480
134
+ version_requirements: *70309718924280
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: rspec
137
- requirement: &70254354411860 !ruby/object:Gem::Requirement
137
+ requirement: &70309718923700 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,7 +142,7 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70254354411860
145
+ version_requirements: *70309718923700
146
146
  description: A Ruby command-line utility for translating files using a YAML wordlist
147
147
  email:
148
148
  - bryan.mckelvey@gmail.com