avm-eac_ruby_base1 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1c8e5854d78b087a373eb0b6505d6b05d961c024de3ad42cfa7cb5d276fac57
4
- data.tar.gz: 76cd74e151b2390e5b5bcefcc03a3435972456221438677954edd3811eeac4ea
3
+ metadata.gz: '09053647f03bcbb8cc9ec4b40e136d6891b511309fe500561a216ccf28ca6d1b'
4
+ data.tar.gz: 711bcbe180a4340654eb77b420afb2c2dc5568000eb4c65ff65c9876fbfb4507
5
5
  SHA512:
6
- metadata.gz: 68e826476a22ac52ec31f88206673767e67ed7104144d5ccc6c78c2f2fd8f138b9703e0f5752c1df8dacddd588ab6e03202414bb0e2e92a9e82f2dd2c715b353
7
- data.tar.gz: b17fb4696a2fe08c14f13d7e03bcf623ce286e7ee096cfe60620323e9aef00c5ac4a8e376c0e825a815cb4b6b448d432d6dd9bcaedcff989361e50dbf3b98c3f
6
+ metadata.gz: 7e4db6a668a63f5230a280a84b30c9b528297a847477a130907b666f328a1a7e66e34b7b229d35184eb6c0b3cdec18d407e1e9a4b126c49254b6efe915486818
7
+ data.tar.gz: 2af99dfe5f8dc71fd0e37b2d26d7eec3aab06fdd4894b85ac83b415b308d22975c473935cabfd290ceea0d6fa6b281c3158e356ae1847c036f8523efed5b392b
@@ -4,4 +4,4 @@ require 'eac_ruby_utils/core_ext'
4
4
  require 'i18n'
5
5
 
6
6
  ::I18n.load_path += __dir__.to_pathname.expand_path.parent_n(4).join('locale').glob('*.yaml')
7
- .map(&:to_path)
7
+ .map(&:to_path)
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/configuration'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ class Rubocop
8
+ module Configured
9
+ def configured_rubocop_command_uncached
10
+ configured_rubocop_command_by_command || configured_rubocop_command_by_gemfile
11
+ end
12
+
13
+ def configured_rubocop_command_by_command
14
+ configuration.if_present(&:rubocop_command)
15
+ end
16
+
17
+ def configured_rubocop_command_by_gemfile
18
+ configuration.if_present(&:rubocop_gemfile).if_present do |v|
19
+ rubocop_command_by_gemfile_path(v.parent)
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def configuration_uncached
26
+ ::Avm::Sources::Configuration.find_by_path(base_path)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ class Rubocop
8
+ module Envvar
9
+ RUBOCOP_COMMAND_ENVVAR_NAME = 'RUBOCOP_COMMAND'
10
+
11
+ def env_rubocop_command
12
+ ENV[RUBOCOP_COMMAND_ENVVAR_NAME].present? ? cmd(ENV[RUBOCOP_COMMAND_ENVVAR_NAME]) : nil
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/patches/eac_ruby_gems_utils/gem'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ class Rubocop
9
+ module Gemfile
10
+ def gemfile_rubocop_command
11
+ return nil unless rubocop_gemfile?
12
+
13
+ rubocop_command_by_gemfile_path(mygem.root)
14
+ end
15
+
16
+ def rubocop_command_by_gemfile_path(path)
17
+ ::EacRubyGemsUtils::Gem.new(path).bundle('exec', 'rubocop').chdir_root
18
+ end
19
+
20
+ def rubocop_gemfile?
21
+ return false if mygem.blank?
22
+
23
+ mygem.bundle('install').execute!
24
+ mygem.gemfile_lock_gem_version('rubocop').present?
25
+ end
26
+
27
+ private
28
+
29
+ def mygem_uncached
30
+ find_gem(::Pathname.new(base_path).expand_path)
31
+ end
32
+
33
+ def find_gem(path)
34
+ r = ::EacRubyGemsUtils::Gem.new(path)
35
+ return r if r.gemfile_path.exist?
36
+ return find_gem(path.dirname) unless path.root?
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/ruby/on_clean_environment'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ class Rubocop
9
+ require_sub __FILE__, include_modules: true
10
+ enable_speaker
11
+ enable_simple_cache
12
+ common_constructor :base_path, :rubocop_args
13
+ set_callback :initialize, :after do
14
+ @base_path = ::Pathname.new(base_path.to_s) unless base_path.is_a?(::Pathname)
15
+ end
16
+
17
+ def run
18
+ start_banner
19
+ run_rubocop
20
+ end
21
+
22
+ private
23
+
24
+ def cmd(*args)
25
+ ::EacRubyUtils::Envs.local.command(*args)
26
+ end
27
+
28
+ def rubocop_command_uncached
29
+ %w[env configured gemfile].each do |s|
30
+ cmd = send("#{s}_rubocop_command")
31
+ return cmd if cmd.present?
32
+ end
33
+ cmd('rubocop')
34
+ end
35
+
36
+ def rubocop_command_with_args
37
+ rubocop_command.append(rubocop_args)
38
+ end
39
+
40
+ def rubocop_version_uncached
41
+ ::EacRubyUtils::Ruby.on_clean_environment do
42
+ rubocop_command.append(['--version']).execute!.strip
43
+ end
44
+ end
45
+
46
+ def run_rubocop
47
+ ::EacRubyUtils::Ruby.on_clean_environment { rubocop_command_with_args.system }
48
+ end
49
+
50
+ def start_banner
51
+ infov 'Rubocop version', rubocop_version
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_generic_base0/sources/base'
4
+ require 'avm/eac_ruby_base1/sources/update'
5
+ require 'avm/eac_ruby_base1/sources/tester'
6
+ require 'eac_ruby_gems_utils/gem'
7
+ require 'eac_ruby_utils/core_ext'
8
+
9
+ module Avm
10
+ module EacRubyBase1
11
+ module Sources
12
+ class Base < ::Avm::EacGenericBase0::Sources::Base
13
+ delegate :gemspec_path, to: :the_gem
14
+
15
+ def gemfile_path
16
+ path.join('Gemfile')
17
+ end
18
+
19
+ def valid?
20
+ gemfile_path.exist? || gemspec_path.present?
21
+ end
22
+
23
+ # @return [Avm::EacRubyBase1::Sources::Tester]
24
+ def tester_class
25
+ Avm::EacRubyBase1::Sources::Tester
26
+ end
27
+
28
+ # @return [EacRubyGemsUtils::Gem]
29
+ def the_gem
30
+ @the_gem ||= ::EacRubyGemsUtils::Gem.new(path)
31
+ end
32
+
33
+ def update
34
+ ::Avm::EacRubyBase1::Sources::Update.new(self)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/source_stereotypes/tester'
3
+ require 'avm/eac_generic_base0/sources/tester'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacRubyBase1
8
- module SourceStereotypes
9
- class Tester < ::Avm::SourceStereotypes::Tester
8
+ module Sources
9
+ class Tester < ::Avm::EacGenericBase0::Sources::Tester
10
10
  BUNDLE_TEST_COMMAND_CONFIGURATION_KEY = :bundle_test_command
