eac_tools 0.47.0 → 0.47.2

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +25 -23
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +2 -2
  5. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance.rb +8 -2
  6. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance_with.rb +5 -3
  7. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
  8. data/sub/avm-eac_python_base0/avm-eac_python_base0.gemspec +2 -2
  9. data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/file_formats/base.rb +1 -1
  10. data/sub/avm-eac_python_base0/lib/avm/eac_python_base0/version.rb +1 -1
  11. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  12. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/launcher_stereotypes/base/publish.rb +6 -6
  13. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  14. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/runners/base/rubocop_spec.rb +4 -4
  15. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/runners/base/rubocop_spec_files/dir1/dir3/Gemfile.lock +27 -0
  16. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec.rb +4 -0
  17. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/Gemfile.lock +19 -0
  18. data/sub/avm-tools/avm-tools.gemspec +2 -2
  19. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  20. data/sub/eac_fs/lib/eac_fs/storage_tree.rb +19 -0
  21. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  22. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/{command → base_command}/append_command_options.rb +1 -1
  23. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/{command → base_command}/concat.rb +5 -12
  24. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/{command → base_command}/debugging.rb +1 -1
  25. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/{command → base_command}/execution.rb +1 -1
  26. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/extra_options.rb +28 -0
  27. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command.rb +45 -0
  28. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -10
  29. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +3 -15
  30. data/sub/eac_ruby_utils/lib/eac_ruby_utils/envs/composite_command.rb +33 -0
  31. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  32. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/command_spec.rb +32 -25
  33. metadata +59 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3418d6903a368e33472395b53a332d45ba663fef893c5e657f68ccb5bfc22c17
4
- data.tar.gz: 53b2d9b4c6a88ae9371176752c14bcaa623537f685f9400080c61ec274cee36e
3
+ metadata.gz: 0d1686f4681d753bcc8fb8b0c40a99704ae171fe9cca28a0a6e639e7dc1ddde5
4
+ data.tar.gz: f3d0612fabd22de4d4e32df9d4b976550c5266c0c92930eca71cfd6882e84046
5
5
  SHA512:
6
- metadata.gz: 37e4b8af6160ac8056ad0c724639b304260ce2c4b47fb405488a8fa529d01d3535264b0b28a06bff17f4adfd62eb47253f4d81c20e52e77637100ff05937aa05
7
- data.tar.gz: 1c72ca7d308189e28abc9bd8b1f01ff7d02a74841bffe80374f43fd9da5be792c6c90fce48ceef451bff95f56117fe95f5dde5d3869393696d2d8ae4dece2edf
6
+ metadata.gz: 2616efcacfe0c154f8472dc90b6cdd04cfe14ed8e2ec97d37a6b7313e002f1d6dcc67c4e634b057d890d2e93a7c5c21b596364f33b4294ca3d8077c409c268ca
7
+ data.tar.gz: 452475bfa82a589cac04c8417704289e2422174b35a6d05966606d76408af1f97e8e1ed55ea866f1790b7efcee201d4d5b0c2fe2412fe94a50357c2ed9b20b2a
data/Gemfile.lock CHANGED
@@ -1,21 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.47.0)
5
- avm (~> 0.58)
4
+ eac_tools (0.47.2)
5
+ avm (~> 0.57)
6
6
  avm-eac_asciidoctor_base0 (~> 0.12)
7
7
  avm-eac_generic_base0 (~> 0.8)
8
8
  avm-eac_latex_base0 (~> 0.3)
9
9
  avm-eac_php_base0 (~> 0.4)
10
+ avm-eac_postgresql_base0 (~> 0.2, >= 0.2.2)
11
+ avm-eac_python_base0 (~> 0.2, >= 0.2.1)
10
12
  avm-eac_rails_base0 (~> 0.8, >= 0.8.1)
11
13
  avm-eac_rails_base1 (~> 0.7, >= 0.7.1)
12
14
  avm-eac_redmine_base0 (~> 0.17)
13
15
  avm-eac_redmine_plugin_base0 (~> 0.4)
14
- avm-eac_ruby_base1 (~> 0.27, >= 0.27.1)
16
+ avm-eac_ruby_base1 (~> 0.27, >= 0.27.3)
15
17
  avm-eac_webapp_base0 (~> 0.12, >= 0.12.3)
