avm-tools 0.101.0 → 0.102.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/app_src.rb +8 -7
  3. data/lib/avm/git/auto_commit/rules/manual.rb +1 -1
  4. data/lib/avm/git/issue/complete.rb +1 -1
  5. data/lib/avm/git/revision_test.rb +9 -6
  6. data/lib/avm/launcher/context.rb +1 -1
  7. data/lib/avm/launcher/git/publish_base.rb +1 -1
  8. data/lib/avm/launcher/instances/base.rb +2 -1
  9. data/lib/avm/launcher/ruby/gem/build.rb +1 -1
  10. data/lib/avm/projects/stereotype/job_comparator.rb +32 -0
  11. data/lib/avm/projects/stereotypes/git/update.rb +1 -2
  12. data/lib/avm/projects/stereotypes/ruby_gem/publish.rb +1 -1
  13. data/lib/avm/projects/stereotypes/ruby_gem/update.rb +4 -0
  14. data/lib/avm/tools/runner/app_src/version_bump.rb +1 -1
  15. data/lib/avm/tools/runner/git/organize.rb +1 -1
  16. data/lib/avm/tools/version.rb +1 -1
  17. data/vendor/avm-apps/avm-apps.gemspec +1 -1
  18. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  19. data/vendor/eac_cli/lib/eac_cli/config/entry.rb +1 -1
  20. data/vendor/eac_cli/lib/eac_cli/config/entry/undefined.rb +1 -1
  21. data/vendor/eac_cli/lib/eac_cli/old_configs.rb +0 -1
  22. data/vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +2 -2
  23. data/vendor/eac_cli/lib/eac_cli/speaker.rb +15 -19
  24. data/vendor/eac_cli/lib/eac_cli/speaker/_constants.rb +1 -1
  25. data/vendor/eac_cli/lib/eac_cli/speaker/list.rb +1 -1
  26. data/vendor/eac_cli/lib/eac_cli/speaker/options.rb +38 -0
  27. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  28. data/vendor/eac_cli/spec/lib/eac_cli/speaker_spec.rb +5 -9
  29. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +2 -2
  30. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +2 -2
  31. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +12 -3
  32. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +1 -1
  33. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  34. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
  35. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +2 -0
  36. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  37. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb +9 -0
  38. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb +16 -0
  39. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +57 -0
  40. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb +32 -0
  41. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  42. data/vendor/{eac_cli/spec/lib → eac_ruby_utils/spec/lib/eac_ruby_utils/patches}/module/speaker_spec.rb +2 -2
  43. metadata +9 -7
  44. data/vendor/eac_cli/lib/eac_cli/patches/module.rb +0 -4
  45. data/vendor/eac_cli/lib/eac_cli/patches/module/speaker.rb +0 -10
  46. data/vendor/eac_cli/lib/eac_cli/speaker/_class_methods.rb +0 -37
  47. data/vendor/eac_cli/lib/eac_cli/speaker/node.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5243b812d2aa6e9e61cff80a964aa4b035abd9dd85051f5798fbfc6b1c00486a
4
- data.tar.gz: 8c79b0a42a1d863349129e5a2ab8d091f8765abea99815d4f706e64126f843bc
3
+ metadata.gz: af55442cdb7aacd8752fa1cf1b548fe867d7bdd74dfc9e9abd72d754de22772c
4
+ data.tar.gz: c9fd2f59d75013325820f1d7ff8c8d54a35c09851a1032ccd31ff95427304a5d
5
5
  SHA512:
