eac_tools 0.46.0 → 0.47.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -21
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm-eac_php_base0/avm-eac_php_base0.gemspec +3 -2
  5. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/instances/base.rb +14 -0
  6. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/instances.rb +11 -0
  7. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/source_generators/base.rb +28 -0
  8. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/source_generators.rb +11 -0
  9. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/sources/base.rb +17 -0
  10. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/sources.rb +11 -0
  11. data/sub/avm-eac_php_base0/lib/avm/eac_php_base0/version.rb +1 -1
  12. data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/source_generators/base_spec.rb +8 -0
  13. data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/source_generators/base_spec_files/no_options/index.php +0 -0
  14. data/sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/sources/base_spec.rb +7 -0
  15. data/sub/avm-eac_php_base0/template/avm/eac_php_base0/source_generators/base/index.php +0 -0
  16. data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +2 -2
  17. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance.rb +8 -2
  18. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance_with.rb +5 -3
  19. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
  20. data/sub/avm-git/avm-git.gemspec +3 -3
  21. data/sub/avm-git/lib/avm/git/launcher/base/underlying.rb +1 -1
  22. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  23. data/sub/avm-tools/avm-tools.gemspec +2 -2
  24. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  25. data/sub/eac_fs/lib/eac_fs/storage_tree.rb +19 -0
  26. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  27. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/append_command_options.rb +38 -0
  28. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/concat.rb +41 -0
  29. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/debugging.rb +19 -0
  30. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/execution.rb +52 -0
  31. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/extra_options.rb +28 -0
  32. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command.rb +45 -0
  33. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +3 -0
  34. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -10
  35. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +28 -96
  36. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/composite_command.rb +33 -0
  37. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/{command/exec_error.rb → execution_error.rb} +1 -3
  38. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/execution_result.rb +45 -0
  39. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  40. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command_spec.rb +100 -0
  41. metadata +48 -17
  42. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb +0 -33
  43. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/execute_result.rb +0 -47
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'shellwords'
5
+
6
+ module EacRubyUtils
7
+ module Envs
8
+ module BaseCommand
9
+ require_sub __FILE__
10
+
11
+ common_concern do
12
+ enable_abstract_methods
13
+ include ::EacRubyUtils::Envs::BaseCommand::Concat
14
+ include ::EacRubyUtils::Envs::BaseCommand::Debugging
15
+ include ::EacRubyUtils::Envs::BaseCommand::Execution
16
+ include ::EacRubyUtils::Envs::BaseCommand::ExtraOptions
17
+ end
18
+
19
+ # @return [EacRubyUtils::Envs::BaseEnv]
20
+ def env
21
+ raise_abstract_method __method__
22
+ end
23
+
24
+ def command(options = {})
25
+ append_command_options(
26
+ env.command_line(command_line_without_env),
27
+ options
28
+ )
29
+ end
30
+
31
+ # @return [String]
32
+ def command_line_without_env(_options = {})
33
+ raise_abstract_method __method__
34
+ end
35
+
36
+ private
37
+
38
+ def escape(arg)
39
+ arg = arg.to_s
40
+ m = /^\@ESC_(.+)$/.match(arg)
41
+ m ? m[1] : Shellwords.escape(arg)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'shellwords'
5
+
3
6
  module EacRubyUtils
4
7
  module Envs
5
8
  class Command
@@ -12,18 +12,8 @@ module EacRubyUtils
12
12
  duplicate_by_extra_options(chdir: dir)
13
13
  end
14
14
 
15
- def status_result(status_code, result)
16
- duplicate_by_extra_options(status_results: status_results.merge(status_code => result))
17
- end
18
-
19
15
  private
20
16
 
21
- attr_reader :extra_options
22
-
23
- def status_results
24
- extra_options[:status_results] ||= {}.with_indifferent_access
25
- end
26
-
27
17
  def append_chdir(command)
28
18
  extra_options[:chdir].present? ? "(cd '#{extra_options[:chdir]}' ; #{command} )" : command
29
19
  end
@@ -1,134 +1,66 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/envs/process'
5
- require 'eac_ruby_utils/envs/spawn'
6
- require 'pp'
7
- require 'shellwords'
4
+ require 'eac_ruby_utils/envs/base_command'
8
5
 
9
6
  module EacRubyUtils
10
7
  module Envs
11
8
  class Command
