avm-tools 0.93.0 → 0.95.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/eac_webapp_base0/instance.rb +5 -2
- data/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
- data/lib/avm/eac_webapp_base0/runner/data.rb +1 -0
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
- data/lib/avm/git/auto_commit/commit_info.rb +2 -1
- data/lib/avm/git/auto_commit/rules.rb +4 -4
- data/lib/avm/git/auto_commit/rules/new.rb +24 -0
- data/lib/avm/git/auto_commit/rules/nth.rb +8 -0
- data/lib/avm/git/auto_commit_path.rb +0 -21
- data/lib/avm/git/file_auto_fixup.rb +19 -3
- data/lib/avm/ruby/bundler.rb +11 -0
- data/lib/avm/ruby/bundler/incompatible_parser.rb +25 -0
- data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +25 -0
- data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +39 -0
- data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +19 -0
- data/lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb +73 -0
- data/lib/avm/ruby/bundler/incompatible_parser/line_factory.rb +31 -0
- data/lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb +19 -0
- data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +26 -0
- data/lib/avm/ruby/gems/generator.rb +1 -5
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
- data/lib/avm/tools/runner/git/auto_commit.rb +28 -28
- data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby.rb +2 -6
- data/lib/avm/tools/runner/local_project/ruby/bundler.rb +3 -7
- data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +10 -13
- data/lib/avm/tools/runner/local_project/ruby/bundler/incompatible.rb +84 -0
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -5
- data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -0
- data/vendor/avm-apps/avm-apps.gemspec +1 -1
- data/vendor/avm-apps/lib/avm/apps/version.rb +1 -1
- data/vendor/avm-apps/spec/rubocop_spec.rb +1 -5
- data/vendor/avm-apps/spec/spec_helper.rb +3 -0
- data/vendor/eac_cli/eac_cli.gemspec +1 -1
- data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +3 -1
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_cli/spec/spec_helper.rb +3 -0
- data/vendor/eac_docker/eac_docker.gemspec +1 -1
- data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
- data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_docker/spec/spec_helper.rb +3 -0
- data/vendor/eac_git/eac_git.gemspec +2 -1
- data/vendor/eac_git/lib/eac_git/local.rb +4 -0
- data/vendor/eac_git/lib/eac_git/local/commit.rb +53 -0
- data/vendor/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
- data/vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
- data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
- data/vendor/eac_git/lib/eac_git/rspec.rb +6 -1
- data/{lib/avm/git/spec_helper.rb → vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb} +16 -13
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
- data/vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
- data/vendor/eac_git/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_git/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
- data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +7 -10
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +9 -2
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +1 -5
- data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +3 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
- data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
- data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
- metadata +55 -15
- data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
@@ -7,11 +7,19 @@ module EacRubyUtils
|
|
7
7
|
class << self
|
8
8
|
VARIABLE_NAME_PATTERN = /[_a-z][_a-z0-9]*/i.freeze
|
9
9
|
|
10
|
-
|
10
|
+
# Convert a string to a variable format: first character as a lowercase letter or underscore
|
11
|
+
# and other as a lowercase letter, underscore or numbers.
|
12
|
+
# @param string [String] The source string.
|
13
|
+
# @param validate [Boolean] Affect the outcome when the result builded is not in a valid
|
14
|
+
# variable format. If `true`, it raises a {ArgumentError}. If `false`, return `nil`.
|
15
|
+
# @return [String, nil]
|
16
|
+
# @raise [ArgumentError]
|
17
|
+
def variableize(string, validate = true)
|
11
18
|
r = ::ActiveSupport::Inflector.transliterate(string).gsub(/[^_a-z0-9]/i, '_')
|
12
19
|
.gsub(/_+/, '_').gsub(/_\z/, '').gsub(/\A_/, '').downcase
|
13
20
|
m = VARIABLE_NAME_PATTERN.match(r)
|
14
21
|
return r if m
|
22
|
+
return nil unless validate
|
15
23
|
|
16
24
|
raise ::ArgumentError, "Invalid variable name \"#{r}\" was generated " \
|
17
25
|
"from string \"#{string}\""
|
@@ -54,8 +54,9 @@ module EacRubyUtils
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def value_validate!(value, error_class = ::StandardError)
|
57
|
-
value_valid?(value)
|
58
|
-
|
57
|
+
return value if value_valid?(value)
|
58
|
+
|
59
|
+
raise(error_class, "Invalid value: \"#{value}\" (Valid: #{values_to_s})")
|
59
60
|
end
|
60
61
|
|
61
62
|
def values_to_s
|
@@ -10,6 +10,7 @@ module EacRubyUtils
|
|
10
10
|
class << self
|
11
11
|
TIMEDATECTL_TIMEZONE_LINE_PATTERN = %r{\s*Time zone:\s*(\S+/\S+)\s}.freeze
|
12
12
|
|
13
|
+
# @return [ActiveSupport::TimeZone]
|
13
14
|
def auto
|
14
15
|
%w[tz_env debian_config offset].lazy.map { |s| send("by_#{s}") }.find(&:present?)
|
15
16
|
end
|
@@ -18,22 +19,27 @@ module EacRubyUtils
|
|
18
19
|
::Time.zone = auto
|
19
20
|
end
|
20
21
|
|
22
|
+
# @return [ActiveSupport::TimeZone]
|
21
23
|
def by_debian_config
|
22
24
|
path = ::Pathname.new(DEBIAN_CONFIG_PATH)
|
23
|
-
path.exist? ? path.read.strip.
|
25
|
+
path.exist? ? path.read.strip.if_present { |v| ::ActiveSupport::TimeZone[v] } : nil
|
24
26
|
end
|
25
27
|
|
28
|
+
# @return [ActiveSupport::TimeZone]
|
26
29
|
def by_offset
|
27
|
-
::ActiveSupport::TimeZone[::Time.now.getlocal.gmt_offset]
|
30
|
+
::ActiveSupport::TimeZone[::Time.now.getlocal.gmt_offset]
|
28
31
|
end
|
29
32
|
|
33
|
+
# @return [ActiveSupport::TimeZone]
|
30
34
|
def by_timedatectl
|
31
35
|
executable = ::EacRubyUtils::Envs.local.executable('timedatectl', '--version')
|
32
36
|
return nil unless executable.exist?
|
33
37
|
|
34
38
|
TIMEDATECTL_TIMEZONE_LINE_PATTERN.if_match(executable.command.execute!) { |m| m[1] }
|
39
|
+
.if_present { |v| ::ActiveSupport::TimeZone[v] }
|
35
40
|
end
|
36
41
|
|
42
|
+
# @return [ActiveSupport::TimeZone]
|
37
43
|
def by_tz_env
|
38
44
|
ENV['TZ'].presence
|
39
45
|
end
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
module Kernel
|
4
4
|
# Raise exception with text "Not yet implemented".
|
5
|
-
def nyi
|
6
|
-
|
5
|
+
def nyi(message = nil)
|
6
|
+
s = "Not yet implemented (Called in #{caller.first})"
|
7
|
+
s += ": #{message}" if message
|
8
|
+
raise s
|
7
9
|
end
|
8
10
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Object
|
4
|
+
# @return +block.call(self)+ if +self+ is not nil, +default_value+ otherwise.
|
5
|
+
def if_not_nil(default_value = nil)
|
6
|
+
return default_value if nil?
|
7
|
+
|
8
|
+
block_given? ? yield(self) : self
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return +yield+ if +self+ is nil, +self+ otherwise.
|
12
|
+
def if_nil
|
13
|
+
return yield if nil? && block_given?
|
14
|
+
|
15
|
+
self
|
16
|
+
end
|
17
|
+
end
|
@@ -3,7 +3,9 @@
|
|
3
3
|
require 'eac_ruby_utils/inflector'
|
4
4
|
|
5
5
|
class String
|
6
|
-
|
7
|
-
|
6
|
+
# Shortcut to `EacRubyUtils::Inflector.variableize(self, ...)`.
|
7
|
+
# @see EacRubyUtils::Inflector.variableize
|
8
|
+
def variableize(validate = true)
|
9
|
+
::EacRubyUtils::Inflector.variableize(self, validate)
|
8
10
|
end
|
9
11
|
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
|
@@ -1,15 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/options_consumer'
|
3
|
+
require 'eac_ruby_utils/require_sub'
|
5
4
|
|
6
5
|
module EacRubyUtils
|
7
6
|
# Provide a option by constant, method or options object.
|
8
7
|
module SettingsProvider
|
8
|
+
::EacRubyUtils.require_sub __FILE__, base: self
|
9
|
+
|
9
10
|
def setting_constant_name(key, fullname = false)
|
10
|
-
|
11
|
-
name = "#{self.class.name}::#{name}" if fullname
|
12
|
-
name
|
11
|
+
setting_value_instance(key).constant_name(fullname)
|
13
12
|
end
|
14
13
|
|
15
14
|
def setting_search_order
|
@@ -25,41 +24,23 @@ module EacRubyUtils
|
|
25
24
|
end
|
26
25
|
|
27
26
|
def setting_value(key, options = {})
|
28
|
-
|
29
|
-
options.order.each do |method|
|
30
|
-
value = send("setting_value_by_#{method}", key)
|
31
|
-
return value if value
|
32
|
-
end
|
33
|
-
return nil unless options.required
|
34
|
-
|
35
|
-
raise "Setting \"#{key}\" not found. Supply in #{settings_object_name}, implement a " \
|
36
|
-
"\"#{key}\" method or declare a #{setting_constant_name(key, true)} constant."
|
27
|
+
setting_value_instance(key, options).value
|
37
28
|
end
|
38
29
|
|
39
30
|
def setting_value_by_constant(key)
|
40
|
-
|
41
|
-
begin
|
42
|
-
self.class.const_get(constant_name)
|
43
|
-
rescue NameError
|
44
|
-
nil
|
45
|
-
end
|
31
|
+
setting_value_instance(key).value_by_constant
|
46
32
|
end
|
47
33
|
|
48
34
|
def setting_value_by_method(key)
|
49
|
-
|
35
|
+
setting_value_instance(key).value_by_method
|
50
36
|
end
|
51
37
|
|
52
38
|
def setting_value_by_settings_object(key)
|
53
|
-
|
39
|
+
setting_value_instance(key).value_by_settings_object
|
54
40
|
end
|
55
41
|
|
56
|
-
|
57
|
-
|
58
|
-
def parse_setting_value_options(options)
|
59
|
-
r = ::EacRubyUtils::OptionsConsumer.new(options).consume_all(:required, :order, ostruct: true)
|
60
|
-
r.required = true if r.required.nil?
|
61
|
-
r.order = setting_search_order if r.order.nil?
|
62
|
-
r
|
42
|
+
def setting_value_instance(key, options = {})
|
43
|
+
::EacRubyUtils::SettingsProvider::SettingValue.new(self, key, options)
|
63
44
|
end
|
64
45
|
end
|
65
46
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
4
|
+
require 'eac_ruby_utils/listable'
|
5
|
+
require 'eac_ruby_utils/simple_cache'
|
6
|
+
require 'eac_ruby_utils/struct'
|
7
|
+
|
8
|
+
module EacRubyUtils
|
9
|
+
module SettingsProvider
|
10
|
+
class SettingValue
|
11
|
+
include ::EacRubyUtils::Listable
|
12
|
+
include ::EacRubyUtils::SimpleCache
|
13
|
+
|
14
|
+
attr_reader :source, :key, :options
|
15
|
+
lists.add_symbol :option, :default, :order, :required
|
16
|
+
|
17
|
+
def initialize(source, key, options)
|
18
|
+
@source = source
|
19
|
+
@key = key
|
20
|
+
@options = options
|
21
|
+
end
|
22
|
+
|
23
|
+
def constant_name(fullname = false)
|
24
|
+
name = key.to_s.underscore.upcase
|
25
|
+
name = "#{source.class.name}::#{name}" if fullname
|
26
|
+
name
|
27
|
+
end
|
28
|
+
|
29
|
+
def value
|
30
|
+
parsed_options.order.each do |method|
|
31
|
+
value = send("value_by_#{method}")
|
32
|
+
return value if value
|
33
|
+
end
|
34
|
+
return parsed_options.default if parsed_options.respond_to?(OPTION_DEFAULT)
|
35
|
+
return nil unless parsed_options.required
|
36
|
+
|
37
|
+
raise_key_not_found
|
38
|
+
end
|
39
|
+
|
40
|
+
def value_by_constant
|
41
|
+
source.class.const_get(constant_name)
|
42
|
+
rescue NameError
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def value_by_method
|
47
|
+
source.respond_to?(key, true) ? source.send(key) : nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def value_by_settings_object
|
51
|
+
source.settings_object[key.to_s] || source.settings_object[key.to_sym]
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def parsed_options_uncached
|
57
|
+
r = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
|
58
|
+
r[:required] = true unless r.key?(OPTION_REQUIRED)
|
59
|
+
r[:order] = source.setting_search_order if r[OPTION_ORDER].nil?
|
60
|
+
::EacRubyUtils::Struct.new(r)
|
61
|
+
end
|
62
|
+
|
63
|
+
def raise_key_not_found
|
64
|
+
raise "Setting \"#{key}\" not found. Supply in #{source.settings_object_name}, implement "\
|
65
|
+
"a \"#{key}\" method or declare a #{constant_name(true)} constant."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -2,12 +2,18 @@
|
|
2
2
|
|
3
3
|
module EacRubyUtils
|
4
4
|
module SimpleCache
|
5
|
-
|
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
|
-
|
9
|
-
|
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
|
-
|
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
|
@@ -42,5 +42,13 @@ RSpec.describe ::EacRubyUtils::SettingsProvider do
|
|
42
42
|
it do
|
43
43
|
expect(stub.setting_value('key_e', required: false)).to eq(nil)
|
44
44
|
end
|
45
|
+
|
46
|
+
it do
|
47
|
+
expect(stub.setting_value('key_e', default: nil)).to eq(nil)
|
48
|
+
end
|
49
|
+
|
50
|
+
it do
|
51
|
+
expect(stub.setting_value('key_e', default: 'default_e')).to eq('default_e')
|
52
|
+
end
|
45
53
|
end
|
46
54
|
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
|
@@ -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.
|
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-
|
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.
|
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.
|
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
|
@@ -354,6 +348,7 @@ files:
|
|
354
348
|
- lib/avm/eac_webapp_base0/deploy/version.rb
|
355
349
|
- lib/avm/eac_webapp_base0/deploy/write_on_target.rb
|
356
350
|
- lib/avm/eac_webapp_base0/instance.rb
|
351
|
+
- lib/avm/eac_webapp_base0/instance/subcommand_parent.rb
|
357
352
|
- lib/avm/eac_webapp_base0/runner.rb
|
358
353
|
- lib/avm/eac_webapp_base0/runner/apache_host.rb
|
359
354
|
- lib/avm/eac_webapp_base0/runner/apache_path.rb
|
@@ -408,6 +403,7 @@ files:
|
|
408
403
|
- lib/avm/git/auto_commit/rules/base.rb
|
409
404
|
- lib/avm/git/auto_commit/rules/last.rb
|
410
405
|
- lib/avm/git/auto_commit/rules/manual.rb
|
406
|
+
- lib/avm/git/auto_commit/rules/new.rb
|
411
407
|
- lib/avm/git/auto_commit/rules/nth.rb
|
412
408
|
- lib/avm/git/auto_commit/rules/unique.rb
|
413
409
|
- lib/avm/git/auto_commit_path.rb
|
@@ -436,7 +432,6 @@ files:
|
|
436
432
|
- lib/avm/git/organize/reference_update.rb
|
437
433
|
- lib/avm/git/organize/repository.rb
|
438
434
|
- lib/avm/git/revision_test.rb
|
439
|
-
- lib/avm/git/spec_helper.rb
|
440
435
|
- lib/avm/git/subrepo_check.rb
|
441
436
|
- lib/avm/git/subrepo_check/parent.rb
|
442
437
|
- lib/avm/git/subrepo_check/remote.rb
|
@@ -513,6 +508,15 @@ files:
|
|
513
508
|
- lib/avm/rails.rb
|
514
509
|
- lib/avm/result.rb
|
515
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
|
516
520
|
- lib/avm/ruby/gems.rb
|
517
521
|
- lib/avm/ruby/gems/generator.rb
|
518
522
|
- lib/avm/ruby/rubocop.rb
|
@@ -542,7 +546,6 @@ files:
|
|
542
546
|
- lib/avm/tools/runner/files/rotate.rb
|
543
547
|
- lib/avm/tools/runner/git.rb
|
544
548
|
- lib/avm/tools/runner/git/auto_commit.rb
|
545
|
-
- lib/avm/tools/runner/git/auto_fixup.rb
|
546
549
|
- lib/avm/tools/runner/git/commit.rb
|
547
550
|
- lib/avm/tools/runner/git/deploy.rb
|
548
551
|
- lib/avm/tools/runner/git/dirty_files.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
|
@@ -688,15 +692,14 @@ files:
|
|
688
692
|
- vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb
|
689
693
|
- vendor/eac_cli/lib/eac_cli/runner_with.rb
|
690
694
|
- vendor/eac_cli/lib/eac_cli/runner_with/help.rb
|
691
|
-
- vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb
|
692
695
|
- vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb
|
696
|
+
- vendor/eac_cli/lib/eac_cli/runner_with_set.rb
|
693
697
|
- vendor/eac_cli/lib/eac_cli/version.rb
|
694
698
|
- vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb
|
695
699
|
- vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
|
696
700
|
- vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb
|
697
701
|
- vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb
|
698
702
|
- vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
|
699
|
-
- vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb
|
700
703
|
- vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb
|
701
704
|
- vendor/eac_cli/spec/rubocop_spec.rb
|
702
705
|
- vendor/eac_cli/spec/spec_helper.rb
|
@@ -725,14 +728,30 @@ files:
|
|
725
728
|
- vendor/eac_git/lib/eac_git.rb
|
726
729
|
- vendor/eac_git/lib/eac_git/executables.rb
|
727
730
|
- vendor/eac_git/lib/eac_git/local.rb
|
731
|
+
- vendor/eac_git/lib/eac_git/local/commit.rb
|
732
|
+
- vendor/eac_git/lib/eac_git/local/commit/changed_file.rb
|
733
|
+
- vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb
|
728
734
|
- vendor/eac_git/lib/eac_git/local/dirty_files.rb
|
729
735
|
- vendor/eac_git/lib/eac_git/local/subrepo.rb
|
730
736
|
- vendor/eac_git/lib/eac_git/local/subrepo/config.rb
|
731
737
|
- vendor/eac_git/lib/eac_git/remote.rb
|
732
738
|
- vendor/eac_git/lib/eac_git/remote/ls_result.rb
|
733
739
|
- vendor/eac_git/lib/eac_git/rspec.rb
|
740
|
+
- vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb
|
734
741
|
- vendor/eac_git/lib/eac_git/version.rb
|
735
742
|
- vendor/eac_git/spec/lib/eac_git/executables_spec.rb
|
743
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb
|
744
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out
|
745
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml
|
746
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out
|
747
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml
|
748
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out
|
749
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml
|
750
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out
|
751
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml
|
752
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out
|
753
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml
|
754
|
+
- vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb
|
736
755
|
- vendor/eac_git/spec/rubocop_spec.rb
|
737
756
|
- vendor/eac_git/spec/spec_helper.rb
|
738
757
|
- vendor/eac_git/vendor/git-subrepo/Changes
|
@@ -924,9 +943,23 @@ files:
|
|
924
943
|
- vendor/eac_ruby_base0/eac_ruby_base0.gemspec
|
925
944
|
- vendor/eac_ruby_base0/lib/eac_ruby_base0.rb
|
926
945
|
- vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb
|
946
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb
|
947
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb
|
948
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb
|
949
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb
|
950
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb
|
951
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb
|
952
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb
|
927
953
|
- vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb
|
928
954
|
- vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb
|
955
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb
|
956
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb
|
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
|
959
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb
|
929
960
|
- vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb
|
961
|
+
- vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb
|
962
|
+
- vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb
|
930
963
|
- vendor/eac_ruby_base0/spec/rubocop_spec.rb
|
931
964
|
- vendor/eac_ruby_base0/spec/spec_helper.rb
|
932
965
|
- vendor/eac_ruby_gems_utils/Gemfile
|
@@ -1016,6 +1049,7 @@ files:
|
|
1016
1049
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs.rb
|
1017
1050
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb
|
1018
1051
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/extname.rb
|
1052
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb
|
1019
1053
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp.rb
|
1020
1054
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp/directory.rb
|
1021
1055
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/temp/file.rb
|
@@ -1047,6 +1081,7 @@ files:
|
|
1047
1081
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches.rb
|
1048
1082
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class.rb
|
1049
1083
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/common_constructor.rb
|
1084
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb
|
1050
1085
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable.rb
|
1051
1086
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerable/boolean_combinations.rb
|
1052
1087
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb
|
@@ -1070,6 +1105,7 @@ files:
|
|
1070
1105
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object.rb
|
1071
1106
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb
|
1072
1107
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb
|
1108
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb
|
1073
1109
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_present.rb
|
1074
1110
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_respond.rb
|
1075
1111
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb
|
@@ -1078,13 +1114,16 @@ files:
|
|
1078
1114
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb
|
1079
1115
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp.rb
|
1080
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
|
1081
1118
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb
|
1082
1119
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb
|
1083
1120
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time.rb
|
1121
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb
|
1084
1122
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb
|
1085
1123
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb
|
1086
1124
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb
|
1087
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
|
1088
1127
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb
|
1089
1128
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec.rb
|
1090
1129
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb
|
@@ -1093,6 +1132,7 @@ files:
|
|
1093
1132
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb
|
1094
1133
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb
|
1095
1134
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb
|
1135
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb
|
1096
1136
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb
|
1097
1137
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb
|
1098
1138
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/templates.rb
|
@@ -1176,7 +1216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1176
1216
|
- !ruby/object:Gem::Version
|
1177
1217
|
version: '0'
|
1178
1218
|
requirements: []
|
1179
|
-
rubygems_version: 3.0.
|
1219
|
+
rubygems_version: 3.0.9
|
1180
1220
|
signing_key:
|
1181
1221
|
specification_version: 4
|
1182
1222
|
summary: Tools for AVM.
|