avm-tools 0.94.3 → 0.95.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/ruby/bundler.rb +11 -0
  3. data/lib/avm/ruby/bundler/incompatible_parser.rb +25 -0
  4. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +25 -0
  5. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +39 -0
  6. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +19 -0
  7. data/lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb +73 -0
  8. data/lib/avm/ruby/bundler/incompatible_parser/line_factory.rb +31 -0
  9. data/lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb +19 -0
  10. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +26 -0
  11. data/lib/avm/ruby/gems/generator.rb +1 -5
  12. data/lib/avm/tools/runner/local_project/ruby/bundler/incompatible.rb +84 -0
  13. data/lib/avm/tools/version.rb +1 -1
  14. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -5
  15. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -0
  16. data/vendor/avm-apps/avm-apps.gemspec +1 -1
  17. data/vendor/avm-apps/lib/avm/apps/version.rb +1 -1
  18. data/vendor/avm-apps/spec/rubocop_spec.rb +1 -5
  19. data/vendor/avm-apps/spec/spec_helper.rb +3 -0
  20. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  21. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +3 -1
  22. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  23. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
  24. data/vendor/eac_cli/spec/spec_helper.rb +3 -0
  25. data/vendor/eac_docker/eac_docker.gemspec +1 -1
  26. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  27. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
  28. data/vendor/eac_docker/spec/spec_helper.rb +3 -0
  29. data/vendor/eac_git/eac_git.gemspec +1 -1
  30. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  31. data/vendor/eac_git/spec/rubocop_spec.rb +1 -5
  32. data/vendor/eac_git/spec/spec_helper.rb +2 -0
  33. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +1 -1
  34. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
  35. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  36. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
  37. data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
  38. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
  39. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  40. data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +1 -5
  41. data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +3 -0
  42. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  43. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
  44. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
  45. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
  46. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
  47. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  48. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
  49. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
  50. data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
  51. metadata +17 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 266e7f05ba459608c81b684bb675e5efab20d7be043e59424398a3c810cf1db9
4
- data.tar.gz: f9b04149ba95fa4cd4b4aba277118918351727999ed1a363b4782f0cd5ffcd96
3
+ metadata.gz: 43ee05798fe159fe0fffa66e10aa7260aa8e29a7fe7f37786b29a89b051f600b
4
+ data.tar.gz: 86dbc1695a7dfe69cf4c33d2d5aae928a7cc05448305e41f4a23205636ea39ff
5
5
  SHA512:
6
- metadata.gz: 1b2028e2aa894113dcbcee37742d302d1e12a363fddd5b569da22d84ea6c9e8f49ce87e9675af1bf8cef0b1a5d9e11dc94c969f61e71ff6ab1164371b145e987
7
- data.tar.gz: 356839265fa90cc3d360af76194562840fa88aea67f0743814f22044263903fa5007b6617878610e19e43763bc5e238c6a37b697c379cccdf376ff61596ce1fa
6
+ metadata.gz: 52f50815a47e9373174a9f6b39e64d0f16cc5a6cf2a39f5bd540f1f90f3bbad6e3361607cdd7a37d225f746bb7f36717e99b344fbd35882f64013c33d56b5e51
7
+ data.tar.gz: dc15c004e0c6c67ebcaaa7b230c0210c5fbde1ca567a1b405fbea7148732b998f3919c74815be22ded25cd21cffbf4a3e0b6d82406a78e507dc89d6ff4fd41e8
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Ruby
7
+ module Bundler
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Ruby
7
+ module Bundler
8
+ class IncompatibleParser
9
+ require_sub __FILE__
10
+
11
+ enable_simple_cache
12
+ attr_reader :gems_in_conflict
13
+
14
+ def initialize(path)
15
+ @gems_in_conflict = ::Avm::Ruby::Bundler::IncompatibleParser::LineBuffer
16
+ .from_file(path).gems_in_conflict.freeze
17
+ end
18
+
19
+ def data
20
+ gems_in_conflict.map(&:data)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
5
+
6
+ module Avm
7
+ module Ruby
8
+ module Bundler
9
+ class IncompatibleParser
10
+ class DependsOn < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /(.+) was resolved to (.+), which depends on/
12
+ .to_parser { |m| new(m[1], m[2]) }
13
+
14
+ common_constructor :gem_name, :version do
15
+ self.version = ::Gem::Version.new(version)
16
+ end
17
+
18
+ def data
19
+ { gem_name: gem_name, version: version }
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
5
+
6
+ module Avm
7
+ module Ruby
8
+ module Bundler
9
+ class IncompatibleParser
10
+ class GemConflict < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /Bundler could not find compatible versions for gem "(.+)":/
12
+ .to_parser { |m| new(m[1]) }
13
+
14
+ enable_simple_cache
15
+ common_constructor :gem_name
16
+
17
+ def add_depends_on(depends_on)
18
+ @depends_on_stack ||= []
19
+ @depends_on_stack << depends_on
20
+ end
21
+
22
+ def add_version_requirement(version_requirement)
23
+ version_requirement.stack = @depends_on_stack
24
+ versions_requirements << version_requirement
25
+ @depends_on_stack = nil
26
+ end
27
+
28
+ def data
29
+ { gem_name: gem_name, versions_requirements: versions_requirements.map(&:data) }
30
+ end
31
+
32
+ def versions_requirements
33
+ @versions_requirements ||= []
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
5
+
6
+ module Avm
7
+ module Ruby
8
+ module Bundler
9
+ class IncompatibleParser
10
+ class InGemfile < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /In Gemfile:/
12
+ .to_parser { |_m| new }
13
+
14
+ common_constructor
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/gem_conflict'
5
+ require 'avm/ruby/bundler/incompatible_parser/line_factory'
6
+
7
+ module Avm
8
+ module Ruby
9
+ module Bundler
10
+ class IncompatibleParser
11
+ class LineBuffer
12
+ class << self
13
+ def from_file(path)
14
+ new(::File.read(path.to_s))
15
+ end
16
+ end
17
+
18
+ attr_reader :gems_in_conflict
19
+
20
+ def initialize(content)
21
+ self.gems_in_conflict = []
22
+ self.parsing_required = false
23
+ content.each_line { |string_line| add_line(LineFactory.new(string_line)) }
24
+ end
25
+
26
+ private
27
+
28
+ attr_accessor :parsing_required
29
+ attr_writer :gems_in_conflict
30
+
31
+ def add_line(line)
32
+ return if line.blank?
33
+
34
+ return if LineFactory::TYPES.any? do |type|
35
+ next false unless line.result.is_a?(type)
36
+
37
+ send("on_#{type.name.demodulize.underscore.variableize}_line", line.result)
38
+ true
39
+ end
40
+
41
+ return unless parsing_required
42
+
43
+ raise(::ArgumentError, "Unparsed line: \"#{line.content}\"")
44
+ end
45
+
46
+ def on_gem_conflict_line(result)
47
+ self.parsing_required = true
48
+ gems_in_conflict << result
49
+ end
50
+
51
+ def on_in_gemfile_line(result)
52
+ # Do nothing
53
+ end
54
+
55
+ def on_depends_on_line(result)
56
+ current_gem_conflict.add_depends_on(result)
57
+ end
58
+
59
+ def on_version_requirement_line(result)
60
+ current_gem_conflict.add_version_requirement(result)
61
+ end
62
+
63
+ def current_gem_conflict
64
+ raise 'No gems in conflict' if gems_in_conflict.none?
65
+ raise 'Last gem is blank' if gems_in_conflict.last.blank?
66
+
67
+ gems_in_conflict.last
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/depends_on'
5
+ require 'avm/ruby/bundler/incompatible_parser/gem_conflict'
6
+ require 'avm/ruby/bundler/incompatible_parser/in_gemfile'
7
+
8
+ module Avm
9
+ module Ruby
10
+ module Bundler
11
+ class IncompatibleParser
12
+ class LineFactory
13
+ TYPES = [GemConflict, InGemfile, DependsOn, VersionRequirement].freeze
14
+
15
+ enable_simple_cache
16
+ common_constructor :content do
17
+ self.content = content.strip
18
+ end
19
+
20
+ delegate :blank?, to: :content
21
+
22
+ private
23
+
24
+ def result_uncached
25
+ TYPES.lazy.map { |type| type.parse(content) }.find(&:present?)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Ruby
7
+ module Bundler
8
+ class IncompatibleParser
9
+ class LineParserBase
10
+ class << self
11
+ def parse(line_content)
12
+ const_get('LINE_PARSER').parse(line_content)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
5
+
6
+ module Avm
7
+ module Ruby
8
+ module Bundler
9
+ class IncompatibleParser
10
+ class VersionRequirement < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /\A([a-z][a-z_0-9]*)(?: \((.+)\))?\z/
12
+ .to_parser { |m| new(m[1], m[2]) }
13
+
14
+ enable_simple_cache
15
+ attr_accessor :stack
16
+
17
+ common_constructor :gem_name, :requirements_source
18
+
19
+ def data
20
+ { requirements_source: requirements_source, stack: stack.map(&:data) }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -8,7 +8,7 @@ module Avm
8
8
  module Gems
