bovem 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/bovem.gemspec +1 -1
- data/doc/Bovem.html +1 -1
- data/doc/Bovem/Application.html +7 -7
- data/doc/Bovem/Command.html +1 -1
- data/doc/Bovem/CommandMethods.html +1 -1
- data/doc/Bovem/CommandMethods/Children.html +1 -1
- data/doc/Bovem/CommandMethods/Help.html +1 -1
- data/doc/Bovem/Configuration.html +1 -1
- data/doc/Bovem/Console.html +1 -1
- data/doc/Bovem/ConsoleMethods.html +1 -1
- data/doc/Bovem/ConsoleMethods/Interactions.html +1 -1
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +1 -1
- data/doc/Bovem/ConsoleMethods/Logging.html +1 -1
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +1 -1
- data/doc/Bovem/ConsoleMethods/Output.html +3 -3
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +1 -1
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +2 -2
- data/doc/Bovem/Errors.html +1 -1
- data/doc/Bovem/Errors/Error.html +1 -1
- data/doc/Bovem/Errors/InvalidConfiguration.html +1 -1
- data/doc/Bovem/Errors/InvalidLogger.html +1 -1
- data/doc/Bovem/Localizer.html +1 -1
- data/doc/Bovem/Logger.html +1 -1
- data/doc/Bovem/Option.html +109 -61
- data/doc/Bovem/Parser.html +1 -1
- data/doc/Bovem/ParserMethods.html +1 -1
- data/doc/Bovem/ParserMethods/General.html +1 -1
- data/doc/Bovem/ParserMethods/General/ClassMethods.html +1 -1
- data/doc/Bovem/Shell.html +1 -1
- data/doc/Bovem/ShellMethods.html +1 -1
- data/doc/Bovem/ShellMethods/Directories.html +1 -1
- data/doc/Bovem/ShellMethods/Execute.html +1 -1
- data/doc/Bovem/ShellMethods/General.html +1 -1
- data/doc/Bovem/ShellMethods/Read.html +1 -1
- data/doc/Bovem/ShellMethods/Write.html +1 -1
- data/doc/Bovem/Version.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/lib/bovem/application.rb +1 -1
- data/lib/bovem/command.rb +5 -5
- data/lib/bovem/console.rb +3 -3
- data/lib/bovem/option.rb +6 -4
- data/lib/bovem/shell.rb +3 -3
- data/lib/bovem/version.rb +3 -3
- data/locales/en.yml +1 -0
- data/locales/it.yml +1 -0
- data/spec/bovem/command_spec.rb +2 -2
- metadata +4 -4
data/doc/Bovem/Parser.html
CHANGED
@@ -267,7 +267,7 @@
|
|
267
267
|
</div>
|
268
268
|
|
269
269
|
<div id="footer">
|
270
|
-
Generated on
|
270
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
271
271
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
272
272
|
0.8.7 (ruby-2.0.0).
|
273
273
|
</div>
|
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.7 (ruby-2.0.0).
|
122
122
|
</div>
|
@@ -125,7 +125,7 @@
|
|
125
125
|
</div>
|
126
126
|
|
127
127
|
<div id="footer">
|
128
|
-
Generated on
|
128
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
129
129
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
130
130
|
0.8.7 (ruby-2.0.0).
|
131
131
|
</div>
|
@@ -561,7 +561,7 @@
|
|
561
561
|
</div>
|
562
562
|
|
563
563
|
<div id="footer">
|
564
|
-
Generated on
|
564
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
565
565
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
566
566
|
0.8.7 (ruby-2.0.0).
|
567
567
|
</div>
|
data/doc/Bovem/Shell.html
CHANGED
@@ -493,7 +493,7 @@
|
|
493
493
|
</div>
|
494
494
|
|
495
495
|
<div id="footer">
|
496
|
-
Generated on
|
496
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
497
497
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
498
498
|
0.8.7 (ruby-2.0.0).
|
499
499
|
</div>
|
data/doc/Bovem/ShellMethods.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Mon Sep 2 19:15:09 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.7 (ruby-2.0.0).
|
122
122
|
</div>
|
@@ -473,7 +473,7 @@
|
|
473
473
|
</div>
|
474
474
|
|
475
475
|
<div id="footer">
|
476
|
-
Generated on
|
476
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
477
477
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
478
478
|
0.8.7 (ruby-2.0.0).
|
479
479
|
</div>
|
@@ -556,7 +556,7 @@
|
|
556
556
|
</div>
|
557
557
|
|
558
558
|
<div id="footer">
|
559
|
-
Generated on
|
559
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
560
560
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
561
561
|
0.8.7 (ruby-2.0.0).
|
562
562
|
</div>
|
@@ -551,7 +551,7 @@
|
|
551
551
|
</div>
|
552
552
|
|
553
553
|
<div id="footer">
|
554
|
-
Generated on
|
554
|
+
Generated on Mon Sep 2 19:15:09 2013 by
|
555
555
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
556
556
|
0.8.7 (ruby-2.0.0).
|
557
557
|
</div>
|
@@ -442,7 +442,7 @@
|
|
442
442
|
</div>
|
443
443
|
|
444
444
|
<div id="footer">
|
445
|
-
Generated on
|
445
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
446
446
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
447
447
|
0.8.7 (ruby-2.0.0).
|
448
448
|
</div>
|
@@ -665,7 +665,7 @@
|
|
665
665
|
</div>
|
666
666
|
|
667
667
|
<div id="footer">
|
668
|
-
Generated on
|
668
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
669
669
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
670
670
|
0.8.7 (ruby-2.0.0).
|
671
671
|
</div>
|
data/doc/Bovem/Version.html
CHANGED
@@ -149,7 +149,7 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='int'>
|
152
|
+
<dd><pre class="code"><span class='int'>3</span></pre></dd>
|
153
153
|
|
154
154
|
<dt id="STRING-constant" class="">STRING =
|
155
155
|
<div class="docstring">
|
@@ -180,7 +180,7 @@
|
|
180
180
|
</div>
|
181
181
|
|
182
182
|
<div id="footer">
|
183
|
-
Generated on
|
183
|
+
Generated on Mon Sep 2 19:15:10 2013 by
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
185
|
0.8.7 (ruby-2.0.0).
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
@@ -454,7 +454,7 @@
|
|
454
454
|
</div>
|
455
455
|
|
456
456
|
<div id="footer">
|
457
|
-
Generated on
|
457
|
+
Generated on Mon Sep 2 19:15:09 2013 by
|
458
458
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
459
459
|
0.8.7 (ruby-2.0.0).
|
460
460
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -194,7 +194,7 @@ $ ./test help manage
|
|
194
194
|
</div></div>
|
195
195
|
|
196
196
|
<div id="footer">
|
197
|
-
Generated on
|
197
|
+
Generated on Mon Sep 2 19:15:09 2013 by
|
198
198
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
199
199
|
0.8.7 (ruby-2.0.0).
|
200
200
|
</div>
|
data/doc/index.html
CHANGED
@@ -194,7 +194,7 @@ $ ./test help manage
|
|
194
194
|
</div></div>
|
195
195
|
|
196
196
|
<div id="footer">
|
197
|
-
Generated on
|
197
|
+
Generated on Mon Sep 2 19:15:09 2013 by
|
198
198
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
199
199
|
0.8.7 (ruby-2.0.0).
|
200
200
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Mon Sep 2 19:15:09 2013 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7 (ruby-2.0.0).
|
109
109
|
</div>
|
data/lib/bovem/application.rb
CHANGED
@@ -152,7 +152,7 @@ module Bovem
|
|
152
152
|
#
|
153
153
|
# @param command [Command] The command to show help for.
|
154
154
|
def fetch_commands_for_help(command)
|
155
|
-
command.arguments.
|
155
|
+
command.arguments.map {|c| c.split(":") }.flatten.map(&:strip).select(&:present?)
|
156
156
|
end
|
157
157
|
end
|
158
158
|
end
|
data/lib/bovem/command.rb
CHANGED
@@ -77,9 +77,9 @@ module Bovem
|
|
77
77
|
#
|
78
78
|
# @return [Hash] The adjusted options for printing.
|
79
79
|
def show_help_options_build_labels
|
80
|
-
options.values.
|
80
|
+
options.values.reduce({}) do |lefts, option|
|
81
81
|
left = [option.complete_short, option.complete_long]
|
82
|
-
left.
|
82
|
+
left.map!{|l| l + " " + option.meta } if option.requires_argument?
|
83
83
|
lefts[left.join(", ")] = option.has_help? ? option.help : i18n.help_no_description
|
84
84
|
lefts
|
85
85
|
end
|
@@ -91,7 +91,7 @@ module Bovem
|
|
91
91
|
# @param lefts [Hash] The list of adjusted options.
|
92
92
|
# @param head [String] The option to print.
|
93
93
|
def show_help_option(console, lefts, head)
|
94
|
-
alignment = lefts.keys.
|
94
|
+
alignment = lefts.keys.map(&:length).max
|
95
95
|
help = lefts[head]
|
96
96
|
console.write("%s - %s" % [head.ljust(alignment, " "), help], "\n", true, true)
|
97
97
|
end
|
@@ -115,7 +115,7 @@ module Bovem
|
|
115
115
|
def prepare_show_help_commands(console)
|
116
116
|
console.write("")
|
117
117
|
console.write(is_application? ? i18n.help_commands : i18n.help_subcommands)
|
118
|
-
commands.keys.
|
118
|
+
commands.keys.map(&:length).max
|
119
119
|
end
|
120
120
|
|
121
121
|
# Prints information about a command's subcommand.
|
@@ -268,7 +268,7 @@ module Bovem
|
|
268
268
|
# @return [HashWithIndifferentAccess] The requested options.
|
269
269
|
def get_current_options(unprovided, prefix, whitelist)
|
270
270
|
rv = HashWithIndifferentAccess.new
|
271
|
-
whitelist = (whitelist.present? ? whitelist : options.keys).
|
271
|
+
whitelist = (whitelist.present? ? whitelist : options.keys).map(&:to_s)
|
272
272
|
|
273
273
|
options.each do |key, option|
|
274
274
|
rv["#{prefix}#{key}"] = option.value if include_option?(whitelist, unprovided, key, option)
|
data/lib/bovem/console.rb
CHANGED
@@ -44,7 +44,7 @@ module Bovem
|
|
44
44
|
# @param styles [String] The styles to parse.
|
45
45
|
# @return [String] A string with ANSI color codes.
|
46
46
|
def parse_styles(styles)
|
47
|
-
styles.split(/\s*[\s,-]\s*/).
|
47
|
+
styles.split(/\s*[\s,-]\s*/).map { |s| parse_style(s) }.join("")
|
48
48
|
end
|
49
49
|
|
50
50
|
#
|
@@ -151,7 +151,7 @@ module Bovem
|
|
151
151
|
else
|
152
152
|
width = (width == true || width.to_integer < 0 ? line_width : width.to_integer)
|
153
153
|
|
154
|
-
message.split("\n").
|
154
|
+
message.split("\n").map { |line|
|
155
155
|
line.length > width ? line.gsub(/(.{1,#{width}})(\s+|$)/, "\\1\n").strip : line
|
156
156
|
}.join("\n")
|
157
157
|
end
|
@@ -168,7 +168,7 @@ module Bovem
|
|
168
168
|
width = (width.is_a?(TrueClass) ? 0 : width.to_integer)
|
169
169
|
width = width < 0 ? -width : @indentation + width
|
170
170
|
|
171
|
-
message = message.split(newline_separator).
|
171
|
+
message = message.split(newline_separator).map {|line|
|
172
172
|
(@indentation_string * width) + line
|
173
173
|
}.join(newline_separator)
|
174
174
|
end
|
data/lib/bovem/option.rb
CHANGED
@@ -229,11 +229,13 @@ module Bovem
|
|
229
229
|
def handle_set_failure(vs)
|
230
230
|
locale = @parent.i18n
|
231
231
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
232
|
+
message = case vs
|
233
|
+
when "match" then locale.invalid_for_regexp(label, @validator.inspect)
|
234
|
+
when "call" then locale.invalid_for_proc(label)
|
235
|
+
else locale.invalid_value(label, Bovem::Parser.smart_join(@validator.ensure_array, ", ", locale.join_separator).html_safe)
|
236
236
|
end
|
237
|
+
|
238
|
+
raise Bovem::Errors::Error.new(self, :validation_failed, message)
|
237
239
|
end
|
238
240
|
|
239
241
|
# Gets the method required to verify a validator.
|
data/lib/bovem/shell.rb
CHANGED
@@ -123,8 +123,8 @@ module Bovem
|
|
123
123
|
def normalize_patterns(patterns, by_extension, case_sensitive)
|
124
124
|
# Adjust patterns
|
125
125
|
patterns = patterns.ensure_array(nil, true, true) {|p| p.is_a?(::Regexp) ? p : Regexp.new(Regexp.quote(p.ensure_string)) }
|
126
|
-
patterns = patterns.
|
127
|
-
patterns = patterns.
|
126
|
+
patterns = patterns.map {|p| /(#{p.source})$/ } if by_extension
|
127
|
+
patterns = patterns.map {|p| /#{p.source}/i } if !case_sensitive
|
128
128
|
patterns
|
129
129
|
end
|
130
130
|
|
@@ -213,7 +213,7 @@ module Bovem
|
|
213
213
|
def sanitize_copy_or_move(operation, src, dst)
|
214
214
|
operation = :copy if operation != :move
|
215
215
|
single = !src.is_a?(Array)
|
216
|
-
src = single ? File.expand_path(src) : src.
|
216
|
+
src = single ? File.expand_path(src) : src.map {|s| File.expand_path(s) }
|
217
217
|
|
218
218
|
[operation, i18n.shell.send(operation), single, src, File.expand_path(dst.ensure_string)]
|
219
219
|
end
|
data/lib/bovem/version.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
5
5
|
#
|
6
6
|
|
7
|
-
# A
|
7
|
+
# A mapion of utilities for developers.
|
8
8
|
module Bovem
|
9
9
|
# The current version of bovem, according to semantic versioning.
|
10
10
|
#
|
@@ -17,8 +17,8 @@ module Bovem
|
|
17
17
|
MINOR = 0
|
18
18
|
|
19
19
|
# The patch version.
|
20
|
-
PATCH =
|
21
|
-
|
20
|
+
PATCH = 3
|
21
|
+
|
22
22
|
# The current version number of Bovem.
|
23
23
|
STRING = [MAJOR, MINOR, PATCH].compact.join(".")
|
24
24
|
end
|
data/locales/en.yml
CHANGED
@@ -53,6 +53,7 @@
|
|
53
53
|
missing_option: "Required option %1 is missing."
|
54
54
|
invalid_value: "Value of option %1 must be one of these values: %2."
|
55
55
|
invalid_for_regexp: "Value of option %1 must match the regular expression: %2."
|
56
|
+
invalid_for_proc: "Value of option %1 is invalid."
|
56
57
|
help_option_short_form: "-h"
|
57
58
|
help_option_long_form: "--help"
|
58
59
|
help_message: "Shows this message."
|
data/locales/it.yml
CHANGED
@@ -53,6 +53,7 @@
|
|
53
53
|
missing_option: "L'opzione richiesta %1 è mancante."
|
54
54
|
invalid_value: "Il valore dell'opzione %1 deve essere uno dei seguenti valori: %2."
|
55
55
|
invalid_for_regexp: "Il valore dell'opzione %1 deve soddisfare questa espressione regolare: %2."
|
56
|
+
invalid_for_proc: "Il valore dell'opzione %1 non è valido."
|
56
57
|
help_option_short_form: "-h"
|
57
58
|
help_option_long_form: "--help"
|
58
59
|
help_message: "Mostra questo messaggio."
|
data/spec/bovem/command_spec.rb
CHANGED
@@ -182,7 +182,7 @@ describe Bovem::Command do
|
|
182
182
|
expect(command.commands).to eq({})
|
183
183
|
command.command("subcommand1")
|
184
184
|
command.command("subcommand2")
|
185
|
-
expect(command.commands.values.
|
185
|
+
expect(command.commands.values.map(&:name).sort).to eq(["subcommand1", "subcommand2"])
|
186
186
|
end
|
187
187
|
|
188
188
|
it "should let access both with Symbol or String" do
|
@@ -223,7 +223,7 @@ describe Bovem::Command do
|
|
223
223
|
expect(command.options).to eq({})
|
224
224
|
command.option("option1")
|
225
225
|
command.option("option2")
|
226
|
-
expect(command.options.values.
|
226
|
+
expect(command.options.values.map(&:name).sort).to eq(["option1", "option2"])
|
227
227
|
end
|
228
228
|
|
229
229
|
it "should let access both with Symbol or String" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bovem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lazier
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.3.
|
19
|
+
version: 3.3.9
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.3.
|
26
|
+
version: 3.3.9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: open4
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|