6
- metadata.gz: f1c66dd955e5367563ccad9d9ae5e44946c109b9abf519b3bddb04cd5bda6dcb4b74a6bc4745f1ba7fd400111ab5ce41e5172cd3d28765ea44106531ba8d8644
7
- data.tar.gz: 2b7c051160d2c1b549a25b6a620a9458c151b85887c1bcffd859ac4099fd72e57a6d2af17309b293883a1da0b431a64b54e8491446e191efed274f18a2f93dfe
6
+ metadata.gz: c19e110f9557287b2b84b18385370111d1ba5bb1e99636f2425ab2c6a5729599f7d9bdba985fde3e4b4f7e4aece5614c3e443a4e61150370d9c1f2ac08bf411e
7
+ data.tar.gz: 87dfc0c5042d2c0deba256ad7e7869bf4b547f48c1376f9e25114834e739b6e3d6be7c49cc03d3975128fd27de2b586f933f0f8fd67edffdd5350824f49208eb
data/lib/avm/app_src.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'avm/apps/sources/configuration'
4
4
  require 'avm/launcher/paths/real'
5
+ require 'avm/projects/stereotype/job_comparator'
5
6
  require 'eac_ruby_utils/core_ext'
6
7
  require 'avm/projects/stereotypes'
7
8
  require 'i18n'
@@ -27,7 +28,7 @@ module Avm
27
28
  end
28
29
 
29
30
  def run_job(job, job_args = [])
30
- stereotypes.each { |stereotype| run_stereotype_job(stereotype, job, job_args) }
31
+ stereotypes_jobs(job, job_args).each(&:run)
31
32
  end
32
33
 
33
34
  private
@@ -37,14 +38,14 @@ module Avm
37
38
  ::Avm::Apps::Sources::Configuration.find_in_path(path)
38
39
  end
39
40
 
40
- def run_stereotype_job(stereotype, job, job_args)
41
+ def stereotypes_jobs(job, job_args)
41
42
  job_class_method = "#{job}_class"
42
- if stereotype.send(job_class_method).present?
43
- puts stereotype.label + ": #{job} class found. Running..."
44
- stereotype.send(job_class_method).new(self, *job_args).run
45
- else
46
- puts stereotype.label + ": #{job} class not found"
43
+ r = []
44
+ stereotypes.each do |stereotype|
45
+ r << stereotype.send(job_class_method).new(self, *job_args) if
46
+ stereotype.send(job_class_method).present?
47
47
  end
48
+ r.sort { |a, b| ::Avm::Projects::Stereotype::JobComparator.new(a, b).result }
48
49
  end
49
50
 
50
51
  def stereotypes_uncached
@@ -17,7 +17,7 @@ module Avm
17
17
  return nil unless file.commits.any?
18
18
 
19
19
  commits_banner
20
- request_input('Which commit?', list: commits_by_position).if_present do |v|
20
+ input('Which commit?', list: commits_by_position).if_present do |v|
21
21
  new_commit_info.fixup(v)
22
22
  end
23
23
  end
@@ -12,7 +12,7 @@ module Avm
12
12
  module Issue
13
13
  class Complete
14
14
  include ::EacRubyUtils::SimpleCache
15
- include ::EacCli::Speaker
15
+ enable_speaker
16
16
 
17
17
  attr_reader :skip_validations
18
18
 
@@ -13,12 +13,8 @@ module Avm
13
13
 
14
14
  def banner
15
15
  infov 'Revision to test', sha1
16
- on_speaker_node do |node|
17
- node.stderr_line_prefix = ' '
18
- infov '* Subject', commit.subject
19
- infov '* Success?', successful_label
20
- infov '* STDOUT', stdout_cache.content_path
21
- infov '* STDERR', stderr_cache.content_path
16
+ ::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new(err_line_prefix: ' ')) do
17
+ revision_banner
22
18
  end
23
19
  end
24
20
 
@@ -49,6 +45,13 @@ module Avm
49
45
  ::File.expand_path(git.to_s)
50
46
  end
51
47
 
48
+ def revision_banner
49
+ infov '* Subject', commit.subject
50
+ infov '* Success?', successful_label
51
+ infov '* STDOUT', stdout_cache.content_path
52
+ infov '* STDERR', stderr_cache.content_path
53
+ end
54
+
52
55
  def root_cache
53
56
  ::Avm.fs_cache.child('git', 'revision_test', git_absolute_path.parameterize, sha1,
54
57
  options.fetch(:test_command).to_s.parameterize)
