avmtrf1-tools 0.33.0 → 0.33.1

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avmtrf1/active_directory/user.rb +3 -3
  3. data/lib/avmtrf1/core_ext.rb +4 -0
  4. data/lib/avmtrf1/default_jira.rb +2 -2
  5. data/lib/avmtrf1/git/cached_repository.rb +2 -2
  6. data/lib/avmtrf1/git/issue_on_repository.rb +2 -2
  7. data/lib/avmtrf1/git/push_large.rb +4 -4
  8. data/lib/avmtrf1/git/push_large/lfs_commit.rb +5 -10
  9. data/lib/avmtrf1/git/push_large/lfs_commit/cache.rb +19 -0
  10. data/lib/avmtrf1/git/push_large/lfs_commit/checkout_previous_revision.rb +35 -0
  11. data/lib/avmtrf1/git/push_large/lfs_commit/commit_changes.rb +48 -0
  12. data/lib/avmtrf1/git/push_large/lfs_commit/helpers.rb +29 -0
  13. data/lib/avmtrf1/git/push_large/lfs_commit/pick_source_revision.rb +103 -0
  14. data/lib/avmtrf1/git/push_large/lfs_commit/push.rb +90 -0
  15. data/lib/avmtrf1/git/push_large/lfs_commit/track_large_files.rb +53 -0
  16. data/lib/avmtrf1/git/push_large/source_commit.rb +4 -7
  17. data/lib/avmtrf1/git/push_large/source_commit/push.rb +42 -0
  18. data/lib/avmtrf1/inventario_sistemas/site_build/html_page_base.rb +1 -1
  19. data/lib/avmtrf1/patches.rb +3 -0
  20. data/lib/avmtrf1/patches/avm.rb +4 -0
  21. data/lib/avmtrf1/patches/avm/git.rb +4 -0
  22. data/lib/avmtrf1/patches/avm/git/issue.rb +4 -0
  23. data/lib/avmtrf1/patches/avm/launcher.rb +4 -0
  24. data/lib/avmtrf1/patches/avm/launcher/git.rb +4 -0
  25. data/lib/avmtrf1/patches/avm/launcher/git/base.rb +46 -0
  26. data/lib/avmtrf1/red/helper.rb +2 -2
  27. data/lib/avmtrf1/template.rb +2 -2
  28. data/lib/avmtrf1/tools/runner.rb +5 -2
  29. data/lib/avmtrf1/tools/runner/check_point.rb +2 -2
  30. data/lib/avmtrf1/tools/runner/check_point/login.rb +5 -5
  31. data/lib/avmtrf1/tools/runner/esosti.rb +3 -3
  32. data/lib/avmtrf1/tools/runner/esosti/changed.rb +4 -4
  33. data/lib/avmtrf1/tools/runner/esosti/fetch.rb +4 -4
  34. data/lib/avmtrf1/tools/runner/esosti/request.rb +4 -4
  35. data/lib/avmtrf1/tools/runner/forponto.rb +6 -6
  36. data/lib/avmtrf1/tools/runner/forponto/espelho.rb +5 -5
  37. data/lib/avmtrf1/tools/runner/forponto/marcacoes.rb +4 -4
  38. data/lib/avmtrf1/tools/runner/forponto/resumos.rb +5 -5
  39. data/lib/avmtrf1/tools/runner/forponto/saldo.rb +5 -5
  40. data/lib/avmtrf1/tools/runner/git.rb +1 -1
  41. data/lib/avmtrf1/tools/runner/git/issues_check.rb +7 -18
  42. data/lib/avmtrf1/tools/runner/git/push_large.rb +27 -18
  43. data/lib/avmtrf1/tools/runner/oracle.rb +15 -22
  44. data/lib/avmtrf1/tools/runner/oracle/query.rb +10 -12
  45. data/lib/avmtrf1/tools/runner/oracle/source_get.rb +17 -18
  46. data/lib/avmtrf1/tools/runner/oracle/user_clear.rb +7 -15
  47. data/lib/avmtrf1/tools/runner/php/docker.rb +3 -3
  48. data/lib/avmtrf1/tools/runner/red.rb +21 -25
  49. data/lib/avmtrf1/tools/runner/trf1_dspace_base0.rb +9 -18
  50. data/lib/avmtrf1/tools/runner/trf1_dspace_base0/deploy.rb +1 -1
  51. data/lib/avmtrf1/tools/version.rb +1 -1
  52. metadata +22 -93
  53. data/lib/avmtrf1/configs.rb +0 -24
  54. data/lib/avmtrf1/git/push_large/lfs_commit/_00_checkout_previous_revision.rb +0 -33
  55. data/lib/avmtrf1/git/push_large/lfs_commit/_01_cherry_pick_source_revision.rb +0 -89
  56. data/lib/avmtrf1/git/push_large/lfs_commit/_02_track_large_files.rb +0 -51
  57. data/lib/avmtrf1/git/push_large/lfs_commit/_03_commit_changes.rb +0 -46
  58. data/lib/avmtrf1/git/push_large/lfs_commit/_04_push.rb +0 -88
  59. data/lib/avmtrf1/git/push_large/lfs_commit/_cache.rb +0 -17
  60. data/lib/avmtrf1/git/push_large/lfs_commit/_helpers.rb +0 -27
  61. data/lib/avmtrf1/git/push_large/source_commit/_push.rb +0 -40
  62. data/lib/avmtrf1/patches/eac_launcher/git/base.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28aaea569505102ad3211b02ec77cf0c2b290acc629b3530190acf0603f289d1