11
11
 
12
- delegate :the_gem, to: :source_stereotype
12
+ delegate :the_gem, to: :source
13
13
 
14
14
  # @return [EacRubyUtils::Envs::Command, nil]
15
15
  def test_command
@@ -19,7 +19,7 @@ module Avm
19
19
  # @return [EacRubyGemsUtils::Gem::Command, nil]
20
20
  def bundle_test_command
21
21
  source.read_configuration_as_shell_words(BUNDLE_TEST_COMMAND_CONFIGURATION_KEY)
22
- .if_present { |args| the_gem.bundle(*args).chdir_root }
22
+ .if_present { |args| the_gem.bundle(*args).chdir_root }
23
23
  end
24
24
 
25
25
  # @return [EacRubyGemsUtils::Gem::Command, nil]
@@ -28,7 +28,8 @@ module Avm
28
28
  end
29
29
 
30
30
  def run_test_command
31
- execute_command_and_log(the_gem.bundle('install').chdir_root)
31
+ execute_command_and_log(the_gem.bundle('install').chdir_root) ||
32
+ execute_command_and_log(the_gem.bundle('update').chdir_root)
32
33
  super
33
34
  end
34
35
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- module SourceStereotypes
5
+ module Sources
6
6
  class Update
7
7
  class SubUpdate
8
8
  enable_simple_cache
@@ -18,7 +18,7 @@ module Avm
18
18
  if commit.no_scm_changed_files.any?
19
19
  commit = commit.reword(no_scm_update_commit_message)
20
20
  source.scm.commit_if_change { source_update.bundle_update }
21
- .if_present { |v| v.merge_with(commit) }
21
+ .if_present { |v| v.merge_with(commit) }
22
22
  else
23
23
  commit.reword(scm_update_commit_message)
24
24
  end
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacRubyBase1
8
- module SourceStereotypes
8
+ module Sources
9
9
  class Update
10
10
  require_sub __FILE__
11
11
  enable_simple_cache
@@ -40,7 +40,7 @@ module Avm
40
40
 
41
41
  def update_subs
42
42
  source.subs.each do |sub|
43
- ::Avm::EacRubyBase1::SourceStereotypes::Update::SubUpdate.new(self, sub)
43
+ ::Avm::EacRubyBase1::Sources::Update::SubUpdate.new(self, sub)
44
44
  end