@@ -13,7 +13,7 @@ module Avm
13
13
  module Launcher
14
14
  class Context
15
15
  include ::EacRubyUtils::SimpleCache
16
- include ::EacCli::Speaker
16
+ enable_speaker
17
17
 
18
18
  DEFAULT_PROJECTS_ROOT = '.'
19
19
  DEFAULT_SETTINGS_FILE = ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
@@ -10,7 +10,7 @@ module Avm
10
10
  module Git
11
11
  class PublishBase < ::Avm::Launcher::Publish::Base
12
12
  include ::EacRubyUtils::SimpleCache
13
- include ::EacCli::Speaker
13
+ enable_speaker
14
14
 
15
15
  CHECKERS = %w[remote_url remote_fetch publish_remote_no_exist remote_equal remote_following
16
16
  local_following].freeze
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'base/cache'
4
4
  require 'avm/launcher/errors/non_project'
5
+ require 'eac_ruby_utils/speaker/sender'
5
6
 
6
7
  module Avm
7
8
  module Launcher
@@ -10,7 +11,7 @@ module Avm
10
11
  class << self
11
12
  def extend_object(object)
12
13
  object.extend ::EacRubyUtils::SimpleCache
13
- object.extend ::EacCli::Speaker
14
+ object.extend ::EacRubyUtils::Speaker::Sender
14
15
  object.extend ::Avm::Launcher::Instances::Base::Cache
15
16
  super
16
17
  end
@@ -10,7 +10,7 @@ module Avm
10
10
  module Ruby
11
11
  module Gem
12
12
  class Build
13
- include ::EacCli::Speaker
13
+ enable_speaker
14
14
 
15
15
  def initialize(original_gem_root)
16
16
  @original_gem_root = original_gem_root
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Projects
7
+ module Stereotype
8
+ class JobComparator
9
+ common_constructor :job1, :job2
10
+
11
+ def result
12
+ return -1 if run_before?(job1, job2)
13
+ return 1 if run_before?(job2, job1)
14
+
15
+ job1.object_id <=> job2.class.name
16
+ end
17
+
18
+ private
19
+
20
+ def run_before?(a_job, other_job)
21
+ return false unless a_job.respond_to?(:run_before)
22
+
23
+ a_job.run_before.map(&:to_sym).include?(job_stereotype_key(other_job))
24
+ end
25
+
26
+ def job_stereotype_key(job)
27
+ job.class.name.split('::')[0..-2].join('::').demodulize.variableize.to_sym
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -19,8 +19,7 @@ module Avm
19
19
  clean_all
20
20
  selected_subrepos.map do |f|
21
21
  infov 'Subrepo', f
22
- on_speaker_node do |node|
23
- node.stderr_line_prefix = ' '
22
+ ::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new(err_line_prefix: ' ')) do
24
23
  ::Avm::Projects::Stereotypes::Git::Update::Subrepo.new(self, f).run
25
24
  end
26
25
  end
@@ -15,7 +15,7 @@ module Avm
15
15
  class RubyGem
16
16
  class Publish < ::Avm::Launcher::Publish::Base
17
17
  include ::EacRubyUtils::SimpleCache
18
- include ::EacCli::Speaker
18
+ enable_speaker
19
19
 
20
20
  protected
21
21
 
@@ -19,6 +19,10 @@ module Avm
19
19
  gemfile_lock_commit
20
20
  end
21
21
 
22
+ def run_before
23
+ [:git]
24
+ end
25
+
22
26
  private
23
27
 
24
28
  def bundle_update
@@ -44,7 +44,7 @@ module Avm
44
44
  end
45
45
 
46
46
  def confirm?
47
- parsed.yes? || request_input('Confirm version bump?', bool: true)
47
+ parsed.yes? || input('Confirm version bump?', bool: true)
48
48
  end
49
49
 
50
50
  def current_version_uncached
@@ -58,7 +58,7 @@ module Avm
58
58
  return true if parsed.yes?
59
59
  return false if parsed.no?
60
60
 
61
- request_input('Confirm operations?', bool: true)
61
+ input('Confirm operations?', bool: true)
62
62
  end
63
63
 
64
64
  def repository_uncached
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.101.0'
5
+ VERSION = '0.102.0'
6
6
  end
7
7
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'eac_ruby_utils', '~> 0.58', '>= 0.58.1'
15
+ s.add_dependency 'eac_ruby_utils', '~> 0.67'
16
16
 
17
17
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
18
18
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency 'colorize', '~> 0.8.1'
16
16
  s.add_dependency 'docopt', '~> 0.6.1'
17
17
  s.add_dependency 'eac_config', '~> 0.3'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.64'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.67'
19
19
 
20
20
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
21
21
  end
@@ -10,7 +10,7 @@ module EacCli
10
10
  require_sub __FILE__, include_modules: true
11
11
  enable_listable
12
12
  enable_simple_cache
13
- include ::EacCli::Speaker
13
+ enable_speaker
14
14
 
15
15
  common_constructor :config, :path, :options do
16
16
  self.path = ::EacConfig::EntryPath.assert(path)
@@ -18,7 +18,7 @@ module EacCli
18
18
  end
19
19
 
20
20
  def undefined_value_no_loop
21
- request_input("Value for entry \"#{path}\"", options.request_input_options)
21
+ input("Value for entry \"#{path}\"", options.request_input_options)
22
22
  end
23
23
  end
24
24
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'eac_cli/patches/module/speaker'
5
4
 
6
5
  module EacCli
7
6
  class OldConfigs
@@ -70,8 +70,8 @@ module EacCli
70
70
  end
71
71
 
72
72
  def entry_value_from_input(entry_key, options)
73
- entry_value = request_input("Value for entry \"#{entry_key}\"",
74
- options.request_input_options)
73
+ entry_value = input("Value for entry \"#{entry_key}\"",
74
+ options.request_input_options)
75
75
  warn('Entered value is blank') if entry_value.blank?
76
76
  entry_value
77
77
  end
@@ -1,26 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'colorize'
4
- require 'io/console'
5
- require 'eac_ruby_utils/patches/hash/options_consumer'
6
- require 'eac_ruby_utils/require_sub'
7
- ::EacRubyUtils.require_sub __FILE__
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/speaker/receiver'
8
6
 
9
7
  module EacCli
10
- # https://github.com/fazibear/colorize
11
- module Speaker
12
- def on_speaker_node(&block)
13
- ::EacCli::Speaker.on_node(&block)
8
+ class Speaker
9
+ require_sub __FILE__, include_modules: true
10
+ include ::EacRubyUtils::Speaker::Receiver
11
+
12
+ common_constructor :options, default: [{}] do
13
+ self.options = self.class.lists.option.hash_keys_validate!(options)
14
14
  end
15
15
 
16
16
  def puts(string = '')
17
17
  string.to_s.each_line do |line|
18
- current_node.stderr.puts(current_node.stderr_line_prefix.to_s + line)
18
+ err_out.puts(err_line_prefix.to_s + line)
19
19
  end
20
20
  end
21
21
 
22
22
  def out(string = '')
23
- current_node.stdout.write(string.to_s)
23
+ out_out.write(string.to_s)
24
24
  end
25
25
 
26
26
  def fatal_error(string)
@@ -52,7 +52,7 @@ module EacCli
52
52
  # +bool+ ([Boolean], default: +false+): requires a answer "yes" or "no".
53
53
  # +list+ ([Hash] or [Array], default: +nil+): requires a answer from a list.
54
54
  # +noecho+ ([Boolean], default: +false+): does not output answer.
55
- def request_input(question, options = {})
55
+ def input(question, options = {})
56
56
  bool, list, noecho = options.to_options_consumer.consume_all(:bool, :list, :noecho)
57
57
  if list
58
58
  request_from_list(question, list, noecho)
