avm-tools 0.116.2 → 0.117.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/tools/runner/app_src/version_bump.rb +4 -9
- data/lib/avm/tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +1 -1
- data/sub/avm/lib/avm/scms/base.rb +13 -0
- data/sub/avm/lib/avm/sources/base/configuration.rb +2 -1
- data/sub/avm/lib/avm/sources/base/parent.rb +31 -0
- data/sub/avm/lib/avm/sources/base.rb +4 -6
- data/sub/avm/lib/avm/sources/configuration/{_locale.rb → locale.rb} +5 -3
- data/sub/avm/lib/avm/sources/configuration/rubocop.rb +26 -0
- data/sub/avm/lib/avm/sources/configuration/tests.rb +29 -0
- data/sub/avm/lib/avm/sources/configuration.rb +5 -1
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_generic_base0/avm-eac_generic_base0.gemspec +1 -1
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base/version_bump.rb +35 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base.rb +4 -1
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
- data/sub/avm-eac_generic_base0/locale/en.yaml +6 -0
- data/sub/avm-eac_generic_base0/locale/pt-BR.yaml +6 -0
- data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +1 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/version_bump.rb +23 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +11 -0
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update.rb +0 -1
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +1 -3
- data/sub/avm-git/lib/avm/git/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/core_ext.rb +1 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_all_gems.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_gem.rb +47 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales/module_i18n_translate.rb +74 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/locales.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb +35 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/i18n_translate.rb +2 -25
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/method_class.rb +9 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +86 -33
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/method_class_spec.rb +46 -0
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/method_class_spec.rb +20 -0
- metadata +18 -9
- data/lib/avm/projects/stereotypes/rails_application/update.rb +0 -14
- data/lib/avm/projects/stereotypes/ruby_gem/version_bump.rb +0 -60
- data/sub/avm/lib/avm/sources/configuration/_rubocop.rb +0 -24
- data/sub/avm/lib/avm/sources/configuration/_tests.rb +0 -27
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches/i18n.rb +0 -7
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aae509f1d4971fd8a6d39a9f20cc4a3dab9fd28267c333ffe521cba9252f20bb
|
4
|
+
data.tar.gz: f27d6bd59c10b9638f1f42b173d38a53a677b1d8de4b1a01c63e170ed1ed362f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea73fcc793b05f0265396c36a592969b9f60c6ccb8a0e7526f7f5e12f5c7b58688489c11cda94b7e17ab8a0430029dccca11d3a0b799a49e6c65d11c5f200b8a
|
7
|
+
data.tar.gz: bf13a36e7cdf500a7538c75531b108b7f09ef76dfd1b5a4ceb102cc32f2c2b76026df875c593de2fa6c240b3b5fccc43b9d7a989941dab6b15e61a8b142ee503
|
@@ -8,14 +8,13 @@ module Avm
|
|
8
8
|
class Runner
|
9
9
|
class AppSrc
|
10
10
|
class VersionBump
|
11
|
-
runner_with :help do
|
11
|
+
runner_with :help, :confirmation do
|
12
12
|
desc 'Bump version of a local project.'
|
13
13
|
arg_opt '-n', '--new', 'Set new version.'
|
14
14
|
arg_opt '-s', '--segment', 'Increment de <segment>-th segment (Left-most is 0)'
|
15
15
|
bool_opt '-M', '--major', 'Same as --segment=0.'
|
16
16
|
bool_opt '-m', '--minor', 'Same as --segment=1.'
|
17
17
|
bool_opt '-p', '--patch', 'Same as --segment=2.'
|
18
|
-
bool_opt '-y', '--yes', 'Bump without confirmation.'
|
19
18
|
end
|
20
19
|
|
21
20
|
def run
|
@@ -26,7 +25,7 @@ module Avm
|
|
26
25
|
def run_version_changed
|
27
26
|
infom 'Version changed'
|
28
27
|
if confirm?
|
29
|
-
runner_context.call(:
|
28
|
+
runner_context.call(:subject).version_bump(target_version)
|
30
29
|
success 'Bumped'
|
31
30
|
else
|
32
31
|
fatal_error 'Bump unconfirmed'
|
@@ -38,17 +37,13 @@ module Avm
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def start_banner
|
41
|
-
runner_context.call(:
|
40
|
+
infov 'Instance', runner_context.call(:subject)
|
42
41
|
infov 'Current version', current_version.if_present('-')
|
43
42
|
infov 'Target version', target_version.if_present('-')
|
44
43
|
end
|
45
44
|
|
46
|
-
def confirm?
|
47
|
-
parsed.yes? || input('Confirm version bump?', bool: true)
|
48
|
-
end
|
49
|
-
|
50
45
|
def current_version_uncached
|
51
|
-
runner_context.call(:
|
46
|
+
runner_context.call(:subject).if_respond('version')
|
52
47
|
end
|
53
48
|
|
54
49
|
def target_version_uncached
|
data/lib/avm/tools/version.rb
CHANGED
data/sub/avm/avm.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.add_dependency 'eac_cli', '~> 0.23', '>= 0.23.1'
|
16
16
|
s.add_dependency 'eac_docker', '~> 0.3'
|
17
17
|
s.add_dependency 'eac_git', '~> 0.6'
|
18
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
18
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.95'
|
19
19
|
s.add_dependency 'eac_templates', '~> 0.1', '>= 0.1.1'
|
20
20
|
s.add_dependency 'filesize', '~> 0.2'
|
21
21
|
s.add_dependency 'htmlbeautifier', '~> 1.3', '>= 1.3.1'
|
@@ -6,6 +6,7 @@ module Avm
|
|
6
6
|
module Scms
|
7
7
|
class Base
|
8
8
|
enable_abstract_methods
|
9
|
+
enable_simple_cache
|
9
10
|
abstract_methods :update, :valid?
|
10
11
|
common_constructor :path do
|
11
12
|
self.path = path.to_pathname
|
@@ -28,6 +29,18 @@ module Avm
|
|
28
29
|
def to_s
|
29
30
|
name
|
30
31
|
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# @return [Avm::Scms::Base]
|
36
|
+
def parent_scm
|
37
|
+
parent_path = path.parent
|
38
|
+
until parent_path.root?
|
39
|
+
::Avm::Registry.scms.detect_optional(parent_path).if_present { |v| return v }
|
40
|
+
parent_path = parent_path.parent
|
41
|
+
end
|
42
|
+
nil
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
@@ -29,7 +29,8 @@ module Avm
|
|
29
29
|
|
30
30
|
# @return [Avm::Sources::Configuration]
|
31
31
|
def old_configuration_uncached
|
32
|
-
::Avm::Sources::Configuration.find_in_path(path)
|
32
|
+
::Avm::Sources::Configuration.find_in_path(path) ||
|
33
|
+
::Avm::Sources::Configuration.temp_instance
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Sources
|
7
|
+
class Base
|
8
|
+
module Parent
|
9
|
+
# @return [Avm::Sources::Base]
|
10
|
+
def parent
|
11
|
+
parent_by_option || parent_by_search
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Avm::Sources::Base]
|
15
|
+
def parent_by_option
|
16
|
+
options[OPTION_PARENT]
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [Avm::Sources::Base]
|
20
|
+
def parent_by_search
|
21
|
+
parent_path = path.parent
|
22
|
+
until parent_path.root?
|
23
|
+
::Avm::Registry.sources.detect_optional(parent_path).if_present { |v| return v }
|
24
|
+
parent_path = parent_path.parent
|
25
|
+
end
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -21,12 +21,6 @@ module Avm
|
|
21
21
|
abstract_methods :update, :valid?
|
22
22
|
|
23
23
|
delegate :locale, to: :old_configuration
|
24
|
-
delegate :to_s, to: :path
|
25
|
-
|
26
|
-
# @return [Avm::Sources::Base]
|
27
|
-
def parent
|
28
|
-
options[OPTION_PARENT]
|
29
|
-
end
|
30
24
|
|
31
25
|
# @return [Pathname]
|
32
26
|
def relative_path
|
@@ -35,6 +29,10 @@ module Avm
|
|
35
29
|
path.relative_path_from(parent.path)
|
36
30
|
end
|
37
31
|
|
32
|
+
def to_s
|
33
|
+
"#{self.class}[#{path}]"
|
34
|
+
end
|
35
|
+
|
38
36
|
# @return [Enumerable<Avm::Sources::Base>]
|
39
37
|
def subs
|
40
38
|
scm.subs.map { |subrepo| ::Avm::Registry.sources.detect(subrepo.path, parent: self) }
|
@@ -6,10 +6,12 @@ require 'i18n'
|
|
6
6
|
module Avm
|
7
7
|
module Sources
|
8
8
|
class Configuration < ::EacConfig::OldConfigs
|
9
|
-
|
9
|
+
module Locale
|
10
|
+
LOCALE_KEY = :locale
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
def locale
|
13
|
+
read_entry(LOCALE_KEY) || ::I18n.default_locale
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module Sources
|
5
|
+
class Configuration < ::EacConfig::OldConfigs
|
6
|
+
module Rubocop
|
7
|
+
RUBOCOP_COMMAND_KEY = 'ruby.rubocop.command'
|
8
|
+
RUBOCOP_GEMFILE_KEY = 'ruby.rubocop.gemfile'
|
9
|
+
|
10
|
+
def rubocop_command
|
11
|
+
read_command(RUBOCOP_COMMAND_KEY)
|
12
|
+
end
|
13
|
+
|
14
|
+
def rubocop_gemfile
|
15
|
+
gemfile_path = read_entry(RUBOCOP_GEMFILE_KEY)
|
16
|
+
return nil if gemfile_path.blank?
|
17
|
+
|
18
|
+
gemfile_path = gemfile_path.to_pathname.expand_path(storage_path.parent)
|
19
|
+
return gemfile_path if gemfile_path.file?
|
20
|
+
|
21
|
+
raise "Gemfile path \"#{gemfile_path}\" does not exist or is not a file"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Sources
|
7
|
+
class Configuration < ::EacConfig::OldConfigs
|
8
|
+
module Tests
|
9
|
+
BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
|
10
|
+
TEST_COMMAND_KEY = 'test.command'
|
11
|
+
|
12
|
+
def any_test_command
|
13
|
+
bundle_test_command || test_command
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_command
|
17
|
+
read_command(TEST_COMMAND_KEY)
|
18
|
+
end
|
19
|
+
|
20
|
+
def bundle_test_command
|
21
|
+
read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
|
22
|
+
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
23
|
+
::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -7,7 +7,7 @@ require 'yaml'
|
|
7
7
|
module Avm
|
8
8
|
module Sources
|
9
9
|
class Configuration < ::EacConfig::OldConfigs
|
10
|
-
require_sub __FILE__
|
10
|
+
require_sub __FILE__, include_modules: true
|
11
11
|
|
12
12
|
FILENAMES = %w[.avm.yml .avm.yaml].freeze
|
13
13
|
|
@@ -28,6 +28,10 @@ module Avm
|
|
28
28
|
nil
|
29
29
|
end
|
30
30
|
|
31
|
+
def temp_instance
|
32
|
+
new(::Tempfile.new(['.avm', '.yaml']))
|
33
|
+
end
|
34
|
+
|
31
35
|
private
|
32
36
|
|
33
37
|
def internal_find_path(absolute_pathname)
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/sources/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacGenericBase0
|
8
|
+
module Sources
|
9
|
+
class Base < ::Avm::Sources::Base
|
10
|
+
module VersionBump
|
11
|
+
def after_sub_version_bump_do_changes
|
12
|
+
# Do nothing
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Avm::Scms::Commit, nil]
|
16
|
+
def version_bump(target_version)
|
17
|
+
scm.commit_if_change(version_bump_commit_message(target_version)) do
|
18
|
+
version_bump_do_changes(target_version)
|
19
|
+
parent.if_present(&:after_sub_version_bump_do_changes)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String]
|
24
|
+
def version_bump_commit_message(target_version)
|
25
|
+
i18n_translate(__method__, version: target_version, __locale: locale)
|
26
|
+
end
|
27
|
+
|
28
|
+
def version_bump_do_changes(_target_version)
|
29
|
+
raise_abstract_method(__METHOD__)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -8,13 +8,16 @@ module Avm
|
|
8
8
|
module EacGenericBase0
|
9
9
|
module Sources
|
10
10
|
class Base < ::Avm::Sources::Base
|
11
|
+
require_sub __FILE__, include_modules: true
|
12
|
+
enable_abstract_methods
|
13
|
+
|
11
14
|
# @return [Avm::EacGenericBase0::Sources::Tester]
|
12
15
|
def tester_class
|
13
16
|
Avm::EacGenericBase0::Sources::Tester
|
14
17
|
end
|
15
18
|
|
16
19
|
def valid?
|
17
|
-
path.
|
20
|
+
::Avm::Registry.scms.detect_optional(path).present?
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = Dir['{lib,locale}/**/*']
|
14
14
|
|
15
15
|
s.add_dependency 'avm', '~> 0.9'
|
16
|
-
s.add_dependency 'avm-eac_generic_base0', '~> 0.
|
16
|
+
s.add_dependency 'avm-eac_generic_base0', '~> 0.2'
|
17
17
|
s.add_dependency 'eac_ruby_gems_utils', '~> 0.9', '>= 0.9.8'
|
18
18
|
s.add_dependency 'eac_ruby_utils', '~> 0.80'
|
19
19
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_generic_base0/sources/base'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRubyBase1
|
8
|
+
module Sources
|
9
|
+
class Base < ::Avm::EacGenericBase0::Sources::Base
|
10
|
+
module VersionBump
|
11
|
+
def after_sub_version_bump_do_changes
|
12
|
+
the_gem.bundle('install').chdir_root.execute!
|
13
|
+
end
|
14
|
+
|
15
|
+
def version_bump_do_changes(target_version)
|
16
|
+
self.version = target_version
|
17
|
+
the_gem.bundle('install').chdir_root.execute!
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'avm/eac_generic_base0/sources/base'
|
4
4
|
require 'avm/eac_ruby_base1/sources/update'
|
5
5
|
require 'avm/eac_ruby_base1/sources/tester'
|
6
|
+
require 'avm/version_number'
|
6
7
|
require 'eac_ruby_gems_utils/gem'
|
7
8
|
require 'eac_ruby_utils/core_ext'
|
8
9
|
|
@@ -10,6 +11,7 @@ module Avm
|
|
10
11
|
module EacRubyBase1
|
11
12
|
module Sources
|
12
13
|
class Base < ::Avm::EacGenericBase0::Sources::Base
|
14
|
+
require_sub __FILE__, include_modules: :prepend, require_dependency: true
|
13
15
|
delegate :gemspec_path, to: :the_gem
|
14
16
|
|
15
17
|
def gemfile_path
|
@@ -33,6 +35,15 @@ module Avm
|
|
33
35
|
def update
|
34
36
|
::Avm::EacRubyBase1::Sources::Update.new(self)
|
35
37
|
end
|
38
|
+
|
39
|
+
# @return [Avm::VersionNumber]
|
40
|
+
def version
|
41
|
+
the_gem.version.if_present { |v| ::Avm::VersionNumber.new(v) }
|
42
|
+
end
|
43
|
+
|
44
|
+
def version=(value)
|
45
|
+
the_gem.version_file.value = value
|
46
|
+
end
|
36
47
|
end
|
37
48
|
end
|
38
49
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'i18n'
|
4
|
+
require 'eac_ruby_utils/patches/class/common_constructor'
|
5
|
+
require 'eac_ruby_utils/patches/object/to_pathname'
|
6
|
+
|
7
|
+
module EacRubyUtils
|
8
|
+
module Locales
|
9
|
+
class FromGem
|
10
|
+
class << self
|
11
|
+
def include_all(i18n_obj = nil)
|
12
|
+
::Gem::Specification.each { |gemspec| new(gemspec, i18n_obj).include }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
LOCALES_DIR_SUBPATH = 'locale'
|
17
|
+
LOCALES_FILES_GLOB_PATTERNS = %w[*.yaml *.yml].freeze
|
18
|
+
|
19
|
+
common_constructor :gemspec, :i18n_obj, default: [nil] do
|
20
|
+
self.i18n_obj ||= ::I18n
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Boolean]
|
24
|
+
delegate :exist?, to: :path
|
25
|
+
|
26
|
+
# @return [Pathname, nil]
|
27
|
+
def include
|
28
|
+
return nil unless exist?
|
29
|
+
|
30
|
+
::I18n.load_path += paths_to_load.map(&:to_path)
|
31
|
+
path
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [Pathname]
|
35
|
+
def path
|
36
|
+
gemspec.gem_dir.to_pathname.join(LOCALES_DIR_SUBPATH)
|
37
|
+
end
|
38
|
+
|
39
|
+
# @return [Pathname]
|
40
|
+
def paths_to_load
|
41
|
+
return [] unless exist?
|
42
|
+
|
43
|
+
LOCALES_FILES_GLOB_PATTERNS.inject([]) { |a, e| a + path.glob(e) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
4
|
+
require 'eac_ruby_utils/common_constructor'
|
5
|
+
require 'i18n'
|
6
|
+
|
7
|
+
module EacRubyUtils
|
8
|
+
module Locales
|
9
|
+
class ModuleI18nTranslate
|
10
|
+
TRANSLATE_LOCALE_KEY = :__locale
|
11
|
+
|
12
|
+
common_constructor :the_module, :entry_suffix, :values, default: [{}]
|
13
|
+
|
14
|
+
def ancestor_i18n_translate(ancestor)
|
15
|
+
t = self.class.new(ancestor, entry_suffix, values)
|
16
|
+
t.exists? ? t.i18n_translate : nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def ancestors_i18n_translate
|
20
|
+
the_module.ancestors.lazy.map { |v| ancestor_i18n_translate(v) }.find(&:present?)
|
21
|
+
end
|
22
|
+
|
23
|
+
def exists?
|
24
|
+
::I18n.exists?(i18n_key)
|
25
|
+
end
|
26
|
+
|
27
|
+
def i18n_key
|
28
|
+
"#{module_entry_prefix}.#{entry_suffix}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def i18n_options
|
32
|
+
values.except(TRANSLATE_LOCALE_KEY)
|
33
|
+
end
|
34
|
+
|
35
|
+
def i18n_translate
|
36
|
+
::I18n.translate(i18n_key, i18n_options)
|
37
|
+
end
|
38
|
+
|
39
|
+
def locale
|
40
|
+
values[TRANSLATE_LOCALE_KEY]
|
41
|
+
end
|
42
|
+
|
43
|
+
def module_entry_prefix
|
44
|
+
the_module.name.underscore.gsub('/', '.')
|
45
|
+
end
|
46
|
+
|
47
|
+
def on_locale(&block)
|
48
|
+
if locale.present?
|
49
|
+
on_present_locale(&block)
|
50
|
+
else
|
51
|
+
block.call
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def result
|
56
|
+
on_locale do
|
57
|
+
ancestors_i18n_translate || i18n_translate
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def on_present_locale(&block)
|
64
|
+
old_locale = ::I18n.locale
|
65
|
+
begin
|
66
|
+
::I18n.locale = locale
|
67
|
+
block.call
|
68
|
+
ensure
|
69
|
+
::I18n.locale = old_locale
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/module/introspection'
|
4
|
+
require 'eac_ruby_utils/patches/class/common_constructor'
|
5
|
+
require 'eac_ruby_utils/patches/module/common_concern'
|
6
|
+
require 'eac_ruby_utils/patches/string/inflector'
|
7
|
+
|
8
|
+
module EacRubyUtils
|
9
|
+
module MethodClass
|
10
|
+
common_concern do
|
11
|
+
::EacRubyUtils::MethodClass::Setup.new(self)
|
12
|
+
end
|
13
|
+
|
14
|
+
class Setup
|
15
|
+
common_constructor :method_class do
|
16
|
+
perform
|
17
|
+
end
|
18
|
+
|
19
|
+
def perform
|
20
|
+
the_setup = self
|
21
|
+
sender_module.define_method(method_name) do |*args, &block|
|
22
|
+
the_setup.method_class.new(self, *args, &block).result
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def method_name
|
27
|
+
method_class.name.demodulize.underscore.variableize
|
28
|
+
end
|
29
|
+
|
30
|
+
def sender_module
|
31
|
+
method_class.module_parent
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,32 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'i18n'
|
3
|
+
require 'eac_ruby_utils/locales/module_i18n_translate'
|
5
4
|
|
6
5
|
class Module
|
7
|
-
TRANSLATE_LOCALE_KEY = :__locale
|
8
|
-
|
9
6
|
def i18n_translate(entry_suffix, values = {})
|
10
|
-
|
11
|
-
::I18n.translate(i18n_translate_entry_full(entry_suffix), values)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def i18n_translate_entry_full(entry_suffix)
|
16
|
-
"#{i18n_translate_entry_self_prefix}.#{entry_suffix}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def i18n_translate_entry_self_prefix
|
20
|
-
name.underscore.gsub('/', '.')
|
21
|
-
end
|
22
|
-
|
23
|
-
def on_i18n_locale(locale)
|
24
|
-
old_locale = ::I18n.locale
|
25
|
-
begin
|
26
|
-
::I18n.locale = locale
|
27
|
-
yield
|
28
|
-
ensure
|
29
|
-
::I18n.locale = old_locale
|
30
|
-
end
|
7
|
+
::EacRubyUtils::Locales::ModuleI18nTranslate.new(self, entry_suffix, values).result
|
31
8
|
end
|
32
9
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/inflector'
|
4
|
+
require 'active_support/dependencies'
|
4
5
|
require 'eac_ruby_utils/listable'
|
5
6
|
|
6
7
|
module EacRubyUtils
|
@@ -11,6 +12,14 @@ module EacRubyUtils
|
|
11
12
|
end
|
12
13
|
|
13
14
|
class RequireSub
|
15
|
+
INCLUDE_MODULES_MAP = {
|
16
|
+
nil => nil,
|
17
|
+
false => nil,
|
18
|
+
true => :include,
|
19
|
+
include: :include,
|
20
|
+
prepend: :prepend
|
21
|
+
}.freeze
|
22
|
+
|
14
23
|
include ::EacRubyUtils::Listable
|
15
24
|
lists.add_symbol :option, :base, :include_modules, :require_dependency
|
16
25
|
|
@@ -26,56 +35,100 @@ module EacRubyUtils
|
|
26
35
|
include_modules
|
27
36
|
end
|
28
37
|
|
29
|
-
|
38
|
+
def base
|
39
|
+
options[OPTION_BASE] || raise('Option :base not setted')
|
40
|
+
end
|
30
41
|
|
31
|
-
def
|
32
|
-
|
42
|
+
def base?
|
43
|
+
options[OPTION_BASE] ? true : false
|
44
|
+
end
|
33
45
|
|
34
|
-
|
35
|
-
|
46
|
+
def include_modules
|
47
|
+
sub_files.each(&:include_module)
|
36
48
|
end
|
37
49
|
|
38
|
-
def
|
39
|
-
return
|
50
|
+
def include_or_prepend_method
|
51
|
+
return INCLUDE_MODULES_MAP.fetch(options[OPTION_INCLUDE_MODULES]) if
|
52
|
+
INCLUDE_MODULES_MAP.key?(options[OPTION_INCLUDE_MODULES])
|
40
53
|
|
41
|
-
|
42
|
-
|
54
|
+
raise ::ArgumentError, "Invalid value for 'options[OPTION_INCLUDE_MODULES]':" \
|
55
|
+
" \"#{options[OPTION_INCLUDE_MODULES]}\""
|
56
|
+
end
|
43
57
|
|
44
|
-
|
45
|
-
|
58
|
+
def require_sub_files
|
59
|
+
sub_files.each(&:require_file)
|
46
60
|
end
|
47
61
|
|
48
|
-
def
|
49
|
-
|
62
|
+
def sub_files
|
63
|
+
@sub_files ||= Dir["#{File.dirname(file)}/#{::File.basename(file, '.*')}/*.rb"].sort
|
64
|
+
.map { |path| SubFile.new(self, path) }
|
65
|
+
end
|
50
66
|
|
51
|
-
|
52
|
-
|
53
|
-
next unless constant.is_a?(::Module) && !constant.is_a?(::Class)
|
67
|
+
class SubFile
|
68
|
+
attr_reader :owner, :path
|
54
69
|
|
55
|
-
|
70
|
+
def initialize(owner, path)
|
71
|
+
@owner = owner
|
72
|
+
@path = path
|
56
73
|
end
|
57
|
-
end
|
58
74
|
|
59
|
-
|
60
|
-
|
61
|
-
end
|
75
|
+
def base_constant
|
76
|
+
return nil unless owner.base?
|
62
77
|
|
63
|
-
|
64
|
-
|
65
|
-
|
78
|
+
owner.base.const_get(constant_name)
|
79
|
+
rescue ::NameError
|
80
|
+
nil
|
81
|
+
end
|
66
82
|
|
67
|
-
|
68
|
-
|
69
|
-
|
83
|
+
def constant_name
|
84
|
+
::ActiveSupport::Inflector.camelize(::File.basename(path, '.rb'))
|
85
|
+
end
|
70
86
|
|
71
|
-
|
72
|
-
|
73
|
-
|
87
|
+
def include_module
|
88
|
+
return unless module?
|
89
|
+
|
90
|
+
owner.include_or_prepend_method.if_present do |v|
|
91
|
+
owner.base.send(v, base_constant)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def include_or_prepend_method
|
96
|
+
return :include if owner.options[OPTION_INCLUDE_MODULES]
|
97
|
+
return :prepend if owner.options[OPTION_PREPEND_MODULES]
|
98
|
+
|
99
|
+
nil
|
100
|
+
end
|
101
|
+
|
102
|
+
def module?
|
103
|
+
base_constant.is_a?(::Module) && !base_constant.is_a?(::Class)
|
104
|
+
end
|
105
|
+
|
106
|
+
def require_file
|
107
|
+
active_support_require || autoload_require || kernel_require
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def active_support_require
|
113
|
+
return false unless owner.options[OPTION_REQUIRE_DEPENDENCY]
|
114
|
+
|
115
|
+
::Kernel.require_dependency(path)
|
116
|
+
true
|
74
117
|
end
|
75
|
-
end
|
76
118
|
|
77
|
-
|
78
|
-
|
119
|
+
def autoload_require
|
120
|
+
return false unless owner.base?
|
121
|
+
|
122
|
+
basename = ::File.basename(path, '.*')
|
123
|
+
return false if basename.start_with?('_')
|
124
|
+
|
125
|
+
owner.base.autoload ::ActiveSupport::Inflector.camelize(basename), path
|
126
|
+
true
|
127
|
+
end
|
128
|
+
|
129
|
+
def kernel_require
|
130
|
+
::Kernel.require(path)
|
131
|
+
end
|
79
132
|
end
|
80
133
|
end
|
81
134
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/method_class'
|
4
|
+
|
5
|
+
::RSpec.describe ::EacRubyUtils::MethodClass do
|
6
|
+
let(:sender_class) do
|
7
|
+
::Class.new do
|
8
|
+
attr_accessor :sender_value
|
9
|
+
|
10
|
+
def initialize(sender_value)
|
11
|
+
self.sender_value = sender_value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:method_class) do
|
17
|
+
the_described_class = described_class
|
18
|
+
::Class.new do
|
19
|
+
def self.name
|
20
|
+
'TheSender::PerformX'
|
21
|
+
end
|
22
|
+
|
23
|
+
include the_described_class
|
24
|
+
attr_accessor :sender, :method_param
|
25
|
+
|
26
|
+
def initialize(sender, method_param)
|
27
|
+
self.sender = sender
|
28
|
+
self.method_param = method_param
|
29
|
+
end
|
30
|
+
|
31
|
+
def result
|
32
|
+
"#{sender.sender_value},#{method_param}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:sender_instance) { sender_class.new('AAA') }
|
38
|
+
|
39
|
+
before do
|
40
|
+
::Object.const_set('TheSender', sender_class)
|
41
|
+
sender_class.const_set('PerformX', method_class)
|
42
|
+
end
|
43
|
+
|
44
|
+
it { expect(sender_instance).to respond_to(:perform_x) }
|
45
|
+
it { expect(sender_instance.perform_x('BBB')).to eq('AAA,BBB') }
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/method_class'
|
4
|
+
require 'eac_ruby_utils/patches/module/method_class'
|
5
|
+
|
6
|
+
RSpec.describe ::Class do
|
7
|
+
let(:stub_method_class) do
|
8
|
+
described_class.new do
|
9
|
+
def self.name
|
10
|
+
'StubMethodClass'
|
11
|
+
end
|
12
|
+
|
13
|
+
enable_method_class
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#enable_simple_cache' do
|
18
|
+
it { expect(stub_method_class.included_modules).to include(::EacRubyUtils::MethodClass) }
|
19
|
+
end
|
20
|
+
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.
|
4
|
+
version: 0.117.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: 2022-06-
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -354,12 +354,10 @@ files:
|
|
354
354
|
- lib/avm/projects/stereotypes/git_subtree/warp.rb
|
355
355
|
- lib/avm/projects/stereotypes/rails_application.rb
|
356
356
|
- lib/avm/projects/stereotypes/rails_application/local_project_mixin.rb
|
357
|
-
- lib/avm/projects/stereotypes/rails_application/update.rb
|
358
357
|
- lib/avm/projects/stereotypes/redmine_plugin.rb
|
359
358
|
- lib/avm/projects/stereotypes/ruby_gem.rb
|
360
359
|
- lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
|
361
360
|
- lib/avm/projects/stereotypes/ruby_gem/publish.rb
|
362
|
-
- lib/avm/projects/stereotypes/ruby_gem/version_bump.rb
|
363
361
|
- lib/avm/rails.rb
|
364
362
|
- lib/avm/ruby.rb
|
365
363
|
- lib/avm/ruby/bundler.rb
|
@@ -459,8 +457,11 @@ files:
|
|
459
457
|
- sub/avm-eac_generic_base0/lib/avm/eac_generic_base0.rb
|
460
458
|
- sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources.rb
|
461
459
|
- sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base.rb
|
460
|
+
- sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/base/version_bump.rb
|
462
461
|
- sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources/tester.rb
|
463
462
|
- sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb
|
463
|
+
- sub/avm-eac_generic_base0/locale/en.yaml
|
464
|
+
- sub/avm-eac_generic_base0/locale/pt-BR.yaml
|
464
465
|
- sub/avm-eac_generic_base0/spec/lib/avm/eac_generic_base0/sources/base_spec.rb
|
465
466
|
- sub/avm-eac_generic_base0/spec/rubocop_spec.rb
|
466
467
|
- sub/avm-eac_generic_base0/spec/spec_helper.rb
|
@@ -541,14 +542,13 @@ files:
|
|
541
542
|
- sub/avm-eac_ruby_base1/Gemfile
|
542
543
|
- sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec
|
543
544
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1.rb
|
544
|
-
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches.rb
|
545
|
-
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches/i18n.rb
|
546
545
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop.rb
|
547
546
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb
|
548
547
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb
|
549
548
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
|
550
549
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources.rb
|
551
550
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb
|
551
|
+
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/version_bump.rb
|
552
552
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tester.rb
|
553
553
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update.rb
|
554
554
|
- sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
|
@@ -762,11 +762,12 @@ files:
|
|
762
762
|
- sub/avm/lib/avm/sources/base.rb
|
763
763
|
- sub/avm/lib/avm/sources/base/configuration.rb
|
764
764
|
- sub/avm/lib/avm/sources/base/instance.rb
|
765
|
+
- sub/avm/lib/avm/sources/base/parent.rb
|
765
766
|
- sub/avm/lib/avm/sources/base/testing.rb
|
766
767
|
- sub/avm/lib/avm/sources/configuration.rb
|
767
|
-
- sub/avm/lib/avm/sources/configuration/
|
768
|
-
- sub/avm/lib/avm/sources/configuration/
|
769
|
-
- sub/avm/lib/avm/sources/configuration/
|
768
|
+
- sub/avm/lib/avm/sources/configuration/locale.rb
|
769
|
+
- sub/avm/lib/avm/sources/configuration/rubocop.rb
|
770
|
+
- sub/avm/lib/avm/sources/configuration/tests.rb
|
770
771
|
- sub/avm/lib/avm/sources/tester.rb
|
771
772
|
- sub/avm/lib/avm/sources/tests.rb
|
772
773
|
- sub/avm/lib/avm/sources/tests/builder.rb
|
@@ -1281,6 +1282,11 @@ files:
|
|
1281
1282
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/symbol_list.rb
|
1282
1283
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb
|
1283
1284
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb
|
1285
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/locales.rb
|
1286
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_all_gems.rb
|
1287
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_gem.rb
|
1288
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/locales/module_i18n_translate.rb
|
1289
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
|
1284
1290
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/options_consumer.rb
|
1285
1291
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patch.rb
|
1286
1292
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches.rb
|
@@ -1308,6 +1314,7 @@ files:
|
|
1308
1314
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/i18n_translate.rb
|
1309
1315
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb
|
1310
1316
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/listable.rb
|
1317
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/method_class.rb
|
1311
1318
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb
|
1312
1319
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb
|
1313
1320
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/simple_cache.rb
|
@@ -1380,6 +1387,7 @@ files:
|
|
1380
1387
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb
|
1381
1388
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb
|
1382
1389
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/local_time_zone_spec.rb
|
1390
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/method_class_spec.rb
|
1383
1391
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb
|
1384
1392
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/abstract_spec.rb
|
1385
1393
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/self_included_modules_spec.rb
|
@@ -1390,6 +1398,7 @@ files:
|
|
1390
1398
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/sym_keys_hash_spec.rb
|
1391
1399
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/compare_by_spec.rb
|
1392
1400
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb
|
1401
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/method_class_spec.rb
|
1393
1402
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb
|
1394
1403
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/speaker_spec.rb
|
1395
1404
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/call_if_proc_spec.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotypes/ruby_gem/update'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Projects
|
7
|
-
module Stereotypes
|
8
|
-
class RailsApplication
|
9
|
-
class Update < ::Avm::Projects::Stereotypes::RubyGem::Update
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/patches/i18n'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotypes
|
9
|
-
class RubyGem
|
10
|
-
class VersionBump
|
11
|
-
enable_speaker
|
12
|
-
common_constructor :instance, :target_version
|
13
|
-
|
14
|
-
def run
|
15
|
-
git_checkout
|
16
|
-
change_version
|
17
|
-
bundle_run
|
18
|
-
git_commit
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def bundle_run
|
24
|
-
infom 'Running "bundle install"...'
|
25
|
-
instance.ruby_gem.bundle('install').execute!
|
26
|
-
end
|
27
|
-
|
28
|
-
def change_version
|
29
|
-
infom 'Setting project version...'
|
30
|
-
instance.version = target_version
|
31
|
-
end
|
32
|
-
|
33
|
-
def git_checkout
|
34
|
-
return unless instance.respond_to?(:git_repo)
|
35
|
-
|
36
|
-
infom "Checkouting #{changing_files.map(&:to_path).join(', ')}..."
|
37
|
-
instance.git_repo.command('checkout', '--',
|
38
|
-
*changing_files.map(&:to_path)).execute!
|
39
|
-
end
|
40
|
-
|
41
|
-
def git_commit
|
42
|
-
return unless instance.respond_to?(:git_repo)
|
43
|
-
|
44
|
-
infom "Commiting #{changing_files.map(&:to_path).join(', ')}..."
|
45
|
-
instance.git_repo.command('commit', '-m', git_commit_message, '--',
|
46
|
-
*changing_files.map(&:to_path)).execute!
|
47
|
-
end
|
48
|
-
|
49
|
-
def git_commit_message
|
50
|
-
i18n_translate(__method__, version: target_version, __locale: instance.locale)
|
51
|
-
end
|
52
|
-
|
53
|
-
def changing_files
|
54
|
-
[instance.ruby_gem.gemfile_lock_path, instance.ruby_gem.version_file_path]
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Sources
|
5
|
-
class Configuration < ::EacConfig::OldConfigs
|
6
|
-
RUBOCOP_COMMAND_KEY = 'ruby.rubocop.command'
|
7
|
-
RUBOCOP_GEMFILE_KEY = 'ruby.rubocop.gemfile'
|
8
|
-
|
9
|
-
def rubocop_command
|
10
|
-
read_command(RUBOCOP_COMMAND_KEY)
|
11
|
-
end
|
12
|
-
|
13
|
-
def rubocop_gemfile
|
14
|
-
gemfile_path = read_entry(RUBOCOP_GEMFILE_KEY)
|
15
|
-
return nil if gemfile_path.blank?
|
16
|
-
|
17
|
-
gemfile_path = gemfile_path.to_pathname.expand_path(storage_path.parent)
|
18
|
-
return gemfile_path if gemfile_path.file?
|
19
|
-
|
20
|
-
raise "Gemfile path \"#{gemfile_path}\" does not exist or is not a file"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Sources
|
7
|
-
class Configuration < ::EacConfig::OldConfigs
|
8
|
-
BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
|
9
|
-
TEST_COMMAND_KEY = 'test.command'
|
10
|
-
|
11
|
-
def any_test_command
|
12
|
-
bundle_test_command || test_command
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_command
|
16
|
-
read_command(TEST_COMMAND_KEY)
|
17
|
-
end
|
18
|
-
|
19
|
-
def bundle_test_command
|
20
|
-
read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
|
21
|
-
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
22
|
-
::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|