16
18
  avm-eac_wordpress_base0 (~> 0.2, >= 0.2.1)
17
- avm-tools (~> 0.142, >= 0.142.6)
18
- eac_ruby_utils (~> 0.108)
19
+ avm-tools (~> 0.142, >= 0.142.7)
20
+ eac_ruby_utils (~> 0.109)
19
21
 
20
22
  PATH
21
23
  remote: sub/aranha-parsers
@@ -66,16 +68,16 @@ PATH
66
68
  PATH
67
69
  remote: sub/avm-eac_postgresql_base0
68
70
  specs:
69
- avm-eac_postgresql_base0 (0.2.1)
70
- avm (~> 0.56, >= 0.56.1)
71
- eac_ruby_utils (~> 0.107, >= 0.107.1)
71
+ avm-eac_postgresql_base0 (0.2.2)
72
+ avm (~> 0.57)
73
+ eac_ruby_utils (~> 0.108)
72
74
 
73
75
  PATH
74
76
  remote: sub/avm-eac_python_base0
75
77
  specs:
76
- avm-eac_python_base0 (0.2.0)
77
- avm-eac_generic_base0 (~> 0.7)
78
- eac_ruby_utils (~> 0.106)
78
+ avm-eac_python_base0 (0.2.1)
79
+ avm-eac_generic_base0 (~> 0.8)
80
+ eac_ruby_utils (~> 0.109)
79
81
 
80
82
  PATH
81
83
  remote: sub/avm-eac_rails_base0
@@ -116,10 +118,10 @@ PATH
116
118
  PATH
117
119
  remote: sub/avm-eac_ruby_base1
118
120
  specs:
119
- avm-eac_ruby_base1 (0.27.1)
120
- avm (~> 0.56)
121
+ avm-eac_ruby_base1 (0.27.3)
122
+ avm (~> 0.57)
121
123
  avm-eac_generic_base0 (~> 0.8)
122
- eac_ruby_utils (~> 0.107, >= 0.107.1)
124
+ eac_ruby_utils (~> 0.109)
123
125
 
124
126
  PATH
125
127
  remote: sub/avm-eac_webapp_base0
@@ -163,13 +165,13 @@ PATH
163
165
  PATH
164
166
  remote: sub/avm-tools
165
167
  specs:
166
- avm-tools (0.142.6)
168
+ avm-tools (0.142.7)
167
169
  aranha-parsers (~> 0.14, >= 0.14.4)
168
- avm (~> 0.56)
170
+ avm (~> 0.57)
169
171
  avm-eac_ruby_base1 (~> 0.27, >= 0.27.1)
170
172
  avm-eac_ubuntu_base0 (~> 0.3)
171
173
  avm-files (~> 0.6)
172
- avm-git (~> 0.10)
174
+ avm-git (~> 0.10, >= 0.10.1)
173
175
  clipboard (~> 1.3, >= 1.3.6)
174
176
  curb (~> 0.9, >= 0.9.11)
175
177
  eac_git (~> 0.14)
@@ -219,7 +221,7 @@ PATH
219
221
  PATH
220
222
  remote: sub/eac_fs
221
223
  specs:
222
- eac_fs (0.15.0)
224
+ eac_fs (0.16.0)
223
225
  content-type (~> 0.0, >= 0.0.2)
224
226
  eac_ruby_utils (~> 0.107, >= 0.107.1)
225
227
  ruby-filemagic (~> 0.7, >= 0.7.3)
@@ -243,7 +245,7 @@ PATH
243
245
  PATH
244
246
  remote: sub/eac_ruby_utils
245
247
  specs:
246
- eac_ruby_utils (0.108.0)
248
+ eac_ruby_utils (0.109.0)
247
249
  activesupport (>= 4, < 7)
248
250
  addressable (~> 2.8, >= 2.8.1)
249
251
  bundler
@@ -333,12 +335,12 @@ GEM
333
335
  os (1.1.4)
334
336
  parallel (1.22.1)
335
337
  parseconfig (1.1.2)
336
- parser (3.1.2.1)
338
+ parser (3.1.3.0)
337
339
  ast (~> 2.4.1)
338
340
  parslet (2.0.0)
339
341
  public_suffix (5.0.0)