@@ -110,22 +110,18 @@ module EacCli
110
110
  end
111
111
 
112
112
  def request_string(question, noecho)
113
- current_node.stderr.write "#{question}: ".to_s.yellow
113
+ err_out.write "#{question}: ".to_s.yellow
114
114
  noecho ? request_string_noecho : request_string_echo
115
115
  end
116
116
 
117
117
  def request_string_noecho
118
- r = current_node.stdin.noecho(&:gets).chomp.strip
119
- current_node.stderr.write("\n")
118
+ r = in_in.noecho(&:gets).chomp.strip
119
+ err_out.write("\n")
120
120
  r
121
121
  end
122
122
 
123
123
  def request_string_echo
124
- current_node.stdin.gets.chomp.strip
125
- end
126
-
127
- def current_node
128
- ::EacCli::Speaker.current_node
124
+ in_in.gets.chomp.strip
129
125
  end
130
126
  end
131
127
  end
@@ -4,7 +4,7 @@ require 'eac_ruby_utils/by_reference'
4
4
 
5
5
  module EacCli
6
6
  # https://github.com/fazibear/colorize
7
- module Speaker
7
+ class Speaker
8
8
  STDERR = ::EacRubyUtils::ByReference.new { $stderr }
9
9
  STDIN = ::EacRubyUtils::ByReference.new { $stdin }
10
10
  STDOUT = ::EacRubyUtils::ByReference.new { $stdout }
@@ -4,7 +4,7 @@ require 'active_support/hash_with_indifferent_access'
4
4
  require 'ostruct'
5
5
 
6
6
  module EacCli
7
- module Speaker
7
+ class Speaker
8
8
  class List
9
9
  class << self
10
10
  def build(list)
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacCli
6
+ class Speaker
7
+ module Options
8
+ common_concern do
9
+ enable_listable
10
+ lists.add_symbol :option, :out_out, :err_out, :in_in, :parent, :err_line_prefix
11
+ end
12
+
13
+ def err_out
14
+ option(OPTION_ERR_OUT, ::EacCli::Speaker::STDERR)
15
+ end
16
+
17
+ def out_out
18
+ option(OPTION_OUT_OUT, ::EacCli::Speaker::STDOUT)
19
+ end
20
+
21
+ def in_in
22
+ option(OPTION_IN_IN, ::EacCli::Speaker::STDIN)
23
+ end
24
+
25
+ def err_line_prefix
26
+ option(OPTION_ERR_LINE_PREFIX, '')
27
+ end
28
+
29
+ def parent
30
+ options[OPTION_PARENT]
31
+ end
32
+
33
+ def option(key, default)
34
+ options[key] || parent.if_present(default) { |v| v.send(__METHOD__) }
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
@@ -3,23 +3,19 @@
3
3
  require 'eac_cli/speaker'
4
4
 
5
5
  RSpec.describe ::EacCli::Speaker do
6
- let(:instance) do
7
- r = ::Object.new
8
- r.extend(described_class)
9
- r
10
- end
6
+ let(:instance) { described_class.new }
11
7
 
12
- describe '#request_input' do
8
+ describe '#input' do
13
9
  it 'recover value from hash list' do
14
10
  allow(instance).to receive(:request_string).and_return('opt1')
15
11
  list = { opt1: 'value1', opt2: 'value2' }
16
- expect(instance.request_input('Question', list: list)).to eq('value1')
12
+ expect(instance.input('Question', list: list)).to eq('value1')
17
13
  end
18
14
 
19
15
  it 'recover value from array list' do
20
16
  allow(instance).to receive(:request_string).and_return('OPT1')
21
17
  list = %w[opt1 opt2]
22
- expect(instance.request_input('Question', list: list)).to eq('opt1')
18
+ expect(instance.input('Question', list: list)).to eq('opt1')
23
19
  end
24
20
 
