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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd9008aa3fd4b63d3bf1d901377a2efc3a257ccf1eba103cf74cf3f480ef9b95
4
- data.tar.gz: ea3e787fe4c7ae277a06ab501ed74098ecad0f6beb27367400010f8696717db6
3
+ metadata.gz: 86b393d29e9db3edc24f1bd34bb4f7ade5935892d8c753b400f7737504d8af21
4
+ data.tar.gz: 5f609ff444293079bf8f1d21f292aa72d42012814fbbb6c50acc26b56a8d4613
5
5
  SHA512:
6
- metadata.gz: da6e58e10afa32f283293d775814e0b4e0cd35374807f5fec4b581efc73995d8483460d79c2758aead99ac00d64069714c1c6b3c815b3f177da7991a779e1568
7
- data.tar.gz: 27ac60328b39f15651cce3263dc3c195b69e2e9ad2a87340f0ec863fc33ee04d8aba9895c93e60360e1d011da2448e55029ba76b4d859377f4b7b4716a1dfe50
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.36.0'
4
+ VERSION = '0.37.0'
5
5
  end
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.36.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-02 00:00:00.000000000 Z
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