12
- require_sub __FILE__, include_modules: true
13
-
14
- def initialize(env, command, extra_options = {})
15
- @env = env
16
- @extra_options = extra_options.with_indifferent_access
17
- if command.count == 1 && command.first.is_a?(Array)
18
- @command = command.first
19
- elsif command.is_a?(Array)
20
- @command = command
21
- else
22
- raise "Invalid argument command: #{command}|#{command.class}"
9
+ require_sub __FILE__, include_modules: true, require_dependency: true
10
+ include ::EacRubyUtils::Envs::BaseCommand
11
+
12
+ class << self
13
+ # @param command [Array]
14
+ # @return [Array]
15
+ def sanitize_initialize_arguments(arguments)
16
+ if arguments.count == 1 && arguments.first.is_a?(Array)
17
+ arguments.first
18
+ elsif arguments.is_a?(Array)
19
+ arguments
20
+ else
21
+ raise "Invalid argument command: #{arguments}|#{arguments.class}"
22
+ end
23
23
  end
24
24
  end
25
25
 
26
- def args
27
- @command
26
+ common_constructor :env, :args, :extra_options, default: [{}] do
27
+ self.extra_options = extra_options.with_indifferent_access
28
+ self.args = self.class.sanitize_initialize_arguments(args)
28
29
  end
29
30
 
30
31
  def append(args)
31
- duplicate_by_command(@command + args)
32
+ duplicate_by_command(self.args + args)
32
33
  end
33
34
 
34
35
  def prepend(args)
35
- duplicate_by_command(args + @command)
36
+ duplicate_by_command(args + self.args)
36
37
  end
37
38
 
38
39
  def to_s
39
- "#{@command} [ENV: #{@env}]"
40
+ "#{args} [ENV: #{env}]"
40
41
  end
41
42
 
42
- def command(options = {})
43
- c = @command
43
+ # @return [String]
44
+ def command_line_without_env
45
+ c = args
44
46
  c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
45
- append_command_options(
46
- @env.command_line(
47
- append_chdir(append_concat(append_envvars(c)))
48
- ),
49
- options
50
- )
51
- end
52
-
53
- def execute!(options = {})
54
- options[:exit_outputs] = status_results.merge(options[:exit_outputs].presence || {})
55
- er = ExecuteResult.new(execute(options), options)
56
- return er.result if er.success?
57
-
58
- raise ::EacRubyUtils::Envs::Command::ExecError,
59
- "execute! command failed: #{self}\n#{er.r.pretty_inspect}"
60
- end
61
-
62
- def execute(options = {})
63
- c = command(options)
64
- debug_print("BEFORE: #{c}")
65
- t1 = Time.now
66
- r = ::EacRubyUtils::Envs::Process.new(c).to_h
67
- i = Time.now - t1
68
- debug_print("AFTER [#{i}]: #{c}")
69
- r
70
- end
71
-
72
- def spawn(options = {})
73
- c = command(options)
74
- debug_print("SPAWN: #{c}")
75
- ::EacRubyUtils::Envs::Spawn.new(c)
76
- end
77
-
78
- def system!(options = {})
79
- return if system(options)
80
-
81
- raise ::EacRubyUtils::Envs::Command::ExecError, "system! command failed: #{self}"
82
- end
83
-
84
- def system(options = {})
85
- c = command(options)
86
- debug_print(c)
87
- Kernel.system(c)
47
+ append_chdir(append_envvars(c))
88
48
  end
89
49
 
90
50
  protected
91
51
 
92
52
  def duplicate(command, extra_options)
93
- self.class.new(@env, command, extra_options)
53
+ self.class.new(env, command, extra_options)
94
54
  end
95
55
 
96
56
  private
97
57
 
98
- attr_reader :extra_options
99
-
100
58
  def duplicate_by_command(new_command)
101
- duplicate(new_command, @extra_options)
59
+ duplicate(new_command, extra_options)
102
60
  end
103
61
 
104
62
  def duplicate_by_extra_options(set_extra_options)
105
- duplicate(@command, @extra_options.merge(set_extra_options))
106
- end
107
-
108
- def debug?
109
- ENV['DEBUG'].to_s.strip != ''
110
- end
111
-
112
- # Print a message if debugging is enabled.
113
- def debug_print(message)
114
- message = message.to_s
115
- puts message.if_respond(:light_red, message) if debug?
116
- end
117
-
118
- def append_command_options(command, options)
119
- command = options[:input].command + ' | ' + command if options[:input]
120
- if options[:input_file]
121
- command = "cat #{Shellwords.escape(options[:input_file])}" \
122
- " | #{command}"
123
- end
124
- command += ' > ' + Shellwords.escape(options[:output_file]) if options[:output_file]
125
- command
126
- end
127
-
128
- def escape(arg)
129
- arg = arg.to_s
130
- m = /^\@ESC_(.+)$/.match(arg)
131
- m ? m[1] : Shellwords.escape(arg)
63
+ duplicate(args, extra_options.merge(set_extra_options))
132
64
  end