4
- data.tar.gz: 755924e206af72290f5958622a20a545cf925882b4ebc6a8c1e5fc7821bbe6ef
3
+ metadata.gz: 13ca822eb7feaa967b8c8e4d3eec857e6be2dbf9fab206c86a6de1e9ce1d8139
4
+ data.tar.gz: 04b94662a9a4fab3ee300e32c266be782f026b8e3b75a9fa98db369f9823ce3e
5
5
  SHA512:
6
- metadata.gz: 767c2478bcc066672821f52114c903f4bf6e30f44b6a1a746c045cce80c33b8589f1fc36051b33009fc02318ff6971b15cc039cc9aad7b725ea93a291a5aa563
7
- data.tar.gz: 382e3a8930764a843005e9c24a2f8e9f1cb3deb89886433ed34bcfa40996aaf2a57324c8e61a146cb1834810dff2deeb4fc13fddbb53eb8fbc75610fab557f43
6
+ metadata.gz: 4811f9b817eb6479acc6f4efe29d41883c746a3e46457e0a96413a955579a96d2ce653e983c81a85706eec246bd20c385a988688ef32dfcd85d7745202bba8bd
7
+ data.tar.gz: f946e8997c09ba14b181afb40cc0d8a0094e813499eff1bd8f0d85097542ecd33b4a03e6a25f2c553c95f61f77beeef0b0a8e941bc2eb3fcb50f3bdccb0b6860
@@ -6,9 +6,9 @@ module Avmtrf1
6
6
  class << self
7
7
  def by_configs(path_prefix)
8
8
  new(
9
- ::Avmtrf1.configs.read_entry("#{path_prefix}.domain"),
10
- ::Avmtrf1.configs.read_entry("#{path_prefix}.username"),
11
- ::Avmtrf1.configs.read_password("#{path_prefix}.password")
9
+ ::Avm::Apps::Config.current.read_entry("#{path_prefix}.domain"),
10
+ ::Avm::Apps::Config.current.read_entry("#{path_prefix}.username"),
11
+ ::Avm::Apps::Config.current.read_password("#{path_prefix}.password")
12
12
  )
13
13
  end
14
14
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/core_ext'
4
+ require 'avmtrf1/patches'
@@ -9,8 +9,8 @@ module Avmtrf1
9
9
  def default_jira
10
10
  @default_jira ||= ::Avmtrf1::Jira::Instance.new(
11
11
  'https://jira.engesoftware.com.br',
12
- ::Avmtrf1.configs.read_entry("#{DEFAULT_JIRA_PATH_PREFIX}.username"),
13
- ::Avmtrf1.configs.read_password("#{DEFAULT_JIRA_PATH_PREFIX}.password")
12
+ ::Avm::Apps::Config.current.read_entry("#{DEFAULT_JIRA_PATH_PREFIX}.username"),
13
+ ::Avm::Apps::Config.current.read_password("#{DEFAULT_JIRA_PATH_PREFIX}.password")
14
14
  )
