fedux_org-stdlib 0.6.45 → 0.6.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fedux_org_stdlib/app_config.rb +8 -1
- data/lib/fedux_org_stdlib/core_ext/array/list.rb +6 -0
- data/lib/fedux_org_stdlib/core_ext/array.rb +2 -5
- data/lib/fedux_org_stdlib/core_ext/hash/list.rb +8 -0
- data/lib/fedux_org_stdlib/core_ext/hash.rb +3 -0
- data/lib/fedux_org_stdlib/core_ext/shellwords.rb +3 -0
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/spec/app_config_spec.rb +4 -2
- data/spec/core_ext/array/list.rb +13 -0
- data/spec/core_ext/hash/list_spec.rb +16 -0
- metadata +9 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f30dfb18ded39d3f9d21aee9ed56bb87e4d868e
|
4
|
+
data.tar.gz: 148ee56c2e9d7b9c0eed83934c7a3d0b6e57496d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e80bfb364cd3b361decb1f761e56966b1cdb5e58f8af6091bf101039d64f0cb803d7970acfecead55a6a7fc1ecb5b8ebfe64e9eea3115fdd6ef941b01012745d
|
7
|
+
data.tar.gz: 3d1627b20c6916bc742a64aef48f5dd5178907c5818cb15a33386ac0681da05eb79fe557a09b8d231520f1d0c9793ffa2db32a81f64fa63aefad4ca76ae7a1a9
|
data/Gemfile.lock
CHANGED
@@ -234,7 +234,14 @@ module FeduxOrgStdlib
|
|
234
234
|
result << sprintf("%s + %s", '-' * length, '-' * 80)
|
235
235
|
|
236
236
|
self.class._known_options.each do |o|
|
237
|
-
|
237
|
+
value = public_send(o)
|
238
|
+
|
239
|
+
value = if value.is_a? Hash
|
240
|
+
value.to_list
|
241
|
+
else
|
242
|
+
Array(value).to_list
|
243
|
+
end
|
244
|
+
result << sprintf("%#{length}s | %s", o, value)
|
238
245
|
end
|
239
246
|
|
240
247
|
result.join("\n")
|
data/spec/app_config_spec.rb
CHANGED
@@ -343,6 +343,7 @@ RSpec.describe AppConfig do
|
|
343
343
|
config_klass = Class.new(AppConfig) do
|
344
344
|
option :opt1, 'test1'
|
345
345
|
option :opt2, 'test2'
|
346
|
+
option :opt3, { opt1: 'test1', opt2: 'test2' }
|
346
347
|
|
347
348
|
def _class_name
|
348
349
|
'TestConfig'
|
@@ -357,8 +358,9 @@ RSpec.describe AppConfig do
|
|
357
358
|
expect(config.to_s).to eq <<-EOS.strip_heredoc.chomp
|
358
359
|
option | value
|
359
360
|
------ + --------------------------------------------------------------------------------
|
360
|
-
opt1 | test1
|
361
|
-
opt2 | test2
|
361
|
+
opt1 | "test1"
|
362
|
+
opt2 | "test2"
|
363
|
+
opt3 | "opt1: test1", "opt2: test2"
|
362
364
|
EOS
|
363
365
|
end
|
364
366
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'fedux_org_stdlib/core_ext/array/list'
|
4
|
+
|
5
|
+
RSpec.describe Array do
|
6
|
+
context '#to_list' do
|
7
|
+
it 'converts array to a list of values' do
|
8
|
+
input = %w{ asdf asdf asdf}
|
9
|
+
|
10
|
+
expect(input.to_list).to eq '"asdf", "asdf", "asdf"'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'fedux_org_stdlib/core_ext/hash/list'
|
4
|
+
|
5
|
+
RSpec.describe Array do
|
6
|
+
context '#to_list' do
|
7
|
+
it 'converts array to a list of values' do
|
8
|
+
input = {
|
9
|
+
opt1: 'asdf',
|
10
|
+
opt2: 'asdf'
|
11
|
+
}
|
12
|
+
|
13
|
+
expect(input.to_list).to eq '"opt1: asdf", "opt2: asdf"'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
@@ -57,7 +57,11 @@ files:
|
|
57
57
|
- lib/fedux_org_stdlib/command/run_command.rb
|
58
58
|
- lib/fedux_org_stdlib/command/which.rb
|
59
59
|
- lib/fedux_org_stdlib/core_ext/array.rb
|
60
|
+
- lib/fedux_org_stdlib/core_ext/array/list.rb
|
61
|
+
- lib/fedux_org_stdlib/core_ext/hash.rb
|
62
|
+
- lib/fedux_org_stdlib/core_ext/hash/list.rb
|
60
63
|
- lib/fedux_org_stdlib/core_ext/hash/options.rb
|
64
|
+
- lib/fedux_org_stdlib/core_ext/shellwords.rb
|
61
65
|
- lib/fedux_org_stdlib/core_ext/shellwords/clean.rb
|
62
66
|
- lib/fedux_org_stdlib/core_ext/string.rb
|
63
67
|
- lib/fedux_org_stdlib/environment.rb
|
@@ -139,6 +143,8 @@ files:
|
|
139
143
|
- spec/colors/html_color_spec.rb
|
140
144
|
- spec/command/run_command_spec.rb
|
141
145
|
- spec/command/which_spec.rb
|
146
|
+
- spec/core_ext/array/list.rb
|
147
|
+
- spec/core_ext/hash/list_spec.rb
|
142
148
|
- spec/core_ext/hash/options_spec.rb
|
143
149
|
- spec/core_ext/shellwords/clean_spec.rb
|
144
150
|
- spec/environment_spec.rb
|
@@ -209,6 +215,8 @@ test_files:
|
|
209
215
|
- spec/colors/html_color_spec.rb
|
210
216
|
- spec/command/run_command_spec.rb
|
211
217
|
- spec/command/which_spec.rb
|
218
|
+
- spec/core_ext/array/list.rb
|
219
|
+
- spec/core_ext/hash/list_spec.rb
|
212
220
|
- spec/core_ext/hash/options_spec.rb
|
213
221
|
- spec/core_ext/shellwords/clean_spec.rb
|
214
222
|
- spec/environment_spec.rb
|