133
65
  end
134
66
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/envs/base_command'
5
+
6
+ module EacRubyUtils
7
+ module Envs
8
+ class CompositeCommand
9
+ include ::EacRubyUtils::Envs::BaseCommand
10
+
11
+ enable_listable
12
+ lists.add_string :operator, '&&' => :and, ';' => :before, '||' => :or, '|' => :pipe
13
+
14
+ common_constructor :operator, :left_command, :right_command do
15
+ self.operator = self.class.lists.operator.value_validate!(operator.to_s)
16
+ end
17
+
18
+ # @return [EacRubyUtils::Envs::BaseEnv]
19
+ delegate :env, to: :left_command
20
+
21
+ # @return [String]
22
+ def command_line_without_env(_options = {})
23
+ ::Shellwords.join(['bash', '-c', bash_command])
24
+ end
25
+
26
+ # @return [String]
27
+ def bash_command
28
+ ['set', '-euo', 'pipefail', OPERATOR_BEFORE, left_command.command, operator,
29
+ right_command.command].join(' ')
30
+ end
31
+ end
32
+ end
33
+ end
@@ -2,9 +2,7 @@
2
2
 
3
3
  module EacRubyUtils
4
4
  module Envs
5
- class Command
6
- class ExecError < ::RuntimeError
7
- end
5
+ class ExecutionError < ::RuntimeError
8
6
  end
9
7
  end
10
8
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/envs/execution_error'
4
+
5
+ module EacRubyUtils
6
+ module Envs
7
+ class ExecutionResult
8
+ attr_reader :r, :options
9
+
10
+ def initialize(result, options)
11
+ @r = result
12
+ @options = options
13
+ end
14
+
15
+ def result
16
+ return exit_code_zero_result if exit_code_zero?
17
+ return expected_error_result if expected_error?
18
+
19
+ raise ::EacRubyUtils::Envs::ExecutionError, 'Failed!'
20
+ end
21
+
22
+ def success?
23
+ exit_code_zero? || expected_error?
24
+ end
25
+
26
+ private
27
+
28
+ def exit_code_zero?
29
+ r[:exit_code]&.zero?
30
+ end
31
+
32
+ def exit_code_zero_result
33
+ r[options[:output] || :stdout]
34
+ end
35
+
36
+ def expected_error_result
37
+ options[:exit_outputs][r[:exit_code]]
38
+ end
39
+
40
+ def expected_error?
41
+ options[:exit_outputs].is_a?(Hash) && options[:exit_outputs].key?(r[:exit_code])
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.107.1'
4
+ VERSION = '0.109.0'
5
5
  end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/envs/command'
