avm-eac_ruby_base1 0.3.0 → 0.5.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: d7114215e648744773d7622143c295115a14ec8550f61911172b9a79419a0211
4
- data.tar.gz: 6fabf40dbe6e8ab5d78ca46dc980006ae96bbf763c429dc87de84d250f1464f0
3
+ metadata.gz: de35d5fa535fdc0c796068eba1e0bdafd96ea2424b05cc1136b9280fdbcf9ab4
4
+ data.tar.gz: b634b46d9b404a31b5706c6e465c73247d7cf6bec81d8dfd9beccf461813316f
5
5
  SHA512:
6
- metadata.gz: 9b6b54ce2d55f1dc07ade11346100c4247801f998eac7b811a1f406bd6de60db74785266e1ee8b8d63c8aef2abf702e8bbec5932b884a49b1b79b98a48a97e1d
7
- data.tar.gz: ce15f43808de95c570bacf5e991a5a8523e63bb7551a3f33f261498672ae0ae573452e92557cab9ab2fef645b22b623d8fd2646c110e909fb21040a3130c56fd
6
+ metadata.gz: a3def674b0a551e351553972503cc401b21b81c08cacb8b9fb5dd8de35cd1029d5668346e1ec589bf54adc8579c46af8db630a75f8a0d441c8519693ca2d40cf
7
+ data.tar.gz: 206b8b7f43ea1150a2a52a4e4789cd64e89306241961ed5ab3610ffaf4034f60f97acee70c5318f49b75076f9fc82022510c3028166bfe2b741abf52d8c24284
@@ -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,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
@@ -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]
@@ -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
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_ruby_base1/patches/i18n'
4
3
  require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module Avm
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.3.0'
5
+ VERSION = '0.5.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.3.0
4
+ version: 0.5.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-26 00:00:00.000000000 Z
11
+ date: 2022-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '0.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: '0.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: eac_ruby_gems_utils
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.4'
81
+ version: 0.5.1
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0.4'
88
+ version: 0.5.1
89
89
  description:
90
90
  email:
91
91
  executables: []
@@ -93,14 +93,19 @@ extensions: []
93
93
  extra_rdoc_files: []
94
94
  files:
95
95
  - lib/avm/eac_ruby_base1.rb
96
- - lib/avm/eac_ruby_base1/patches.rb
97
- - lib/avm/eac_ruby_base1/patches/i18n.rb
96
+ - lib/avm/eac_ruby_base1/rubocop.rb
97
+ - lib/avm/eac_ruby_base1/rubocop/configured.rb
98
+ - lib/avm/eac_ruby_base1/rubocop/envvar.rb
99
+ - lib/avm/eac_ruby_base1/rubocop/gemfile.rb
98
100
  - lib/avm/eac_ruby_base1/sources.rb
99
101
  - lib/avm/eac_ruby_base1/sources/base.rb
102
+ - lib/avm/eac_ruby_base1/sources/base/version_bump.rb
100
103
  - lib/avm/eac_ruby_base1/sources/tester.rb
101
104
  - lib/avm/eac_ruby_base1/sources/update.rb
102
105
  - lib/avm/eac_ruby_base1/sources/update/sub_update.rb
103
106
  - lib/avm/eac_ruby_base1/version.rb
107
+ - locale/en.yaml
108
+ - locale/pt-BR.yaml
104
109
  homepage:
105
110
  licenses: []
106
111
  metadata: {}
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'i18n'
5
-
6
- ::I18n.load_path += __dir__.to_pathname.expand_path.parent_n(4).join('locale').glob('*.yaml')
7
- .map(&:to_path)
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)