9
9
  class Generator
10
10
  IDENT = ' '
11
- JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock rspec].freeze
11
+ JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
12
12
  TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
13
13
 
14
14
  enable_console_speaker
@@ -92,10 +92,6 @@ module Avm
92
92
  template_apply('root_lib', "lib/#{lib_path}.rb")
93
93
  end
94
94
 
95
- def generate_rspec
96
- self_gem.bundle('exec', 'rspec').chdir_root.execute!
97
- end
98
-
99
95
  def generate_static
100
96
  template.child('static').apply(self, root_directory)
101
97
  end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/fs_cache'
4
+ require 'avm/ruby/bundler/incompatible_parser'
5
+ require 'eac_ruby_base0/core_ext'
6
+
7
+ module Avm
8
+ module Tools
9
+ class Runner
10
+ class LocalProject
11
+ class Ruby
12
+ class Bundler
13
+ class Incompatible
14
+ runner_with :help do
15
+ desc 'Identify incompatible gems in a "Gemfile.lock" file.'
16
+ bool_opt '-l', '--last', 'Process the last \"bundle update\" result.'
17
+ end
18
+
19
+ def run
20
+ infov 'Cache path', fs_cache.content_path
21
+ infov 'Cached?', fs_cache.cached?
22
+ parser.gems_in_conflict.each do |gem_in_conflict|
23
+ print_gem_in_conflict(gem_in_conflict)
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def bundle_update
30
+ infom 'Running "bundle update"...'
31
+ instance.ruby_gem.bundle('update').execute[:stdout]
32
+ end
33
+
34
+ def content_path
35
+ fs_cache.write(bundle_update) unless fs_cache.cached? && parsed.last?
36
+ fs_cache.content_path
37
+ end
38
+
39
+ def fs_cache_uncached
40
+ ::Avm.fs_cache.child(self.class.name.variableize)
41
+ .child(instance.path.to_s.variableize)
42
+ end
43
+
44
+ def gem_title(gem_in_conflict)
45
+ gem_in_conflict.gem_name
46
+ end
47
+
48
+ def instance
49
+ runner_context.call(:instance)
50
+ end
51
+
52
+ def parser_uncached
53
+ ::Avm::Ruby::Bundler::IncompatibleParser.new(content_path)
54
+ end
55
+
56
+ def print_gem_in_conflict(gem_in_conflict)
57
+ infov 'Gem', gem_title(gem_in_conflict)
58
+ gem_in_conflict.versions_requirements.each do |requirement|
59
+ print_requirement(requirement)
60
+ end
61
+ end
62
+
63
+ def print_requirement(req)
64
+ infov ' ' + requirement_title(req), requirement_value(req)
65
+ end
66
+
67
+ def requirement_stack(req)
68
+ req.stack.map { |d| "#{d.gem_name} (#{d.version})" }.join(' > '.green)
69
+ end
70
+
71
+ def requirement_title(req)
72
+ req.requirements_source.if_present('*')
73
+ end
74
+
75
+ def requirement_value(req)
76
+ requirement_stack(req)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.94.3'
5
+ VERSION = '0.95.0'
6
6
  end
7
7
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,4 +97,6 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+ require 'eac_ruby_gem_support/rspec'
101
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__))
100
102
  end
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'eac_ruby_utils', '~> 0.58', '>= 0.58.1'
16
16
 
17
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
17
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
18
18
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Apps
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,4 +97,7 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
103
  end
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'eac_ruby_utils', '~> 0.55'
16
16
 
17
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
17
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
18
18
  end
@@ -36,7 +36,9 @@ module EacCli
36
36
  end
37
37
 
38
38
  def option_definition(option)
39
- self.class.option_usage_full(option) + OPTION_DESC_SEP + option.description
39
+ self.class.option_usage_full(option) + option.description.if_present('') do |v|
40
+ OPTION_DESC_SEP + v
41
+ end
40
42
  end
41
43
 
42
44
  def section(header, include_header = true)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.16.1'
4
+ VERSION = '0.16.3'
5
5
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,4 +97,7 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
103
  end
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'eac_ruby_utils', '~> 0.36'
16
16
 
17
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.1'
17
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacDocker
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,6 +97,9 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
103
  end
101
104
 
102
105
  require 'eac_docker/rspec'
@@ -16,5 +16,5 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'parseconfig', '~> 1.0', '>= 1.0.8'
17
17
 