4
+ require 'eac_ruby_utils/envs/executable'
5
+ require 'eac_ruby_utils/envs/local_env'
6
+
7
+ RSpec.describe ::EacRubyUtils::Envs::Command do
8
+ let(:env) { ::EacRubyUtils::Envs::LocalEnv.new }
9
+ let(:echo) { env.executable('echo', '--version') }
10
+ let(:cat) { env.executable('cat', '--version') }
11
+ let(:not_existing_file) { ::Pathname.new('a_file_that_not_exists') }
12
+ let(:ok_command) { echo.command('-n', ok_command_output) }
13
+ let(:ok_command_output) { 'THE OUTPUT' }
14
+ let(:error_command) { cat.command(not_existing_file) }
15
+
16
+ it { expect(echo).to exist }
17
+ it { expect(cat).to exist }
18
+ it { expect(not_existing_file).not_to exist }
19
+
20
+ describe '#execute' do
21
+ it do
22
+ assert_execute_result(ok_command.execute, true, ok_command_output)
23
+ end
24
+
25
+ it do
26
+ assert_execute_result(error_command.execute, false, '')
27
+ end
28
+ end
29
+
30
+ describe '#execute!' do
31
+ it { expect(ok_command.execute!).to eq(ok_command_output) }
32
+
33
+ it do
34
+ expect { error_command.execute! }.to(
35
+ raise_error(::EacRubyUtils::Envs::ExecutionError)
36
+ )
37
+ end
38
+ end
39
+
40
+ describe '#system' do
41
+ it { expect(ok_command.system).to eq(true) }
42
+ it { expect(error_command.system).to eq(false) }
43
+ end
44
+
45
+ describe '#system!' do
46
+ it { expect { ok_command.system! }.not_to raise_error }
47
+
48
+ it do
49
+ expect { error_command.system! }.to(
50
+ raise_error(::EacRubyUtils::Envs::ExecutionError)
51
+ )
52
+ end
53
+ end
54
+
55
+ describe '#and' do
56
+ it do
57
+ assert_execute_result(ok_command.and(error_command).execute, false, ok_command_output)
58
+ end
59
+
60
+ it do
61
+ assert_execute_result(error_command.and(ok_command).execute, false, '')
62
+ end
63
+ end
64
+
65
+ describe '#before' do
66
+ it do
67
+ assert_execute_result(ok_command.before(error_command).execute, false, ok_command_output)
68
+ end
69
+
70
+ it do
71
+ assert_execute_result(error_command.before(ok_command).execute, false, '')
72
+ end
73
+ end
74
+
75
+ describe '#or' do
76
+ it do
77
+ assert_execute_result(ok_command.or(error_command).execute, true, ok_command_output)
78
+ end
79
+
80
+ it do
81
+ assert_execute_result(error_command.or(ok_command).execute, true, ok_command_output)
82
+ end
83
+ end
84
+
85
+ describe '#pipe' do
86
+ it do
87
+ assert_execute_result(ok_command.pipe(error_command).execute, false, '')
88
+ end
89
+
90
+ it do
91
+ assert_execute_result(error_command.pipe(ok_command).execute, false, ok_command_output)
92
+ end
93
+ end
94
+
95
+ def assert_execute_result(actual, expected_successful, expected_stdout)
96
+ expect(successful: actual.fetch(:exit_code).zero?, stdout: actual.fetch(:stdout)).to(
97
+ eq(successful: expected_successful, stdout: expected_stdout)
98
+ )
99
+ end
100
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.46.0
4
+ version: 0.47.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2022-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -72,14 +72,34 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.3'
75
+ version: '0.4'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.3'
82
+ version: '0.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: avm-eac_postgresql_base0
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.2'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 0.2.2
93
+ type: :runtime
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.2'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.2.2
83
103
  - !ruby/object:Gem::Dependency
84
104
  name: avm-eac_rails_base0
85
105
  requirement: !ruby/object:Gem::Requirement
@@ -217,7 +237,7 @@ dependencies:
217
237
  version: '0.142'
218
238
  - - ">="
219
239
  - !ruby/object:Gem::Version
220
- version: 0.142.6
240
+ version: 0.142.7
221
241
  type: :runtime
222
242
  prerelease: false
223
243
  version_requirements: !ruby/object:Gem::Requirement
@@ -227,27 +247,21 @@ dependencies:
227
247
  version: '0.142'
228
248
  - - ">="
229
249
  - !ruby/object:Gem::Version
230
- version: 0.142.6
250
+ version: 0.142.7
231
251
  - !ruby/object:Gem::Dependency
232
252
  name: eac_ruby_utils
233
253
  requirement: !ruby/object:Gem::Requirement
234
254
  requirements:
235
255
  - - "~>"
236
256
  - !ruby/object:Gem::Version
237
- version: '0.107'
238
- - - ">="
239
- - !ruby/object:Gem::Version
240
- version: 0.107.1
257
+ version: '0.109'
241
258
  type: :runtime
242
259
  prerelease: false
243
260
  version_requirements: !ruby/object:Gem::Requirement
244
261
  requirements:
245
262
  - - "~>"
246
263
  - !ruby/object:Gem::Version
247
- version: '0.107'
248
- - - ">="
249
- - !ruby/object:Gem::Version
250
- version: 0.107.1
264
+ version: '0.109'
251
265
  - !ruby/object:Gem::Dependency
252
266
  name: eac_ruby_gem_support
253
267
  requirement: !ruby/object:Gem::Requirement
@@ -420,6 +434,12 @@ files:
420
434
  - sub/avm-eac_php_base0/lib/avm/eac_php_base0/executables.rb
421
435
  - sub/avm-eac_php_base0/lib/avm/eac_php_base0/file_formats.rb
422
436
  - sub/avm-eac_php_base0/lib/avm/eac_php_base0/file_formats/base.rb
437
+ - sub/avm-eac_php_base0/lib/avm/eac_php_base0/instances.rb
438
+ - sub/avm-eac_php_base0/lib/avm/eac_php_base0/instances/base.rb
439
+ - sub/avm-eac_php_base0/lib/avm/eac_php_base0/source_generators.rb
440
+ - sub/avm-eac_php_base0/lib/avm/eac_php_base0/source_generators/base.rb
441
+ - sub/avm-eac_php_base0/lib/avm/eac_php_base0/sources.rb
442
+ - sub/avm-eac_php_base0/lib/avm/eac_php_base0/sources/base.rb
423
443
  - sub/avm-eac_php_base0/lib/avm/eac_php_base0/version.rb
424
444
  - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec.rb
425
445
  - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_code.php.source
@@ -430,8 +450,12 @@ files:
430
450
  - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_html_code.php.target
431
451
  - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_iso88591_code.php.source
432
452
  - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/file_formats/base_spec_files/php_iso88591_code.php.target
453
+ - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/source_generators/base_spec.rb
454
+ - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/source_generators/base_spec_files/no_options/index.php
455
+ - sub/avm-eac_php_base0/spec/lib/avm/eac_php_base0/sources/base_spec.rb
433
456
  - sub/avm-eac_php_base0/spec/rubocop_spec.rb
434
457
  - sub/avm-eac_php_base0/spec/spec_helper.rb
458
+ - sub/avm-eac_php_base0/template/avm/eac_php_base0/source_generators/base/index.php
435
459
  - sub/avm-eac_postgresql_base0/Gemfile
436
460
  - sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec
437
461
  - sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0.rb
@@ -1590,14 +1614,20 @@ files:
1590
1614
  - sub/eac_ruby_utils/lib/eac_ruby_utils/custom_format.rb
1591
1615
  - sub/eac_ruby_utils/lib/eac_ruby_utils/enum.rb
1592
1616
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs.rb
1617
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command.rb
1618
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/append_command_options.rb
1619
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/concat.rb
1620
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/debugging.rb
1621
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/execution.rb
1622
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/extra_options.rb
1593
1623
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb
1594
1624
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb
1595
- - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb
1596
1625
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb
1597
- - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/exec_error.rb
1598
- - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/execute_result.rb
1599
1626
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
1627
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/composite_command.rb
1600
1628
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb
1629
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/execution_error.rb
1630
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/execution_result.rb
1601
1631
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/file.rb
1602
1632
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/local_env.rb
1603
1633
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/process.rb
@@ -1743,6 +1773,7 @@ files:
1743
1773
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/compare_by_spec.rb
1744
1774
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/custom_format_spec.rb
1745
1775
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/enum_spec.rb
1776
+ - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command_spec.rb
1746
1777
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
1747
1778
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/ssh_env_spec.rb
1748
1779
  - sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/extname_spec.rb
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/struct'
4
-
5
- module EacRubyUtils
6
- module Envs
7
- class Command
8
- module Concat
9
- def concat(operator, other_command)
10
- duplicate_by_extra_options(concat: ::EacRubyUtils::Struct.new(
11
- operator: operator, command: other_command
12
- ))
13
- end
14
-
15
- def or(other_command)
16
- concat('||', other_command)
17
- end
18
-
19
- def pipe(other_command)
20
- concat('|', other_command)
21
- end
22
-
23
- private
24
-
25
- def append_concat(command)
26
- extra_options[:concat].if_present(command) do |v|
27
- "#{command} #{v.operator} #{v.command.command}"
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/envs/command/exec_error'
4
-
5
- module EacRubyUtils
6
- module Envs
7
- class Command
8
- class ExecuteResult
9
- attr_reader :r, :options
10
-
11
- def initialize(result, options)
12
- @r = result
13
- @options = options
14
- end
15
-
16
- def result
17
- return exit_code_zero_result if exit_code_zero?
18
- return expected_error_result if expected_error?
19
-
20
- raise ::EacRubyUtils::Envs::Command::ExecError, 'Failed!'
21
- end
22
-
23
- def success?
24
- exit_code_zero? || expected_error?
25
- end
26
-
27
- private
28
-
29
- def exit_code_zero?
30
- r[:exit_code]&.zero?
31
- end
32
-
33
- def exit_code_zero_result
34
- r[options[:output] || :stdout]
35
- end
36
-
37
- def expected_error_result
38
- options[:exit_outputs][r[:exit_code]]
39
- end
40
-
41
- def expected_error?
42
- options[:exit_outputs].is_a?(Hash) && options[:exit_outputs].key?(r[:exit_code])
43
- end
44
- end
45
- end
46
- end
47
- end