340
- racc (1.6.0)
341
- rack (3.0.1)
342
+ racc (1.6.1)
343
+ rack (3.0.2)
342
344
  rainbow (3.1.1)
343
345
  rchardet (1.8.0)
344
346
  rexml (3.2.5)
@@ -411,4 +413,4 @@ DEPENDENCIES
411
413
  eac_tools!
412
414
 
413
415
  BUNDLED WITH
414
- 2.3.20
416
+ 2.3.26
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.47.0'
4
+ VERSION = '0.47.2'
5
5
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.56', '>= 0.56.1'
16
- s.add_dependency 'eac_ruby_utils', '~> 0.107', '>= 0.107.1'
15
+ s.add_dependency 'avm', '~> 0.57'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.108'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
19
19
  end
@@ -27,12 +27,18 @@ module Avm
27
27
  .envvar('PGPASSWORD', password)
28
28
  end
29
29
 
30
+ # @return [EacRubyUtils::Envs::Command]
30
31
  def dump_gzip_command
31
- dump_command.append(['@ESC_|', 'gzip', '-9', '-c'])
32
+ dump_command.pipe(env.command('gzip', '-9', '-c'))
33
+ end
34
+
35
+ # @return [String]
36
+ def password_command_argument
37
+ "@ESC_PGPASSWORD=#{password}"
32
38
  end
33
39
 
34
40
  def psql_command(database = true)
35
- env.command("@ESC_PGPASSWORD=#{password}", 'psql', *common_command_args(database))
41
+ env.command(password_command_argument, 'psql', *common_command_args(database))
36
42
  end
37
43
 
38
44
  def psql_command_command(sql, database = true)
@@ -8,9 +8,11 @@ module Avm
8
8
  module InstanceWith
9
9
  def pg
10
10
  @pg ||= ::Avm::EacPostgresqlBase0::Instance.new(
11
- host_env, user: read_entry(::Avm::Instances::EntryKeys::DATABASE_USERNAME),
12
- password: read_entry(::Avm::Instances::EntryKeys::DATABASE_PASSWORD),
13
- name: read_entry(::Avm::Instances::EntryKeys::DATABASE_NAME)
11
+ host_env, host: database_hostname,
12
+ port: database_port,
13
+ user: database_username,
14
+ password: database_password,
15
+ name: database_name
14
16
  )
15
17
  end
16
18
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacPostgresqlBase0
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'avm-eac_generic_base0', '~> 0.7'
16
- s.add_dependency 'eac_ruby_utils', '~> 0.106'
15
+ s.add_dependency 'avm-eac_generic_base0', '~> 0.8'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.109'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
19
19
  end
@@ -8,7 +8,7 @@ module Avm
8
8
  module FileFormats
9
9
  class Base < ::Avm::EacGenericBase0::FileFormats::Base
10
10
  VALID_BASENAMES = %w[*.py].freeze
11
- VALID_TYPES = ['x-python'].freeze
11
+ VALID_TYPES = ['x-python', 'x-script.python'].freeze
12
12
 
13
13
  def internal_apply(files)
14
14
  ::Avm::EacPythonBase0::Executables.yapf.command.append(['--in-place', *files]).system!
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacPythonBase0
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.56'
15
+ s.add_dependency 'avm', '~> 0.57'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.8'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.107', '>= 0.107.1'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.109'
18
18
 
19
19
  s.add_development_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.1'
20
20
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'curb'
4
3
  require 'json'
5
4
  require 'eac_ruby_utils/simple_cache'
6
5
  require 'rubygems'
7
6
  require 'eac_cli/speaker'
7
+ require 'aranha/parsers/source_address'
8
8
  require 'avm/launcher/publish/base'
9
9
  require 'avm/launcher/publish/check_result'
10
10
  require 'avm/eac_ruby_base1/launcher/gem'
@@ -98,11 +98,11 @@ module Avm
98
98
  end
99
99
 
100
100
  def gem_versions_uncached
101
- http = Curl.get("https://rubygems.org/api/v1/versions/#{gem_spec.name}.json")
102
- return JSON.parse!(http.body_str) if /\A2/ =~ http.status
103
- return [] if /\A4/ =~ http.status
104
-
105
- raise "#{http} code error: #{http.status}"
101
+ ::JSON.parse!(
102
+ ::Aranha::Parsers::SourceAddress.detect_sub(
103
+ "https://rubygems.org/api/v1/versions/#{gem_spec.name}.json"
104
+ ).content
105
+ )
106
106
  end