45
45
  end
46
46
 
@@ -4,7 +4,7 @@ require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
6
  module EacRubyBase1
7
- module SourceStereotypes
7
+ module Sources
8
8
  require_sub __FILE__
9
9
  end
10
10
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.2.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
data/locale/en.yaml ADDED
@@ -0,0 +1,8 @@
1
+ en:
2
+ avm:
3
+ eac_ruby_base1:
4
+ sources:
5
+ update:
6
+ no_scm_update_commit_message: "Gem \"%{name}\" (Local): update to '%{version}'."
7
+ scm_update_commit_message: '**/.gitrepo: fix/update.'
8
+ update_gemfile_lock_commit_message: 'All gems: update.'
data/locale/pt-BR.yaml ADDED
@@ -0,0 +1,8 @@
1
+ pt-BR:
2
+ avm:
3
+ eac_ruby_base1:
4
+ sources:
5
+ update:
6
+ no_scm_update_commit_message: "Gem \"%{name}\" (Local): atualiza para '%{version}'."
7
+ scm_update_commit_message: '**/.gitrepo: conserta/atualiza.'
8
+ update_gemfile_lock_commit_message: 'Todas as gems: atualiza.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-eac_ruby_base1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-21 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: avm-eac_generic_base0
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: eac_ruby_gems_utils
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -64,14 +78,14 @@ dependencies:
64
78
  requirements:
65
79
  - - "~>"
66
80
  - !ruby/object:Gem::Version
67
- version: '0.4'
81
+ version: 0.5.1
68
82
  type: :development
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
86
  - - "~>"
73
87
  - !ruby/object:Gem::Version
74
- version: '0.4'
88
+ version: 0.5.1
75
89
  description:
76
90
  email:
77
91
  executables: []
@@ -81,12 +95,18 @@ files:
81
95
  - lib/avm/eac_ruby_base1.rb
82
96
  - lib/avm/eac_ruby_base1/patches.rb
83
97
  - lib/avm/eac_ruby_base1/patches/i18n.rb
84
- - lib/avm/eac_ruby_base1/source_stereotypes.rb
85
- - lib/avm/eac_ruby_base1/source_stereotypes/base.rb
86
- - lib/avm/eac_ruby_base1/source_stereotypes/tester.rb
87
- - lib/avm/eac_ruby_base1/source_stereotypes/update.rb
88
- - lib/avm/eac_ruby_base1/source_stereotypes/update/sub_update.rb
98
+ - lib/avm/eac_ruby_base1/rubocop.rb
99
+ - lib/avm/eac_ruby_base1/rubocop/configured.rb
100
+ - lib/avm/eac_ruby_base1/rubocop/envvar.rb
101
+ - lib/avm/eac_ruby_base1/rubocop/gemfile.rb
102
+ - lib/avm/eac_ruby_base1/sources.rb
103
+ - lib/avm/eac_ruby_base1/sources/base.rb
104
+ - lib/avm/eac_ruby_base1/sources/tester.rb
105
+ - lib/avm/eac_ruby_base1/sources/update.rb
106
+ - lib/avm/eac_ruby_base1/sources/update/sub_update.rb
89
107
  - lib/avm/eac_ruby_base1/version.rb
108
+ - locale/en.yaml
109
+ - locale/pt-BR.yaml
90
110
  homepage:
91
111
  licenses: []
92
112
  metadata: {}
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/source_stereotypes/base'
4
- require 'avm/eac_ruby_base1/source_stereotypes/update'
5
- require 'avm/eac_ruby_base1/source_stereotypes/tester'
6
- require 'eac_ruby_gems_utils/gem'
7
- require 'eac_ruby_utils/core_ext'
8
-
9
- module Avm
10
- module EacRubyBase1
11
- module SourceStereotypes
12
- class Base < ::Avm::SourceStereotypes::Base
13
- delegate :gemspec_path, to: :the_gem
14
-
15
- def gemfile_path
16
- source.path.join('Gemfile')
17
- end
18
-
19
- def valid?
20
- gemfile_path.exist? || gemspec_path.present?
21
- end
22
-
23
- # @return [Avm::EacRubyBase1::SourceStereotypes::Tester]
24
- def tester_class
25
- Avm::EacRubyBase1::SourceStereotypes::Tester
26
- end
27
-
28
- # @return [EacRubyGemsUtils::Gem]
29
- def the_gem
30
- @the_gem ||= ::EacRubyGemsUtils::Gem.new(source.path)
31
- end
32
-
33
- def update_source(source)
34
- ::Avm::EacRubyBase1::SourceStereotypes::Update.new(source)
35
- end
36
- end
37
- end
38
- end
39
- end