18
18
  s.add_development_dependency 'aranha-parsers', '~> 0.7'
19
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
20
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,6 +97,8 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+ require 'eac_ruby_gem_support/rspec'
101
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
102
  end
101
103
 
102
104
  require 'eac_git/rspec'
@@ -16,5 +16,5 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'eac_ruby_gems_utils', '~> 0.8'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.60'
18
18
 
19
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
20
20
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/abstract_methods'
6
+
7
+ module EacRubyBase0
8
+ module RunnerWith
9
+ module Input
10
+ STDIN_OPTION = '-'
11
+ BLANK_OPTION = '+'
12
+ DEFAULT_DEFAULT_INPUT_OPTION = BLANK_OPTION
13
+
14
+ common_concern do
15
+ enable_settings_provider
16
+ include ::EacCli::Runner
17
+
18
+ runner_definition do
19
+ arg_opt '-i', '--input', 'Input from file.'
20
+ end
21
+ end
22
+
23
+ def input_content
24
+ case input_option
25
+ when STDIN_OPTION then $stdin.read
26
+ when BLANK_OPTION then ''
27
+ else input_option.to_pathname.read
28
+ end
29
+ end
30
+
31
+ def input_option
32
+ parsed.input || setting_value(:default_input_option, default: DEFAULT_DEFAULT_INPUT_OPTION)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.6.0'
4
+ VERSION = '0.7.1'
5
5
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,4 +97,7 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
103
  end
@@ -25,5 +25,5 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'eac_ruby_utils', '~> 0.29'
26
26
 
27
27
  # Tests
