avm-eac_ruby_base1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 631ca25e1611d66cd5dcf0b78764dca4783ee96765e68b8106c5255f759b7352
4
+ data.tar.gz: 4a3d7fa6f51db04d95f1faeb71aa74b62a54a382c4836d50abd541d039f64c71
5
+ SHA512:
6
+ metadata.gz: 42fb3572b0ed83aeb7af412158bac404941da9bffde36324d1df3121546d6e44279f9a5e3e470b15588dcec5788a3fe4e964ae1fc28beb350a3b9ba9229c9e01
7
+ data.tar.gz: 8c1aeb5c67460137f090e9298d55c8ce371eb62eb160f40547018e6bebfe00b89240cae21ce9d50105f59d27fca557adf1a37ed5cb0a987960cb579552173787
@@ -0,0 +1,7 @@
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)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/source_stereotypes/base'
4
+ require 'avm/eac_ruby_base1/source_stereotypes/update'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacRubyBase1
9
+ module SourceStereotypes
10
+ class Base < ::Avm::SourceStereotypes::Base
11
+ def gemfile_path
12
+ source.path.join('Gemfile')
13
+ end
14
+
15
+ def valid?
16
+ gemfile_path.exist? || gemspec_file.exist?
17
+ end
18
+
19
+ def update_source(source)
20
+ ::Avm::EacRubyBase1::SourceStereotypes::Update.new(source)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacRubyBase1
5
+ module SourceStereotypes
6
+ class Update
7
+ class SubUpdate
8
+ enable_simple_cache
9
+ enable_speaker
10
+ common_constructor :source_update, :sub do
11
+ perform
12
+ end
13
+ delegate :source, to: :source_update
14
+
15
+ protected
16
+
17
+ def on_scm_updated(commit)
18
+ if commit.no_scm_changed_files.any?
19
+ commit = commit.reword(no_scm_update_commit_message)
20
+ source.scm.commit_if_change { source_update.bundle_update }
21
+ .if_present { |v| v.merge_with(commit) }
22
+ else
23
+ commit.reword(scm_update_commit_message)
24
+ end
25
+ end
26
+
27
+ def perform
28
+ update_scm.if_present { |commit| on_scm_updated(commit) }
29
+ end
30
+
31
+ def ruby_gem_uncached
32
+ ::EacRubyGemsUtils::Gem.new(sub.path)
33
+ end
34
+
35
+ def no_scm_update_commit_message
36
+ source_update.i18n_translate(__method__, __locale: source.locale,
37
+ name: ruby_gem.name,
38
+ version: ruby_gem.version)
39
+ end
40
+
41
+ def scm_update_commit_message
42
+ source_update.i18n_translate(__method__, __locale: source.locale)
43
+ end
44
+
45
+ # @return [Avm::Scms::Commit]
46
+ def update_scm
47
+ infom "Updating \"#{sub}\"..."
48
+ source.scm.commit_if_change do
49
+ sub.scm.update
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ruby_base1/patches/i18n'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ module SourceStereotypes
9
+ class Update
10
+ require_sub __FILE__
11
+ enable_simple_cache
12
+ enable_speaker
13
+ common_constructor :source do
14
+ perform
15
+ end
16
+
17
+ def bundle_update
18
+ infom 'Running "bundle update"...'
19
+ ruby_gem.bundle('update').execute!
20
+ infom 'Running "bundle install"...'
21
+ ruby_gem.bundle('install').execute!
22
+ end
23
+
24
+ protected
25
+
26
+ def perform
27
+ update_gemfile_lock
28
+ update_subs
29
+ end
30
+
31
+ def update_gemfile_lock
32
+ source.scm.commit_if_change(-> { update_gemfile_lock_commit_message }) do
33
+ bundle_update
34
+ end
35
+ end
36
+
37
+ def update_gemfile_lock_commit_message
38
+ i18n_translate(__method__, __locale: source.locale)
39
+ end
40
+
41
+ def update_subs
42
+ source.subs.each do |sub|
43
+ ::Avm::EacRubyBase1::SourceStereotypes::Update::SubUpdate.new(self, sub)
44
+ end
45
+ end
46
+
47
+ def ruby_gem_uncached
48
+ ::EacRubyGemsUtils::Gem.new(source.path)
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ module SourceStereotypes
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacRubyBase1
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRubyBase1
7
+ require_sub __FILE__
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: avm-eac_ruby_base1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Put here the authors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: avm
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: eac_ruby_utils
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.76'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.76'
41
+ - !ruby/object:Gem::Dependency
42
+ name: eac_ruby_gem_support
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.4'
55
+ description:
56
+ email:
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - lib/avm/eac_ruby_base1.rb
62
+ - lib/avm/eac_ruby_base1/patches.rb
63
+ - lib/avm/eac_ruby_base1/patches/i18n.rb
64
+ - lib/avm/eac_ruby_base1/source_stereotypes.rb
65
+ - lib/avm/eac_ruby_base1/source_stereotypes/base.rb
66
+ - lib/avm/eac_ruby_base1/source_stereotypes/update.rb
67
+ - lib/avm/eac_ruby_base1/source_stereotypes/update/sub_update.rb
68
+ - lib/avm/eac_ruby_base1/version.rb
69
+ homepage:
70
+ licenses: []
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubygems_version: 3.1.6
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Put here de description.
91
+ test_files: []