15
15
  end
16
16
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_launcher/git/base'
3
+ require 'avm/launcher/git/base'
4
4
 
5
5
  module Avmtrf1
6
6
  module Git
7
- class CachedRepository < ::EacLauncher::Git::Base
7
+ class CachedRepository < ::Avm::Launcher::Git::Base
8
8
  attr_reader :url
9
9
 
10
10
  def initialize(url)
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/speaker'
3
+ require 'eac_ruby_utils/patches/module/speaker'
4
4
  require 'eac_ruby_utils/simple_cache'
5
5
  require 'avmtrf1/result'
6
6
 
7
7
  module Avmtrf1
8
8
  module Git
9
9
  class IssueOnRepository
10
- include ::EacRubyUtils::Console::Speaker
10
+ enable_speaker
11
11
  include ::EacRubyUtils::SimpleCache
12
12
 
13
13
  CHECKS = %w[no_branch_nor_tag branch_and_tag issue_not_found issue_closed_git_open
@@ -2,23 +2,23 @@
2
2
 
3
3
  require 'ostruct'
4
4
 
5
- require 'eac_ruby_utils/console/speaker'
5
+ require 'eac_ruby_utils/patches/module/speaker'
6
6
  require 'eac_ruby_utils/require_sub'
7
7
  require 'eac_ruby_utils/simple_cache'
8
- require 'avmtrf1/patches/eac_launcher/git/base'
8
+ require 'avmtrf1/patches/avm/launcher/git/base'
9
9
 
10
10
  module Avmtrf1
11
11
  module Git
12
12
  class PushLarge
13
13
  include ::EacRubyUtils::SimpleCache
14
- include ::EacRubyUtils::Console::Speaker
14
+ enable_speaker
15
15
 
16
16
  ::EacRubyUtils.require_sub(__FILE__)
17
17
 
18
18
  attr_reader :git, :remote_name, :source_ref, :target_ref, :last_pushed_revision
19
19
 
20
20
  def initialize(git_local_path, remote_name, source_ref, target_ref)
21
- @git = ::EacLauncher::Git::Base.new(git_local_path)
21
+ @git = ::Avm::Launcher::Git::Base.new(git_local_path)
22
22
  @remote_name = remote_name
23
23
  @source_ref = source_ref
24
24
  @target_ref = target_ref
@@ -1,21 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/require_sub'
3
+ require 'avmtrf1/core_ext'
4
4
 
5
5
  module Avmtrf1
6
6
  module Git
7
7
  class PushLarge
8
8
  class LfsCommit
9
- include ::EacRubyUtils::Console::Speaker
10
- include ::EacRubyUtils::SimpleCache
9
+ require_sub __FILE__, include_modules: true
10
+ enable_simple_cache
11
+ enable_speaker
11
12
 
12
- ::EacRubyUtils.require_sub(__FILE__)
13
-
14
- attr_reader :source_commit, :lfs_file_min_size, :tracked_files
15
-
16
- def initialize(source_commit, lfs_file_min_size)
17
- @source_commit = source_commit
18
- @lfs_file_min_size = lfs_file_min_size
13
+ common_constructor :source_commit, :lfs_file_min_size do
19
14
  @tracked_files = 0
20
15
  @commit = nil
21
16
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ module Cache
8
+ def fs_cache_uncached
9
+ source_commit.fs_cache.child(lfs_file_min_size.present? ? lfs_file_min_size : 'nil')
10
+ end
11
+
12
+ %w[sha1 files_size push_pack_error].each do |attr|
13
+ define_method("#{attr}_cache_uncached") { fs_cache.child(attr) }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ module CheckoutPreviousRevision
8
+ private
9
+
10
+ def checkout_base_uncached
11
+ if previous_revision.blank?
12
+ checkout_orphan
13
+ else
14
+ checkout_previous_revision
15
+ end
16
+ end
17
+
18
+ def checkout_orphan
19
+ infom message('Checkout orphan')
20
+ git.execute!('reset', '--hard')
21
+ git.execute!('clean', '-df')
22
+ git.execute!('checkout', source_commit.sha1)
23
+ end
24
+
25
+ def checkout_previous_revision
26
+ infom message("Checkout previous revision #{previous_revision}")
27
+ git.execute!('reset', '--hard')
28
+ git.execute!('clean', '-df')
29
+ git.execute!('checkout', previous_revision)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ module CommitChanges
8
+ # @return [Avm::Git::Commit]
9
+ def commit
10
+ commit_changes
11
+ @commit
12
+ end
13
+
14
+ private
15
+
16
+ def commit_changes_uncached
17
+ if sha1_cache.read.present?
18
+ @commit = ::Avm::Git::Commit.new(git, sha1_cache.read)
19
+ return
20
+ end
21
+ track_large_files
22
+ add_files
23
+ commit_amend
24
+ store_commit
25
+ end
26
+
27
+ def add_files
28
+ infom ' * Adding files'
29
+ git.system!('add', '.')
30
+ end
31
+
32
+ def commit_amend
33
+ infom message('Commiting')
34
+ git.command('commit', '--amend', '--allow-empty', '--allow-empty-message')
35
+ .envvar('GIT_EDITOR', true).execute!
36
+ end
37
+
38
+ def store_commit
39
+ @commit = ::Avm::Git::Commit.new(git, git.rev_parse('HEAD'))
40
+ infov message('Commited (SHA1)'), @commit.sha1
41
+ sha1_cache.write(@commit.sha1)
42
+ files_size_cache.write(@commit.files_size)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ module Helpers
8
+ private
9
+
10
+ def message(suffix, padding = 0)
11
+ "#{(' ' * (padding + 2))}* #{suffix}"
12
+ end
13
+
14
+ def git
15
+ source_commit.git
16
+ end
17
+
18
+ def push_large
19
+ source_commit.push_large
20
+ end
21
+
22
+ def previous_revision
23
+ push_large.last_pushed_revision
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ module PickSourceRevision
8
+ private
9
+
10
+ def add_cacheinfo_fail?(result)
11
+ !result.fetch(:exit_code).zero? && result.fetch(:stderr).include?('add_cacheinfo')
12
+ end
13
+
14
+ def cherry_pick_source_revision_uncached
15
+ checkout_base
16
+ return unless previous_revision.present?
17
+
18
+ infom message("Cherry pick #{source_commit.sha1}")
19
+ result = git.execute('cherry-pick', '--allow-empty', '--allow-empty-message',
20
+ '-Xtheirs', source_commit.sha1)
21
+ check_cherry_pick_result(result)
22
+ end
23
+
24
+ def check_cherry_pick_result(result)
25
+ return if result.fetch(:exit_code).zero?
26
+ return on_cherry_pick_conflict if cherry_pick_conflict?
27
+ return on_add_cacheinfo_fail if add_cacheinfo_fail?(result)
28
+
29
+ raise "Cherry pick failed: #{result}"
30
+ end
31
+
32
+ def cherry_pick_conflict?
33
+ ::File.exist?(::File.join(git, '.git', 'CHERRY_PICK_HEAD'))
34
+ end
35
+
36
+ def on_add_cacheinfo_fail
37
+ warn message('"add_cacheinfo" fail')
38
+ end
39
+
40
+ def on_cherry_pick_conflict
41
+ warn message('Cherry pick failed with conflict')
42
+ resolve_cherry_pick_conflicts
43
+
44
+ check_dirty_files
45
+ check_cherry_continue
46
+ end
47
+
48
+ def resolve_cherry_pick_conflicts
49
+ git.status_files.each do |scf|
50
+ if scf.dirty == 'D'
51
+ remove_file(scf.path)
52
+ elsif scf.dirty.present?
53
+ add_file(scf.path)
54
+ end
55
+ end
56
+ end
57
+
58
+ def remove_file(path)
59
+ infov message('Removing file'), path
60
+ git.execute!('rm', path)
61
+ end
62
+
63
+ def add_file(path)
64
+ infov message('Adding file'), path
65
+ git.execute!('add', path)
66
+ end
67
+
68
+ def check_dirty_files
69
+ infom message('Checking dirty files...')
70
+ df = dirty_files
71
+ infov message('Dirty files?'), df.any?
72
+ return unless df.any?
73
+
74
+ df.each do |f|
75
+ infov message(f.path, 1), "|#{f.stage}|#{f.dirty}|"
76
+ end
77
+ raise 'There are dirty files'
78
+ end
79
+
80
+ def dirty_files
81
+ git.status_files.select { |scf| scf.dirty.present? }
82
+ end
83
+
84
+ def check_cherry_continue
85
+ infom message('Continuing cherry pick')
86
+ git.execute!('-c', "core.editor=#{bash_editor}", 'cherry-pick', '--continue')
87
+ raise 'Still in cherry-pick conflict' if cherry_pick_conflict?
88
+
89
+ infom message('Cherry pick continue successful')
90
+ end
91
+
92
+ def bash_editor
93
+ if source_commit.subject.present?
94
+ 'true'
95
+ else
96
+ 'bash -c "printf \\"Mensagem original em branco.\\n\\" > $1"'
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ module Push
8
+ private
9
+
10
+ PACK_ERROR_MESSAGE = 'pack exceeds maximum allowed size'
11
+ PACK_ERROR_TRUE = 'true'
12
+ PACK_ERROR_FALSE = 'false'
13
+
14
+ def push_ok_uncached
15
+ commit
16
+ fresh_push if push_pack_error_cache.read.blank?
17
+ after_push_banner
18
+ push_pack_error_cache.read != PACK_ERROR_TRUE
19
+ end
20
+
21
+ def after_push_banner
22
+ infov message('Commit SHA1'), commit.sha1
23
+ raise 'Cache of files size not found' if files_size_cache.read.blank?
24
+
25
+ infov message('Files size'), PushLarge.bytes_size(files_size_cache.read)
26
+ end
27
+
28
+ def fresh_push
29
+ fresh_push_banner
30
+ check_push_result(
31
+ git.execute(
32
+ 'push', push_large.remote_name, '--force',
33
+ "#{commit.sha1}:#{push_reference}"
34
+ )
35
+ )
36
+ end
37
+
38
+ def fresh_push_banner
39
+ infom message('Pushing...')
40
+ fresh_push_commit_banner
41
+ fresh_push_remote_banner
42
+ end
43
+
44
+ def fresh_push_commit_banner
45
+ infov message('SHA1', 1), commit.sha1
46
+ infov message('Files size', 1), PushLarge.bytes_size(commit.files_size)
47
+ end
48
+
49
+ def fresh_push_remote_banner
50
+ infov message('Remote', 1), push_large.remote_name
51
+ infov message('Reference', 1), push_reference
52
+ end
53
+
54
+ def push_reference
55
+ "refs/heads/#{push_large.target_ref}"
56
+ end
57
+
58
+ def check_push_result(result)
59
+ if result.fetch(:exit_code).zero?
60
+ on_push_result_ok
61
+ elsif result.fetch(:stderr).include?(PACK_ERROR_MESSAGE)
62
+ on_push_result_pack_error
63
+ else
64
+ on_push_result_arbitrary_error(result)
65
+ end
66
+ end
67
+
68
+ def on_push_result_ok
69
+ push_pack_error_cache.write(PACK_ERROR_FALSE)
70
+ success(push_message('successful'))
71
+ end
72
+
73
+ def on_push_result_pack_error
74
+ push_pack_error_cache.write(PACK_ERROR_TRUE)
75
+ warn(push_message("failed with message \"#{PACK_ERROR_MESSAGE}\""))
76
+ end
77
+
78
+ def on_push_result_arbitrary_error(result)
79
+ raise result.pretty_inspect.to_s
80
+ end
81
+
82
+ def push_message(suffix)
83
+ message("Push of #{commit.sha1} (Size: #{commit.files_size}, " \
84
+ "Files: #{commit.files.count}): #{suffix}.")
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end