eac_ruby_base0 0.18.0 → 0.19.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: 85eba6ca6ab8fde7862b488d42954f505bf2bf15d5aabb15ab390f175515543f
4
- data.tar.gz: b8c39fc781d1951f2df2b02c9da83b76a97bce45ec2db28306516e3c1bdb1788
3
+ metadata.gz: bc3b395db26b74da71be9faa4253a680e50a351945dbfb03bd560b34f05a6a02
4
+ data.tar.gz: 171f9af1e9bd30048a39497654a3c16be6680682c7b990f37870318562607ef4
5
5
  SHA512:
6
- metadata.gz: cea4929378c81c4139c6d6bd5f33cc0e554b93f0870a100eefb41d24295918224034ec22a8e9a63b7cb2a93f45e9c87a977748798ab40f4396380525bfb5cbaa
7
- data.tar.gz: 1934ed29a67214a270ae9d2e6684e017575eec5b387c9cbc5a820bb2a394e3540f188cd956907f51f0a1dd90dc0101563eca03d667ecb812b04649c50a261c2e
6
+ metadata.gz: e34d1a2177d776d223423305048c72ecc65b62f95576597f8e22f9926dc38f7d713f005a0a91dd5e253958fc17dac8c88e0f27c2670168fe396f02e41bae49a1
7
+ data.tar.gz: d786a7145937ee3e65625e6555d15c13375a44bd00c4866ae2721f7b66752d711423b69fee79771e27b3a365d5a37262f31bed24b9e3c7139247bcaf89070f2c
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_config/node'
4
+ require 'eac_fs/contexts'
5
+ require 'eac_ruby_utils/core_ext'
6
+ require 'eac_ruby_utils/speaker'
7
+
8
+ module EacRubyBase0
9
+ module Runner
10
+ module Contexts
11
+ def on_context(&block)
12
+ top_block = block
13
+ available_contexts.each do |context|
14
+ next if context.object.any?
15
+
16
+ last_block = top_block
17
+ top_block = ::Proc.new { context.object.on(context.builder.call, &last_block) }
18
+ end
19
+ top_block.call
20
+ end
21
+
22
+ private
23
+
24
+ # @return [Array<EacRubyUtils::Struct>]
25
+ def available_contexts
26
+ (filesystem_available_contexts + [
27
+ [:config, ::EacConfig::Node.context,
28
+ -> { runner_context.call(:application).build_config }],
29
+ [:speaker, ::EacRubyUtils::Speaker.context, -> { build_speaker }]
30
+ ]).map { |row| available_context_row_to_struct(row) }
31
+ end
32
+
33
+ def available_context_row_to_struct(row)
34
+ %i[type object builder].zip(row).to_h.to_struct
35
+ end
36
+
37
+ def build_speaker
38
+ options = {}
39
+ options[:err_out] = ::StringIO.new if parsed.quiet?
40
+ options[:in_in] = ::EacCli::Speaker::InputBlocked.new if parsed.no_input?
41
+ ::EacCli::Speaker.new(options)
42
+ end
43
+
44
+ def filesystem_available_contexts
45
+ ::EacFs::Contexts::TYPES.map do |type|
46
+ key = "fs_#{type}".to_sym
47
+ [key, ::EacFs::Contexts.send(type), -> { application.send("self_#{key}") }]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -10,17 +10,30 @@ require 'eac_ruby_utils/speaker'
10
10
  module EacRubyBase0
11
11
  module Runner
12
12
  module Prepend
13
+ SYSTEM_STACK_ERROR_FILE = 'system_stack_error'
14
+
13
15
  def run
14
- if parsed.version?
15
- show_version
16
- else
17
- run_with_subcommand
16
+ on_rescue_stack_overflow do
17
+ if parsed.version?
18
+ show_version
19
+ else
20
+ run_with_subcommand
21
+ end
18
22
  end
19
23
  end
20
24
 
21
25
  def run_run
22
26
  on_context { super }
23
27
  end
28
+
29
+ private
30
+
31
+ def on_rescue_stack_overflow
32
+ yield
33
+ rescue ::SystemStackError => e
34
+ SYSTEM_STACK_ERROR_FILE.to_pathname.write(e.backtrace.map { |v| "#{v}\n" }.join)
35
+ raise e
36
+ end
24
37
  end
25
38
  end
26
39
  end
@@ -14,6 +14,7 @@ module EacRubyBase0
14
14
  common_concern do
15
15
  include ::EacCli::RunnerWith::Help
16
16
  include ::EacCli::RunnerWith::Subcommands
17
+ include ::EacRubyBase0::Runner::Contexts
17
18
  prepend ::EacRubyBase0::Runner::Prepend
18
19
  runner_definition do
19
20
  bool_opt '-q', '--quiet', 'Quiet mode.'
@@ -29,47 +30,8 @@ module EacRubyBase0
29
30
  runner_context.call(:application).version.to_s
30
31
  end
31
32
 
32
- def on_context(&block)
33
- top_block = block
34
- available_contexts.each do |context|
35
- next if context.object.any?
36
-
37
- last_block = top_block
38
- top_block = ::Proc.new { context.object.on(context.builder.call, &last_block) }
39
- end
40
- top_block.call
41
- end
42
-
43
33
  def show_version
44
34
  out("#{application_version}\n")
45
35
  end
46
-
47
- private
48
-
49
- # @return [Array<EacRubyUtils::Struct>]
50
- def available_contexts
51
- (filesystem_available_contexts + [
52
- [:config, ::EacConfig::Node.context, -> { runner_context.call(:application).build_config }],
53
- [:speaker, ::EacRubyUtils::Speaker.context, -> { build_speaker }]
54
- ]).map { |row| available_context_row_to_struct(row) }
55
- end
56
-
57
- def available_context_row_to_struct(row)
58
- %i[type object builder].zip(row).to_h.to_struct
59
- end
60
-
61
- def build_speaker
62
- options = {}
63
- options[:err_out] = ::StringIO.new if parsed.quiet?
64
- options[:in_in] = ::EacCli::Speaker::InputBlocked.new if parsed.no_input?
65
- ::EacCli::Speaker.new(options)
66
- end
67
-
68
- def filesystem_available_contexts
69
- ::EacFs::Contexts::TYPES.map do |type|
70
- key = "fs_#{type}".to_sym
71
- [key, ::EacFs::Contexts.send(type), -> { application.send("self_#{key}") }]
72
- end
73
- end
74
36
  end
75
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.18.0'
4
+ VERSION = '0.19.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
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: 2023-05-06 00:00:00.000000000 Z
11
+ date: 2023-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-eac_ruby_base1
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.30'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.30.2
22
+ version: 0.30.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +29,21 @@ dependencies:
29
29
  version: '0.30'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.30.2
32
+ version: 0.30.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: eac_cli
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.31'
39
+ version: '0.35'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.31'
46
+ version: '0.35'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: eac_fs
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.112'
67
+ version: '0.117'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0.112'
74
+ version: '0.117'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: eac_ruby_gem_support
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,7 @@ files:
103
103
  - lib/eac_ruby_base0/rspec.rb
104
104
  - lib/eac_ruby_base0/rspec/setup.rb
105
105
  - lib/eac_ruby_base0/runner.rb
106
+ - lib/eac_ruby_base0/runner/contexts.rb
106
107
  - lib/eac_ruby_base0/runner/prepend.rb
107
108
  - lib/eac_ruby_base0/runner_with.rb
108
109
  - lib/eac_ruby_base0/version.rb