107
107
 
108
108
  def gem_version_max_uncached
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.27.1'
5
+ VERSION = '0.27.3'
6
6
  end
7
7
  end
@@ -10,6 +10,10 @@ require 'avm/eac_ruby_base1/sources/base'
10
10
  let(:dir3) { dir1.join('dir3') }
11
11
  let(:dir4) { fixtures_root.join('dir4') }
12
12
 
13
+ before do
14
+ ::Avm::EacRubyBase1::Sources::Base.new(dir3).bundle.execute!
15
+ end
16
+
13
17
  {
14
18
  dir1: '0.48.1',
15
19
  dir2: ::Avm::EacRubyBase1::Sources::Base.new(::File.expand_path('../../../../../..', __dir__))
@@ -21,10 +25,6 @@ require 'avm/eac_ruby_base1/sources/base'
21
25
  let(:dir) { send(dir_name) }
22
26
  let(:thegem) { ::Avm::EacRubyBase1::Sources::Base.new(dir) }
23
27
 
24
- before do
25
- thegem.bundle.system! if thegem.gemfile_path.exist?
26
- end
27
-
28
28
  it "return #{rubocop_version} as Rubocop version" do
29
29
  argv = ['-C', dir.to_s, '--', '--version']
30
30
  expect { described_class.run(argv: argv) }.to(
@@ -0,0 +1,27 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ast (2.4.2)
5
+ parser (2.7.2.0)
6
+ ast (~> 2.4.1)
7
+ powerpack (0.1.3)
8
+ rainbow (2.2.2)
9
+ rake
10
+ rake (13.0.6)
11
+ rubocop (0.48.1)
12
+ parser (>= 2.3.3.1, < 3.0)
13
+ powerpack (~> 0.1)
14
+ rainbow (>= 1.99.1, < 3.0)
15
+ ruby-progressbar (~> 1.7)
16
+ unicode-display_width (~> 1.0, >= 1.0.1)
17
+ ruby-progressbar (1.11.0)
18
+ unicode-display_width (1.8.0)
19
+
20
+ PLATFORMS
21
+ x86_64-linux
22
+
23
+ DEPENDENCIES
24
+ rubocop (= 0.48.1)
25
+
26
+ BUNDLED WITH
27
+ 2.3.26
@@ -6,6 +6,10 @@ require 'avm/eac_ruby_base1/sources/base'
6
6
  let(:mygem_path) { ::Pathname.new(__dir__).join('bundler_spec_files', 'mygem') }
7
7
  let(:mygem) { described_class.new(mygem_path) }
8
8
 
9
+ before do
10
+ mygem.bundle.execute!
11
+ end
12
+
9
13
  describe '#bundle' do
10
14
  specify do
11
15
  expect(mygem.bundle('exec', 'myrunner').execute!).to include('My Runner')
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mygem (1.0.0)
5
+ rake
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ rake (13.0.6)
11
+
12
+ PLATFORMS
13
+ x86_64-linux
14
+
15
+ DEPENDENCIES
16
+ mygem!
17
+
18
+ BUNDLED WITH
19
+ 2.3.17
@@ -15,11 +15,11 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
17
  s.add_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.4'
18
- s.add_dependency 'avm', '~> 0.56'
18
+ s.add_dependency 'avm', '~> 0.57'
19
19
  s.add_dependency 'avm-eac_ruby_base1', '~> 0.27', '>= 0.27.1'
20
20
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
21
21
  s.add_dependency 'avm-files', '~> 0.6'
22
- s.add_dependency 'avm-git', '~> 0.10'
22
+ s.add_dependency 'avm-git', '~> 0.10', '>= 0.10.1'
23
23
  s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
24
24
  s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
25
25
  s.add_dependency 'eac_git', '~> 0.14'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.142.6'
5
+ VERSION = '0.142.7'
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/yaml'
4
5
  require 'fileutils'
5
6
 
6
7
  module EacFs
@@ -33,12 +34,30 @@ module EacFs
33
34
  read
34
35
  end
35
36
 
37
+ # @return [Object]
38
+ def read_or_store_yaml(use_cache = true)
39
+ write_yaml(yield) unless stored? && use_cache
40
+
41
+ read_yaml
42
+ end
43
+
44
+ # @return [Object, nil]
45
+ def read_yaml
46
+ r = read
47
+ r.nil? ? nil : ::EacRubyUtils::Yaml.load(r)
48
+ end
49
+
36
50
  def write(value)
37
51
  assert_directory_on_path
38
52
  ::File.write(content_path, value)
39
53
  value
40
54
  end
41
55
 
56
+ def write_yaml(object)
57
+ write(::EacRubyUtils::Yaml.dump(object))
58
+ object
59
+ end
60
+
42
61
  def child(*child_path_parts)
43
62
  self.class.new(path, *child_path_parts)
44
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacFs
4
- VERSION = '0.15.0'
4
+ VERSION = '0.16.0'
5
5
  end
@@ -5,7 +5,7 @@ require 'shellwords'
5
5
 
6
6
  module EacRubyUtils
7
7
  module Envs
8
- class Command
8
+ module BaseCommand
9
9
  class AppendCommandOptions
10
10
  enable_method_class
11
11
  common_constructor :command, :command_line, :options
@@ -4,17 +4,18 @@ require 'eac_ruby_utils/struct'
4
4
 
5
5
  module EacRubyUtils
6
6
  module Envs
7
- class Command
7
+ module BaseCommand
8
8
  module Concat
9
9
  AND_OPERATOR = '&&'
10
10
  BEFORE_OPERATOR = ';'
11
11
  OR_OPERATOR = '||'
12
12
  PIPE_OPERATOR = '|'
13
13
 
14
+ # @param operator [Symbol]
15
+ # @return [EacRubyUtils::Envs::CompositeCommand]
14
16
  def concat(operator, other_command)
15
- duplicate_by_extra_options(concat: ::EacRubyUtils::Struct.new(
16
- operator: operator, command: other_command
17
- ))
17
+ require 'eac_ruby_utils/envs/composite_command'
18
+ ::EacRubyUtils::Envs::CompositeCommand.new(operator, self, other_command)
18
19
  end
19
20
 
20
21
  # @return [EacRubyUtils::Envs::Command]
@@ -34,14 +35,6 @@ module EacRubyUtils
34
35
  def pipe(other_command)
35
36
  concat(PIPE_OPERATOR, other_command)
36
37
  end
37
-
38
- private
39
-
40
- def append_concat(command)
41
- extra_options[:concat].if_present(command) do |v|
42
- "#{command} #{v.operator} #{v.command.command}"
43
- end
44
- end
45
38
  end
46
39
  end
47
40
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module EacRubyUtils
4
4
  module Envs
5
- class Command
5
+ module BaseCommand
6
6
  module Debugging
7
7
  def debug?
8
8
  ENV['DEBUG'].to_s.strip != ''
@@ -8,7 +8,7 @@ require 'pp'
8
8
 
9
9
  module EacRubyUtils
10
10
  module Envs
11
- class Command
11
+ module BaseCommand
12
12
  module Execution
13
13
  def execute!(options = {})
14
14
  options[:exit_outputs] = status_results.merge(options[:exit_outputs].presence || {})
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/hash/indifferent_access'
4
+ require 'active_support/core_ext/object/blank'
5
+ require 'shellwords'
6
+
7
+ module EacRubyUtils
8
+ module Envs
9
+ module BaseCommand
10
+ module ExtraOptions
11
+ # @return [ActiveSupport::HashWithIndifferentAccess]
12
+ def extra_options
13
+ @extra_options ||= {}.with_indifferent_access
14
+ end
15
+
16
+ def status_result(status_code, result)
17
+ duplicate_by_extra_options(status_results: status_results.merge(status_code => result))
18
+ end
19
+
20
+ private
21
+
22
+ def status_results
23
+ extra_options[:status_results] ||= {}.with_indifferent_access
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -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
@@ -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,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'shellwords'
4
+ require 'eac_ruby_utils/envs/base_command'
5
5
 
6
6
  module EacRubyUtils
7
7
  module Envs
8
8
  class Command
9
9
  require_sub __FILE__, include_modules: true, require_dependency: true
10
+ include ::EacRubyUtils::Envs::BaseCommand
10
11
 
11
12
  class << self
12
13
  # @param command [Array]
@@ -39,18 +40,11 @@ module EacRubyUtils
39
40
  "#{args} [ENV: #{env}]"
40
41
  end
41
42
 
42
- def command(options = {})
43
- append_command_options(
44
- env.command_line(command_line_without_env),
45
- options
46
- )
47
- end
48
-
49
43
  # @return [String]
50
44
  def command_line_without_env
51
45
  c = args
52
46
  c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
53
- append_chdir(append_concat(append_envvars(c)))
47
+ append_chdir(append_envvars(c))
54
48
  end
55
49
 
56
50
  protected
@@ -68,12 +62,6 @@ module EacRubyUtils
68
62
  def duplicate_by_extra_options(set_extra_options)
69
63
  duplicate(args, extra_options.merge(set_extra_options))
70
64
  end
71
-
72
- def escape(arg)
73
- arg = arg.to_s
74
- m = /^\@ESC_(.+)$/.match(arg)
75
- m ? m[1] : Shellwords.escape(arg)
76
- end
77
65
  end
78
66
  end
79
67
  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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.108.0'
4
+ VERSION = '0.109.0'
5
5
  end
@@ -19,16 +19,11 @@ RSpec.describe ::EacRubyUtils::Envs::Command do
19
19
 
20
20
  describe '#execute' do
21
21
  it do
22
- expect(ok_command.execute).to(
23
- eq({ command: 'echo -n THE\\ OUTPUT', stdout: ok_command_output, stderr: '', exit_code: 0 })
24
- )
22
+ assert_execute_result(ok_command.execute, true, ok_command_output)
25
23
  end
26
24
 
27
25
  it do
28
- expect(error_command.execute).to(
29
- eq({ command: 'cat a_file_that_not_exists', stdout: '',
30
- stderr: "cat: a_file_that_not_exists: No such file or directory\n", exit_code: 256 })
31
- )
26
+ assert_execute_result(error_command.execute, false, '')
32
27
  end
33
28
  end
34
29
 
@@ -57,37 +52,49 @@ RSpec.describe ::EacRubyUtils::Envs::Command do
57
52
  end
58
53
  end
59
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
+
60
75
  describe '#or' do
61
76
  it do
62
- expect(ok_command.or(error_command).execute).to(
63
- eq({ command: 'echo -n THE\\ OUTPUT || cat a_file_that_not_exists',
64
- stdout: ok_command_output, stderr: '', exit_code: 0 })
65
- )
77
+ assert_execute_result(ok_command.or(error_command).execute, true, ok_command_output)
66
78
  end
67
79
 
68
80
  it do
69
- expect(error_command.or(ok_command).execute).to(
70
- eq({ command: 'cat a_file_that_not_exists || echo -n THE\\ OUTPUT',
71
- stdout: ok_command_output,
72
- stderr: "cat: a_file_that_not_exists: No such file or directory\n", exit_code: 0 })
73
- )
81
+ assert_execute_result(error_command.or(ok_command).execute, true, ok_command_output)
74
82
  end
75
83
  end
76
84
 
77
85
  describe '#pipe' do
78
86
  it do
79
- expect(ok_command.pipe(error_command).execute).to(
80
- eq({ command: 'echo -n THE\\ OUTPUT | cat a_file_that_not_exists', stdout: '',
81
- stderr: "cat: a_file_that_not_exists: No such file or directory\n", exit_code: 256 })
82
- )
87
+ assert_execute_result(ok_command.pipe(error_command).execute, false, '')
83
88
  end
84
89
 
85
90
  it do
86
- expect(error_command.pipe(ok_command).execute).to(
87
- eq({ command: 'cat a_file_that_not_exists | echo -n THE\\ OUTPUT',
88
- stdout: ok_command_output,
89
- stderr: "cat: a_file_that_not_exists: No such file or directory\n", exit_code: 0 })
90
- )
91
+ assert_execute_result(error_command.pipe(ok_command).execute, false, ok_command_output)
91
92
  end
92
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
93
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.47.0
4
+ version: 0.47.2
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-23 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.58'
19
+ version: '0.57'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.58'
26
+ version: '0.57'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_asciidoctor_base0
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,46 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
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
103
+ - !ruby/object:Gem::Dependency
104
+ name: avm-eac_python_base0
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.2'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.2.1
113
+ type: :runtime
114
+ prerelease: false
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.2'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 0.2.1
83
123
  - !ruby/object:Gem::Dependency
84
124
  name: avm-eac_rails_base0
85
125
  requirement: !ruby/object:Gem::Requirement
@@ -157,7 +197,7 @@ dependencies:
157
197
  version: '0.27'
158
198
  - - ">="
159
199
  - !ruby/object:Gem::Version
160
- version: 0.27.1
200
+ version: 0.27.3
161
201
  type: :runtime
162
202
  prerelease: false
163
203
  version_requirements: !ruby/object:Gem::Requirement
@@ -167,7 +207,7 @@ dependencies:
167
207
  version: '0.27'
168
208
  - - ">="
169
209
  - !ruby/object:Gem::Version
170
- version: 0.27.1
210
+ version: 0.27.3
171
211
  - !ruby/object:Gem::Dependency
172
212
  name: avm-eac_webapp_base0
173
213
  requirement: !ruby/object:Gem::Requirement
@@ -217,7 +257,7 @@ dependencies:
217
257
  version: '0.142'
218
258
  - - ">="
219
259
  - !ruby/object:Gem::Version
220
- version: 0.142.6
260
+ version: 0.142.7
221
261
  type: :runtime
222
262
  prerelease: false
223
263
  version_requirements: !ruby/object:Gem::Requirement
@@ -227,21 +267,21 @@ dependencies:
227
267
  version: '0.142'
228
268
  - - ">="
229
269
  - !ruby/object:Gem::Version
230
- version: 0.142.6
270
+ version: 0.142.7
231
271
  - !ruby/object:Gem::Dependency
232
272
  name: eac_ruby_utils
233
273
  requirement: !ruby/object:Gem::Requirement
234
274
  requirements:
235
275
  - - "~>"
236
276
  - !ruby/object:Gem::Version
237
- version: '0.108'
277
+ version: '0.109'
238
278
  type: :runtime
239
279
  prerelease: false
240
280
  version_requirements: !ruby/object:Gem::Requirement
241
281
  requirements:
242
282
  - - "~>"
243
283
  - !ruby/object:Gem::Version
244
- version: '0.108'
284
+ version: '0.109'
245
285
  - !ruby/object:Gem::Dependency
246
286
  name: eac_ruby_gem_support
247
287
  requirement: !ruby/object:Gem::Requirement
@@ -686,6 +726,7 @@ files:
686
726
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/rubygems/version_file_spec_files/a_version_file.rb
687
727
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/runners/base/rubocop_spec.rb
688
728
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/runners/base/rubocop_spec_files/dir1/dir3/Gemfile
729
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/runners/base/rubocop_spec_files/dir1/dir3/Gemfile.lock
689
730
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/runners/base/rubocop_spec_files/dir2/empty.rb
690
731
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/runners/base/rubocop_spec_files/dir4/false_command.rb
691
732
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb
@@ -707,6 +748,7 @@ files:
707
748
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/spec/spec_helper.rb
708
749
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec.rb
709
750
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/Gemfile
751
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/Gemfile.lock
710
752
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/Rakefile
711
753
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/exe/myrunner
712
754
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base/bundler_spec_files/mygem/lib/mygem.rb
@@ -1594,14 +1636,17 @@ files:
1594
1636
  - sub/eac_ruby_utils/lib/eac_ruby_utils/custom_format.rb
1595
1637
  - sub/eac_ruby_utils/lib/eac_ruby_utils/enum.rb
1596
1638
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs.rb
1639
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command.rb
1640
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/append_command_options.rb
1641
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/concat.rb
1642
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/debugging.rb
1643
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/execution.rb
1644
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_command/extra_options.rb
1597
1645
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb
1598
1646
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb
1599
- - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/append_command_options.rb
1600
- - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb
1601
- - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/debugging.rb
1602
1647
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb
1603
- - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/execution.rb
1604
1648
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
1649
+ - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/composite_command.rb
1605
1650
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb
1606
1651
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/execution_error.rb
1607
1652
  - sub/eac_ruby_utils/lib/eac_ruby_utils/envs/execution_result.rb