25
21
  {
@@ -28,7 +24,7 @@ RSpec.describe ::EacCli::Speaker do
28
24
  context "when bool: true and input is \"#{input}\"" do
29
25
  it "return #{expected}" do
30
26
  allow(instance).to receive(:request_string).and_return(input)
31
- expect(instance.request_input('Question', bool: true)).to eq(expected)
27
+ expect(instance.input('Question', bool: true)).to eq(expected)
32
28
  end
33
29
  end
34
30
  end
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'eac_cli', '~> 0.15', '>= 0.15.1'
15
+ s.add_dependency 'eac_cli', '~> 0.20'
16
16
  s.add_dependency 'eac_ruby_gems_utils', '~> 0.8'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.64'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.67'
18
18
 
19
19
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
20
20
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/speaker'
3
+ require 'eac_ruby_utils/core_ext'
4
4
  require 'eac_ruby_utils/settings_provider'
5
5
 
6
6
  module EacRubyBase0
7
7
  module JobsRunner
8
8
  common_concern do
9
- include ::EacCli::Speaker
9
+ enable_speaker
10
10
  include ::EacRubyUtils::SettingsProvider
11
11
  end
12
12
 
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_cli/core_ext'
4
+ require 'eac_cli/speaker'
5
+ require 'eac_ruby_utils/speaker'
4
6
 
5
7
  module EacRubyBase0
6
8
  module Runner
@@ -20,9 +22,7 @@ module EacRubyBase0
20
22
  end
21
23
 
22
24
  def run
23
- on_speaker_node do |node|
24
- node.stderr = ::StringIO.new if parsed.quiet?
25
- node.stdin = FailIfRequestInput.new if parsed.no_input?
25
+ ::EacRubyUtils::Speaker.context.on(build_speaker) do
26
26
  if parsed.version?
27
27
  show_version
28
28
  else
@@ -48,5 +48,14 @@ module EacRubyBase0
48
48
  end
49
49
  end
50
50
  end
51
+
52
+ private
53
+
54
+ def build_speaker
55
+ options = {}
56
+ options[:err_out] = ::StringIO.new if parsed.quiet?
57
+ options[:in_in] = FailIfRequestInput.new if parsed.no_input?
58
+ ::EacCli::Speaker.new(options)
59
+ end
51
60
  end
52
61
  end
@@ -22,7 +22,7 @@ module EacRubyBase0
22
22
  return false if parsed.no?
23
23
  return true if parsed.yes?
24
24
 
25
- request_input(
25
+ input(
26
26
  message || setting_value(:confirm_question_text, default: DEFAULT_CONFIRM_QUESTION_TEXT),
27
27
  bool: true
28
28
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.7.3'
4
+ VERSION = '0.7.4'
5
5
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.test_files = Dir['{spec}/**/*', '.rspec']
24
24
 
25
25
  s.add_dependency 'bundler', '~> 2.2', '>= 2.2.17'
26
- s.add_dependency 'eac_ruby_utils', '~> 0.29'
26
+ s.add_dependency 'eac_ruby_utils', '~> 0.67'
27
27
 
28
28
  # Tests
29
29
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/core_ext'
4
+
3
5
  module EacRubyGemsUtils
4
6
  module Tests
5
7
  class Multiple
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.9.3'
4
+ VERSION = '0.9.4'
5
5
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/speaker/sender'
4
+
5
+ class Module
6
+ def enable_speaker
7
+ include ::EacRubyUtils::Speaker::Sender
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/contextualizable'
4
+
5
+ module EacRubyUtils
6
+ module Speaker
7
+ include ::EacRubyUtils::Contextualizable
8
+
9
+ class << self
10
+ # @return [EacRubyUtils::Speaker::Receiver]
11
+ def current_receiver
12
+ context.current
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/abstract_methods'
4
+
5
+ module EacRubyUtils
6
+ module Speaker
7
+ module Receiver
8
+ extend ::EacRubyUtils::AbstractMethods
9
+
10
+ def error(_string)
11
+ raise_abstract_method(__FILE__)
12
+ end
13
+
14
+ def fatal_error(string)
15
+ error(string)
16
+ ::Kernel.exit 1 # rubocop:disable Rails/Exit
17
+ end
18
+
19
+ # @see EacRubyUtils::Speaker::Sender.input
20
+ def input(_question, _options = {})
21
+ raise_abstract_method(__FILE__)
22
+ end
23
+
24
+ def info(_string)
25
+ raise_abstract_method(__FILE__)
26
+ end
27
+
28
+ def infom(_string)
29
+ raise_abstract_method(__FILE__)
30
+ end
31
+
32
+ def infov(*_args)
33
+ raise_abstract_method(__FILE__)
34
+ end
35
+
36
+ def out(_string = '')
37
+ raise_abstract_method(__FILE__)
38
+ end
39
+
40
+ def puts(_string = '')
41
+ raise_abstract_method(__FILE__)
42
+ end
43
+
44
+ def success(_string)
45
+ raise_abstract_method(__FILE__)
46
+ end
47
+
48
+ def title(_string)
49
+ raise_abstract_method(__FILE__)
50
+ end
51
+
52
+ def warn(_string)
53
+ raise_abstract_method(__FILE__)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ module Speaker
5
+ module Sender
6
+ delegate :error, :fatal_error, :info, :infom, :title, :success, :warn, to: :speaker_receiver
7
+
8
+ def infov(*args)
9
+ speaker_receiver.infov(*args)
10
+ end
11
+
12
+ delegate :out, to: :speaker_receiver
13
+
14
+ delegate :puts, to: :speaker_receiver
15
+
16
+ # Shortcut to [EacRubyUtils::Speaker.current_receiver].
17
+ #
18
+ # @return [EacRubyUtils::Speaker::Receiver]
19
+ def speaker_receiver
20
+ ::EacRubyUtils::Speaker.current_receiver
21
+ end
22
+
23
+ # Options:
24
+ # +bool+ ([Boolean], default: +false+): requires a answer "yes" or "no".
25
+ # +list+ ([Hash] or [Array], default: +nil+): requires a answer from a list.
26
+ # +noecho+ ([Boolean], default: +false+): does not output answer.
27
+ def input(question, options = {})
28
+ speaker_receiver.input(question, options)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.66.0'
4
+ VERSION = '0.67.0'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/patches/module/speaker'
3
+ require 'eac_ruby_utils/patches/module/speaker'
4
4
 
5
5
  RSpec.describe ::Module do
6
6
  class StubClass # rubocop:disable RSpec/LeakyConstantDeclaration
@@ -8,6 +8,6 @@ RSpec.describe ::Module do
8
8
  end
9
9
 
10
10
  describe '#enable_speaker' do
11
- it { expect(StubClass.included_modules).to include(::EacCli::Speaker) }
11
+ it { expect(StubClass.included_modules).to include(::EacRubyUtils::Speaker::Sender) }
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.101.0
4
+ version: 0.102.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2021-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -549,6 +549,7 @@ files:
549
549
  - lib/avm/postgresql/instance_with.rb
550
550
  - lib/avm/projects.rb
551
551
  - lib/avm/projects/stereotype.rb
552
+ - lib/avm/projects/stereotype/job_comparator.rb
552
553
  - lib/avm/projects/stereotypes.rb
553
554
  - lib/avm/projects/stereotypes/git.rb
554
555
  - lib/avm/projects/stereotypes/git/local_project_mixin.rb
@@ -756,8 +757,6 @@ files:
756
757
  - vendor/eac_cli/lib/eac_cli/parser/collector.rb
757
758
  - vendor/eac_cli/lib/eac_cli/parser/error.rb
758
759
  - vendor/eac_cli/lib/eac_cli/patches.rb
759
- - vendor/eac_cli/lib/eac_cli/patches/module.rb
760
- - vendor/eac_cli/lib/eac_cli/patches/module/speaker.rb
761
760
  - vendor/eac_cli/lib/eac_cli/patches/object.rb
762
761
  - vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb
763
762
  - vendor/eac_cli/lib/eac_cli/runner.rb
@@ -771,10 +770,9 @@ files:
771
770
  - vendor/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb
772
771
  - vendor/eac_cli/lib/eac_cli/runner_with_set.rb
773
772
  - vendor/eac_cli/lib/eac_cli/speaker.rb
774
- - vendor/eac_cli/lib/eac_cli/speaker/_class_methods.rb
775
773
  - vendor/eac_cli/lib/eac_cli/speaker/_constants.rb
776
774
  - vendor/eac_cli/lib/eac_cli/speaker/list.rb
777
- - vendor/eac_cli/lib/eac_cli/speaker/node.rb
775
+ - vendor/eac_cli/lib/eac_cli/speaker/options.rb
778
776
  - vendor/eac_cli/lib/eac_cli/version.rb
779
777
  - vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb
780
778
  - vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
@@ -785,7 +783,6 @@ files:
785
783
  - vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
786
784
  - vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb
787
785
  - vendor/eac_cli/spec/lib/eac_cli/speaker_spec.rb
788
- - vendor/eac_cli/spec/lib/module/speaker_spec.rb
789
786
  - vendor/eac_cli/spec/rubocop_spec.rb
790
787
  - vendor/eac_cli/spec/spec_helper.rb
791
788
  - vendor/eac_config/Gemfile
@@ -1203,6 +1200,7 @@ files:
1203
1200
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb
1204
1201
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb
1205
1202
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/simple_cache.rb
1203
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb
1206
1204
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object.rb
1207
1205
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb
1208
1206
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb
@@ -1230,6 +1228,9 @@ files:
1230
1228
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb
1231
1229
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb
1232
1230
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb
1231
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb
1232
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb
1233
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb
1233
1234
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb
1234
1235
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb
1235
1236
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb
@@ -1256,6 +1257,7 @@ files:
1256
1257
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/sym_keys_hash_spec.rb
1257
1258
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb
1258
1259
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb
1260
+ - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/speaker_spec.rb
1259
1261
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
1260
1262
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec_files/path/my_stub_with_template
1261
1263
  - vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_sub_spec.rb
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_cli/speaker'
4
- require 'eac_ruby_utils/patch'
5
-
6
- class Module
7
- def enable_speaker
8
- ::EacRubyUtils.patch(self, ::EacCli::Speaker)
9
- end
10
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_cli/speaker/node'
4
-
5
- module EacCli
6
- module Speaker
7
- class << self
8
- def current_node
9
- nodes_stack.last
10
- end
11
-
12
- def on_node(&block)
13
- push
14
- yield(*(block.arity.zero? ? [] : [current_node]))
15
- ensure
16
- pop
17
- end
18
-
19
- def push
20
- nodes_stack << ::EacCli::Speaker::Node.new
21
- current_node
22
- end
23
-
24
- def pop
25
- return nodes_stack.pop if nodes_stack.count > 1
26
-
27
- raise "Cannot remove first node (nodes_stack.count: #{nodes_stack.count})"
28
- end
29
-
30
- private
31
-
32
- def nodes_stack
33
- @nodes_stack ||= [::EacCli::Speaker::Node.new]
34
- end
35
- end
36
- end
37
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/patches/object/if_present'
4
- require 'eac_cli/speaker/_constants'
5
-
6
- module EacCli
7
- module Speaker
8
- class Node
9
- attr_accessor :stdin, :stdout, :stderr, :stderr_line_prefix
10
-
11
- def initialize(parent = nil)
12
- self.stdin = parent.if_present(::EacCli::Speaker::STDIN, &:stdin)
13
- self.stdout = parent.if_present(::EacCli::Speaker::STDOUT, &:stdout)
14
- self.stderr = parent.if_present(::EacCli::Speaker::STDERR, &:stderr)
15
- self.stderr_line_prefix = parent.if_present('', &:stderr_line_prefix)
16
- end
17
-
18
- def configure
19
- yield(self)
20
- self
21
- end
22
- end
23
- end
24
- end