avm-eac_redmine_base0 0.28.0 → 0.29.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3ffa482fea028f8f13669be8893fd3f883237601476c5ad785536ed5b55f9a5
4
- data.tar.gz: 126d7281e2b85b18ca5adc47df04907e369f5a9085f19aad82c34b738dc68b86
3
+ metadata.gz: 5097d7b22433940fb8250d0e4b5e4a35bfa108442b3389433e69d16971cd4ed8
4
+ data.tar.gz: 719c3940e5ecec285cc0fc2dab888ad5e1fe65f8ce16f5fc4f568d417e657e37
5
5
  SHA512:
6
- metadata.gz: ac03c79773405131e38a3c2ba23e9bba3baad9559ec59a2f8fdf0b183f893b6230d1bf7ea42aab3207f05a415c94eefbc52e9984e730c5760b48386253dd49d3
7
- data.tar.gz: 7e2165a61d9b8626d1e2d488879e9b626ad1f0f15fcefdce7ebefc2c3a56ae6d25e3c9eb57d5e9455ad0f85f2852e5b1e1046d52892066a2963ea4dd05dc0e6b
6
+ metadata.gz: 98763b89ab2fcbf1aa03516907a24299c1e93259ffaea03f23cac103e816c5590c3ab990e196861a74fffc3c1e098c7a6ddc8bc5f0ecf6970984944f5a6b8659
7
+ data.tar.gz: c351e33d75239c43a9d6defeb5961bfd63fe9f85ec311cb9f18cfe33b842fe07ac9ab0194967eb22698f0ba6459f096cf6aa0c6d8de592046bda253f3d42e307
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacRedmineBase0
5
+ module Sources
6
+ class CoreUpdate
7
+ module BundleChanges
8
+ GEMFILE_CONFLICTED_GEMS = %w[rubocop rubocop-rails].freeze
9
+
10
+ # @return [void]
11
+ def bundle_changes
12
+ disable_gemfile_conflicted_gems
13
+ load_subs_from_gemfile
14
+ generate_gemfile_lock
15
+ end
16
+
17
+ # @return [void]
18
+ def disable_gemfile_conflicted_gems
19
+ GEMFILE_CONFLICTED_GEMS.each do |gem_name|
20
+ disable_gemfile_gem(gem_name)
21
+ end
22
+ end
23
+
24
+ # @param gem_name [String]
25
+ # @return [void]
26
+ def disable_gemfile_gem(gem_name)
27
+ source.gemfile_path.write(
28
+ source.gemfile_path.read.gsub(gemfile_gem_line_pattern(gem_name), '\1# \2')
29
+ )
30
+ end
31
+
32
+ # @param gem_name [String]
33
+ # @return [Regexp]
34
+ def gemfile_gem_line_pattern(gem_name)
35
+ /^([ \t]*)(gem[ \t]+['"]#{::Regexp.quote(gem_name)}['"].*)$/
36
+ end
37
+
38
+ # @return [void]
39
+ def generate_gemfile_lock
40
+ source.bundle_update.system!
41
+ end
42
+
43
+ # @return [void]
44
+ def load_subs_from_gemfile
45
+ source.gemfile_path.write(load_subs_from_gemfile_code, mode: 'a')
46
+ end
47
+
48
+ # @return [String]
49
+ def load_subs_from_gemfile_code
50
+ <<~'CODE'
51
+
52
+ # Subs
53
+ Dir["#{File.join(__dir__, 'sub')}/*"].each do |dir|
54
+ next unless File.exist?(File.join(dir, "#{File.basename(dir)}.gemspec"))
55
+
56
+ gem File.basename(dir), path: dir, require: false
57
+ end
58
+ CODE
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacRedmineBase0
5
+ module Sources
6
+ class CoreUpdate
7
+ module Scm
8
+ enable_memoized
9
+
10
+ # @return [void]
11
+ def git_commit
12
+ if git_repo.dirty?
13
+ infom 'Git commiting...'
14
+ git_repo.command('add', '--', target_path).execute!
15
+ git_repo.command('commit', '-m', git_commit_message, '--', target_path).execute!
16
+ else
17
+ infom 'Nothing to commit'
18
+ end
19
+ end
20
+
21
+ # @return [String]
22
+ def git_commit_message
23
+ i18n_translate(__method__, version: version, __locale: source.locale)
24
+ end
25
+
26
+ # @return [EacGit::Local]
27
+ memoize def git_repo
28
+ ::EacGit::Local.new(target_path)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacRedmineBase0
5
+ module Sources
6
+ class CoreUpdate
7
+ module SourcePackage
8
+ enable_memoized
9
+
10
+ # @return [void]
11
+ def assert_source_package
12
+ infom 'Asserting source package...'
13
+ source_package.assert
14
+ infov 'Package cache path', source_package.path
15
+ infov 'Package size', source_package.path.size
16
+ end
17
+
18
+ # @return [EacFs::CachedDownload]
19
+ memoize def source_package
20
+ ::EacFs::CachedDownload.new(url, fs_cache)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacRedmineBase0
5
+ module Sources
6
+ class CoreUpdate
7
+ module Tempdir
8
+ def on_temp_dir
9
+ ::EacRubyUtils::Fs::Temp.on_directory do |dir|
10
+ @tempdir = dir
11
+ yield
12
+ end
13
+ end
14
+
15
+ protected
16
+
17
+ attr_accessor :tempdir
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -13,37 +13,28 @@ module Avm
13
13
  GITIGNORE_DEL = %w[/Gemfile.lock /plugins/* /themes/* !/themes/README].freeze
14
14
  TARGET_KEEP = ::Avm::Sources::Base::Configuration::CONFIGURATION_FILENAMES
15
15
  .map { |b| "/#{b}" } + %w[/Gemfile.lock /plugins/*/**
16
- /themes/*/**].freeze
16
+ /themes/*/** /sub/*/**].freeze
17
17
  TARGET_REMOVE = ['/themes/README'].freeze
18
18
 
19
19
  def run
20
- ::EacRubyUtils::Fs::Temp.on_directory do |dir|
21
- @tempdir = dir
20
+ on_temp_dir do
22
21
  assert_source_package
23
22
  extract_package_to_tempdir
24
23
  sync_content
25
24
  change_git_ignore
26
25
  validate_empty_dir
26
+ bundle_changes
27
27
  end
28
28
  git_commit
29
29
  success 'Done!'
30
30
  end
31
31
 
32
- def assert_source_package
33
- infom 'Asserting source package...'
34
- source_package.assert
35
- infov 'Package cache path', source_package.path
36
- infov 'Package size', source_package.path.size
37
- end
38
-
39
32
  def fs_object_id
40
33
  [source.path, version].join('_').variableize
41
34
  end
42
35
 
43
36
  private
44
37
 
45
- attr_reader :tempdir
46
-
47
38
  def change_git_ignore
48
39
  file = target_path.join('.gitignore')
49
40
  file.write(
@@ -60,34 +51,11 @@ module Avm
60
51
  ).execute!
61
52
  end
62
53
 
63
- def git_commit
64
- if git_repo.dirty?
65
- infom 'Git commiting...'
66
- git_repo.command('add', '--', target_path).execute!
67
- git_repo.command('commit', '-m', git_commit_message, '--', target_path).execute!
68
- else
69
- infom 'Nothing to commit'
70
- end
71
- end
72
-
73
- def git_commit_message
74
- i18n_translate(__method__, version: version, __locale: source.locale)
75
- end
76
-
77
- memoize def git_repo
78
- ::EacGit::Local.new(target_path)
79
- end
80
-
81
54
  def sync_content
82
55
  ::Avm::Sync.new(source_path, target_path)
83
56
  .add_exclude('/*').add_includes(*target_files_to_remove).move_mode(true).run
84
57
  end
85
58
 
86
- # @return [EacFs::CachedDownload]
87
- memoize def source_package
88
- ::EacFs::CachedDownload.new(url, fs_cache)
89
- end
90
-
91
59
  def validate_empty_dir
92
60
  if source_path.children.empty?
93
61
  infom 'No content left in source directory'
@@ -119,6 +87,8 @@ module Avm
119
87
  memoize def target_path
120
88
  source.path
121
89
  end
90
+
91
+ require_sub __FILE__, include_modules: true
122
92
  end
123
93
  end
124
94
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRedmineBase0
5
- VERSION = '0.28.0'
5
+ VERSION = '0.29.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-eac_redmine_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.0
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
@@ -181,6 +181,10 @@ files:
181
181
  - lib/avm/eac_redmine_base0/sources/base/default_settings.rb
182
182
  - lib/avm/eac_redmine_base0/sources/base/update.rb
183
183
  - lib/avm/eac_redmine_base0/sources/core_update.rb
184
+ - lib/avm/eac_redmine_base0/sources/core_update/bundle_changes.rb
185
+ - lib/avm/eac_redmine_base0/sources/core_update/scm.rb
186
+ - lib/avm/eac_redmine_base0/sources/core_update/source_package.rb
187
+ - lib/avm/eac_redmine_base0/sources/core_update/tempdir.rb
184
188
  - lib/avm/eac_redmine_base0/sources/runners/core_update.rb
185
189
  - lib/avm/eac_redmine_base0/sources/runners/docker.rb
186
190
  - lib/avm/eac_redmine_base0/version.rb