eac_ruby_utils 0.109.0 → 0.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f49997c361144d891925c3596cdc2ca37bcc485aa26aa287c4f7bfe529f3c553
4
- data.tar.gz: 50f784d1c96e7432f5bcec9823899cb4407d1e2fe7465aee7bd605a6dfbfe6ea
3
+ metadata.gz: c2b5cd79e1ec23311c26c6e444bc22ad3467fe4339414b040a6185c214f1941c
4
+ data.tar.gz: da8074cc3cdf8de32546c95088aa64bfc2b5d7bf8d56aff537de7f8d706ed077
5
5
  SHA512:
6
- metadata.gz: 2cee869d6232e3b1b7027dc0a0927c9d3ae272e0177d4c90718ebaa279374b60cf42171006eae06df51a0c09967019ba7e9b175fd5635051ed196c4cc012bed8
7
- data.tar.gz: fc6b4ed8fb837382ed816326d8930ce6fbb04a90fad68d5c48acf3516bd30f51eb4570ae04216129aa870627c8551500f480855a11981726e4dbb1ff05023cff
6
+ metadata.gz: 56cdf581724ea7e15f46990e19fd70fc6b14dcc3d4d03bf995c8c15b20f615393561bf82e3008fb02a612cd1fc859dca3e6df1a397fb0383bcc721e4a805cae2
7
+ data.tar.gz: cc7a20c43187222d5c9ab0492bf45765a0d0fd6ec95a754012a61b62add8b34971a658a986034d188e15895fd4b06110dde7a597da5f6678ad072e608b199630
@@ -25,8 +25,20 @@ module EacRubyUtils
25
25
 
26
26
  # @return [String]
27
27
  def bash_command
28
- ['set', '-euo', 'pipefail', OPERATOR_BEFORE, left_command.command, operator,
29
- right_command.command].join(' ')
28
+ ['set', '-euo', 'pipefail', OPERATOR_BEFORE, left_command_line, operator,
29
+ right_command_line].join(' ')
30
+ end
31
+
32
+ def left_command_line
33
+ left_command.command_line_without_env
34
+ end
35
+
36
+ def right_command_line
37
+ if right_command.env == left_command.env
38
+ right_command.command_line_without_env
39
+ else
40
+ right_command.command
41
+ end
30
42
  end
31
43
  end
32
44
  end
@@ -69,8 +69,9 @@ module EacRubyUtils
69
69
  .result
70
70
  end
71
71
 
72
+ # @return [Array<Gem::Dependency>]
72
73
  def gem_item_dependencies(item)
73
- ::Gem::Specification.find_by_name(item.name).dependencies
74
+ ::Gem::Specification.find_by_name(item.name).dependencies.select(&:runtime?)
74
75
  rescue ::Gem::MissingSpecError
75
76
  []
76
77
  end
@@ -1,25 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/common_constructor'
3
4
  require 'eac_ruby_utils/inflector'
4
5
 
5
6
  module EacRubyUtils
6
7
  module Listable
7
- class Value
8
- attr_reader :value, :key
9
-
10
- def initialize(list, value, key, translation_required = true)
11
- @list = list
12
- @value = value
13
- @key = key
14
- @translation_required = translation_required
15
- end
8
+ class Item
9
+ common_constructor :list, :value, :key, :translation_required, default: [true]
16
10
 
17
11
  def to_s
18
- "I: #{@list.item}, V: #{@value}, K: #{@key}"
12
+ "I: #{list.item}, V: #{value}, K: #{key}"
19
13
  end
20
14
 
21
15
  def constant_name
22
- ::EacRubyUtils::Inflector.variableize("#{@list.item}_#{@key}").upcase
16
+ ::EacRubyUtils::Inflector.variableize("#{list.item}_#{key}").upcase
23
17
  end
24
18
 
25
19
  def label
@@ -36,13 +30,13 @@ module EacRubyUtils
36
30
  end
37
31
 
38
32
  def translation_required?
39
- @translation_required
33
+ translation_required
40
34
  end
41
35
 
42
36
  private
43
37
 
44
38
  def translate(translate_key)
45
- full_translate_key = "#{@list.i18n_key}.#{@key}.#{translate_key}"
39
+ full_translate_key = "#{list.i18n_key}.#{key}.#{translate_key}"
46
40
  if !::I18n.exists?(full_translate_key) && !translation_required?
47
41
  ''
48
42
  else
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/listable/value'
3
+ require 'eac_ruby_utils/listable/item'
4
4
 
5
5
  module EacRubyUtils
6
6
  module Listable
@@ -18,13 +18,23 @@ module EacRubyUtils
18
18
  end
19
19
 
20
20
  def blank_value
21
- @blank_value ||= ::EacRubyUtils::Listable::Value.new(self, BLANK_VALUE, BLANK_KEY, false)
21
+ @blank_value ||= ::EacRubyUtils::Listable::Item.new(self, BLANK_VALUE, BLANK_KEY, false)
22
22
  end
23
23
 
24
24
  def each_value(&block)
25
25
  values.each(&block)
26
26
  end
27
27
 
28
+ # @return [EacRubyUtils::Listable::Item, nil]
29
+ def item_by_value(value)
30
+ @values.values.find { |item| item.value == value }
31
+ end
32
+
33
+ # @return [EacRubyUtils::Listable::Item]
34
+ def item_by_value!(value)
35
+ item_by_value(value) || raise(::KeyError, "Value not found: #{value}")
36
+ end
37
+
28
38
  def values
29
39
  @values.values.map(&:value)
30
40
  end
@@ -59,7 +69,7 @@ module EacRubyUtils
59
69
  "eac_ruby_utils.listable.#{class_i18n_key}.#{item}"
60
70
  end
61
71
 
62
- # @return [EacRubyUtils::Listable::Value, nil]
72
+ # @return [EacRubyUtils::Listable::Item, nil]
63
73
  def instance_value(instance)
64
74
  v = instance.send(item)
65
75
  return blank_value if v.blank?
@@ -109,7 +119,7 @@ module EacRubyUtils
109
119
  def build_values(labels)
110
120
  vs = {}
111
121
  parse_labels(labels).each do |value, key|
112
- v = Value.new(self, value, key)
122
+ v = ::EacRubyUtils::Listable::Item.new(self, value, key)
113
123
  vs[v.value] = v
114
124
  end
115
125
  vs
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ class Pathname
6
+ # Invoke +mkpath+ for parent path and return +self+.
7
+ # @return [self]
8
+ def assert_parent
9
+ parent.mkpath
10
+ self
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.109.0'
4
+ VERSION = '0.110.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.109.0
4
+ version: 0.110.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: 2022-11-24 00:00:00.000000000 Z
11
+ date: 2022-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -92,6 +92,20 @@ dependencies:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
94
  version: '4.2'
95
+ - !ruby/object:Gem::Dependency
96
+ name: avm-eac_ubuntu_base0
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '0.4'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '0.4'
95
109
  - !ruby/object:Gem::Dependency
96
110
  name: eac_ruby_gem_support
97
111
  requirement: !ruby/object:Gem::Requirement
@@ -183,11 +197,11 @@ files:
183
197
  - lib/eac_ruby_utils/listable/class_methods.rb
184
198
  - lib/eac_ruby_utils/listable/instance_methods.rb
185
199
  - lib/eac_ruby_utils/listable/integer_list.rb
200
+ - lib/eac_ruby_utils/listable/item.rb
186
201
  - lib/eac_ruby_utils/listable/list.rb
187
202
  - lib/eac_ruby_utils/listable/lists.rb
188
203
  - lib/eac_ruby_utils/listable/string_list.rb
189
204
  - lib/eac_ruby_utils/listable/symbol_list.rb
190
- - lib/eac_ruby_utils/listable/value.rb
191
205
  - lib/eac_ruby_utils/local_time_zone.rb
192
206
  - lib/eac_ruby_utils/locales.rb
193
207
  - lib/eac_ruby_utils/locales/from_all_gems.rb
@@ -244,6 +258,7 @@ files:
244
258
  - lib/eac_ruby_utils/patches/object/to_pathname.rb
245
259
  - lib/eac_ruby_utils/patches/object/to_uri.rb
246
260
  - lib/eac_ruby_utils/patches/pathname.rb
261
+ - lib/eac_ruby_utils/patches/pathname/assert_parent.rb
247
262
  - lib/eac_ruby_utils/patches/pathname/basename_noext.rb
248
263
  - lib/eac_ruby_utils/patches/pathname/basename_sub.rb
249
264
  - lib/eac_ruby_utils/patches/pathname/if_exist.rb