28
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1'
28
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
29
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.9.0'
4
+ VERSION = '0.9.1'
5
5
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop do
6
- include_examples 'rubocop_check', ::File.expand_path('../..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,4 +97,7 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
103
  end
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'docopt', '~> 0.6.1'
22
22
  s.add_dependency 'filesize'
23
23
  s.add_dependency 'net-ssh', '~> 4.2'
24
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.1'
24
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
25
25
  end
@@ -24,6 +24,12 @@ module EacRubyUtils
24
24
  ::File.read(content_path)
25
25
  end
26
26
 
27
+ def read_or_cache
28
+ write(yield) unless cached?
29
+
30
+ read
31
+ end
32
+
27
33
  def write(value)
28
34
  assert_directory_on_path
29
35
  ::File.write(content_path, value)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/regexp_parser'
4
+
5
+ class Regexp
6
+ # @return [::EacRubyUtils::RegexpParser]
7
+ def to_parser(&block)
8
+ ::EacRubyUtils::RegexpParser.new(self, &block)
9
+ end
10
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ class RegexpParser
5
+ attr_reader :pattern, :builder_proc
6
+
7
+ def initialize(pattern, &builder_proc)
8
+ @pattern = pattern
9
+ @builder_proc = builder_proc
10
+ end
11
+
12
+ def parse(string)
13
+ internal_parse(string)[1]
14
+ end
15
+
16
+ def parse!(string)
17
+ match, result = internal_parse(string)
18
+ return result if match
19
+
20
+ raise ::ArgumentError, "String \"#{string}\" does not match pattern \"#{pattern}\""
21
+ end
22
+
23
+ private
24
+
25
+ def internal_parse(string)
26
+ m = pattern.match(string)
27
+ if m
28
+ [true, builder_proc ? builder_proc.call(m) : m]
29
+ else
30
+ [false, nil]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -2,12 +2,18 @@
2
2
 
3
3
  module EacRubyUtils
4
4
  module SimpleCache
5
- UNCACHED_METHOD_PATTERN = /\A(\s+)_uncached\z/.freeze
5
+ UNCACHED_METHOD_NAME_SUFFIX = '_uncached'
6
+ UNCACHED_METHOD_PATTERN = /\A(\s+)_#{::Regexp.quote(UNCACHED_METHOD_NAME_SUFFIX)}\z/.freeze
7
+
8
+ class << self
9
+ def uncached_method_name(method_name)
10
+ "#{method_name}#{UNCACHED_METHOD_NAME_SUFFIX}"
11
+ end
12
+ end
6
13
 
7
14
  def method_missing(method, *args, &block)
8
- uncached_method = "#{method}_uncached"
9
- if respond_to?(uncached_method, true)
10
- call_method_with_cache(uncached_method, args, &block)
15
+ if respond_to?(::EacRubyUtils::SimpleCache.uncached_method_name(method), true)
16
+ call_method_with_cache(method, args, &block)
11
17
  else
12
18
  super
13
19
  end
@@ -35,10 +41,17 @@ module EacRubyUtils
35
41
  raise 'Não é possível realizar o cache de métodos com bloco' if block
36
42
 
37
43
  key = ([method] + args).join('@@@')
38
- cache_keys[key] = send(method, *args) unless cache_keys.key?(key)
44
+ unless cache_keys.key?(key)
45
+ uncached_value = call_uncached_method(method, args)
46
+ cache_keys[key] = uncached_value
47
+ end
39
48
  cache_keys[key]
40
49
  end
41
50
 
51
+ def call_uncached_method(method, args)
52
+ send(::EacRubyUtils::SimpleCache.uncached_method_name(method), *args)
53
+ end
54
+
42
55
  def cache_keys
43
56
  @cache_keys ||= {}
44
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.62.0'
4
+ VERSION = '0.63.0'
5
5
  end
@@ -16,6 +16,11 @@ class CacheableObject
16
16
  "#{arg1}/#{@counter2}"
17
17
  end
18
18
 
19
+ def method_with_reset_uncached
20
+ reset_cache
21
+ 'result'
22
+ end
23
+
19
24
  private
20
25
 
21
26
  def private_method_uncached
@@ -39,6 +44,10 @@ RSpec.describe ::EacRubyUtils::SimpleCache do
39
44
  it 'is able to call private uncached as cached' do
40
45
  expect(instance.private_method).to eq(instance.private_method)
41
46
  end
47
+
48
+ it 'return value even if reset cache' do
49
+ expect(instance.method_with_reset).to eq('result')
50
+ end
42
51
  end
43
52
 
44
53
  describe 'cache value with args' do
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -5,6 +5,9 @@ require 'tmpdir'
5
5
 
6
6
  RSpec.configure do |config|
7
7
  config.example_status_persistence_file_path = ::File.join(::Dir.tmpdir, 'eac_ruby_utils_rspec')
8
+
9
+ require 'eac_ruby_gem_support/rspec'
10
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
8
11
  end
9
12
 
10
13
  require 'i18n'
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.94.3
4
+ version: 0.95.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-04-01 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -98,20 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.1'
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: 0.1.2
101
+ version: '0.2'
105
102
  type: :development
106
103
  prerelease: false
107
104
  version_requirements: !ruby/object:Gem::Requirement
108
105
  requirements:
109
106
  - - "~>"
110
107
  - !ruby/object:Gem::Version
111
- version: '0.1'
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- version: 0.1.2
108
+ version: '0.2'
115
109
  - !ruby/object:Gem::Dependency
116
110
  name: eac_cli
117
111
  requirement: !ruby/object:Gem::Requirement
@@ -514,6 +508,15 @@ files:
514
508
  - lib/avm/rails.rb
515
509
  - lib/avm/result.rb
516
510
  - lib/avm/ruby.rb
511
+ - lib/avm/ruby/bundler.rb
512
+ - lib/avm/ruby/bundler/incompatible_parser.rb
513
+ - lib/avm/ruby/bundler/incompatible_parser/depends_on.rb
514
+ - lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb
515
+ - lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb
516
+ - lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb
517
+ - lib/avm/ruby/bundler/incompatible_parser/line_factory.rb
518
+ - lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb
519
+ - lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb
517
520
  - lib/avm/ruby/gems.rb
518
521
  - lib/avm/ruby/gems/generator.rb
519
522
  - lib/avm/ruby/rubocop.rb
@@ -570,6 +573,7 @@ files:
570
573
  - lib/avm/tools/runner/local_project/ruby.rb
571
574
  - lib/avm/tools/runner/local_project/ruby/bundler.rb
572
575
  - lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb
576
+ - lib/avm/tools/runner/local_project/ruby/bundler/incompatible.rb
573
577
  - lib/avm/tools/runner/local_project/test.rb
574
578
  - lib/avm/tools/runner/local_project/update.rb
575
579
  - lib/avm/tools/runner/local_project/version_bump.rb
@@ -951,6 +955,7 @@ files:
951
955
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb
952
956
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb
953
957
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
958
+ - vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb
954
959
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb
955
960
  - vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb
956
961
  - vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb
@@ -1109,6 +1114,7 @@ files:
1109
1114
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb
1110
1115
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp.rb
1111
1116
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/if_match.rb
1117
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb
1112
1118
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb
1113
1119
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb
1114
1120
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time.rb
@@ -1117,6 +1123,7 @@ files:
1117
1123
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb
1118
1124
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb
1119
1125
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb
1126
+ - vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb
1120
1127
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb
1121
1128
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec.rb
1122
1129
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb