eac_cli 0.36.0 → 0.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_cli/runner_with/output_item/base_formatter.rb +15 -0
- data/lib/eac_cli/runner_with/output_item/csv_formatter.rb +23 -0
- data/lib/eac_cli/runner_with/output_item/yaml_formatter.rb +18 -0
- data/lib/eac_cli/runner_with/output_item.rb +42 -0
- data/lib/eac_cli/version.rb +1 -1
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b393d29e9db3edc24f1bd34bb4f7ade5935892d8c753b400f7737504d8af21
|
4
|
+
data.tar.gz: 5f609ff444293079bf8f1d21f292aa72d42012814fbbb6c50acc26b56a8d4613
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2fe55eff4ac6b552cd3d6505eae01415e17dd970977f849b320dd8ceddead841537fdaf27675a7751265dd6f6a1e4810e4fd5450ddefd3d6a8a14d989ea9944
|
7
|
+
data.tar.gz: a2ae31d75a0a7c1aa75597072acce427ee1c3c9a345795ff85111c72f493767f3362826d4bd941ce0e0f3ff947a3e0e64b8198f61db934904452f06f11b0dbd0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
5
|
+
|
6
|
+
module EacCli
|
7
|
+
module RunnerWith
|
8
|
+
module OutputItem
|
9
|
+
class BaseFormatter
|
10
|
+
acts_as_abstract :to_output
|
11
|
+
common_constructor :item_hash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_cli/runner_with/output_item/base_formatter'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputItem
|
10
|
+
class CsvFormatter < ::EacCli::RunnerWith::OutputItem::BaseFormatter
|
11
|
+
COLUMNS = %w[key value].freeze
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
def to_output
|
15
|
+
::CSV.generate do |csv|
|
16
|
+
csv << COLUMNS
|
17
|
+
item_hash.each { |k, v| csv << [k, v] }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_cli/runner_with/output_item/base_formatter'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputItem
|
10
|
+
class YamlFormatter < ::EacCli::RunnerWith::OutputItem::BaseFormatter
|
11
|
+
# @return [String]
|
12
|
+
def to_output
|
13
|
+
::YAML.dump(item_hash.deep_stringify_keys)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/output'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputItem
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
FORMATS = {
|
13
|
+
'csv' => ::EacCli::RunnerWith::OutputItem::CsvFormatter,
|
14
|
+
'yaml' => ::EacCli::RunnerWith::OutputItem::YamlFormatter
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
common_concern do
|
18
|
+
acts_as_abstract :item_hash
|
19
|
+
include ::EacCli::RunnerWith::Output
|
20
|
+
|
21
|
+
runner_definition do
|
22
|
+
arg_opt '-f', '--format', 'Format to output item.', default: 'yaml'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def output_content
|
28
|
+
formatter.to_output
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [EacCli::RunnerWith::OutputList::BaseFormatter]
|
32
|
+
def formatter
|
33
|
+
formatter_class.new(item_hash)
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Class]
|
37
|
+
def formatter_class
|
38
|
+
FORMATS.fetch(parsed.format)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/eac_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -51,6 +51,9 @@ dependencies:
|
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0.119'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.119.1
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,6 +61,9 @@ dependencies:
|
|
58
61
|
- - "~>"
|
59
62
|
- !ruby/object:Gem::Version
|
60
63
|
version: '0.119'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.119.1
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: eac_ruby_gem_support
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,6 +144,10 @@ files:
|
|
138
144
|
- lib/eac_cli/runner_with/help/layout.rb
|
139
145
|
- lib/eac_cli/runner_with/input.rb
|
140
146
|
- lib/eac_cli/runner_with/output.rb
|
147
|
+
- lib/eac_cli/runner_with/output_item.rb
|
148
|
+
- lib/eac_cli/runner_with/output_item/base_formatter.rb
|
149
|
+
- lib/eac_cli/runner_with/output_item/csv_formatter.rb
|
150
|
+
- lib/eac_cli/runner_with/output_item/yaml_formatter.rb
|
141
151
|
- lib/eac_cli/runner_with/output_list.rb
|
142
152
|
- lib/eac_cli/runner_with/output_list/base_formatter.rb
|
143
153
|
- lib/eac_cli/runner_with/output_list/csv_formatter.rb
|