eac_tools 0.126.2 → 0.126.3

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 (173) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +32 -30
  3. data/eac_tools.gemspec +2 -2
  4. data/lib/eac_tools/version.rb +1 -1
  5. data/sub/avm-git/.gitrepo +12 -0
  6. data/sub/{avm-eac_rails_base0 → avm-git}/.rubocop.yml +2 -2
  7. data/sub/avm-git/avm-git.gemspec +25 -0
  8. data/sub/avm-git/lib/avm/git/application_scms/base/assert_main_at.rb +44 -0
  9. data/sub/avm-git/lib/avm/git/application_scms/base.rb +18 -0
  10. data/sub/avm-git/lib/avm/git/commit/class_methods.rb +29 -0
  11. data/sub/avm-git/lib/avm/git/commit/diff_tree_line.rb +32 -0
  12. data/sub/avm-git/lib/avm/git/commit/file.rb +42 -0
  13. data/sub/avm-git/lib/avm/git/commit.rb +57 -0
  14. data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +40 -0
  15. data/sub/avm-git/lib/avm/git/issue/complete/git_subrepos.rb +20 -0
  16. data/sub/avm-git/lib/avm/git/issue/complete/local_branch.rb +59 -0
  17. data/sub/avm-git/lib/avm/git/issue/complete/local_tag.rb +37 -0
  18. data/sub/avm-git/lib/avm/git/issue/complete/push.rb +60 -0
  19. data/sub/avm-git/lib/avm/git/issue/complete/remote.rb +33 -0
  20. data/sub/avm-git/lib/avm/git/issue/complete/test.rb +34 -0
  21. data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +21 -0
  22. data/sub/avm-git/lib/avm/git/issue/complete/validation.rb +36 -0
  23. data/sub/avm-git/lib/avm/git/issue/complete/validations.rb +54 -0
  24. data/sub/avm-git/lib/avm/git/issue/complete/working_tree.rb +19 -0
  25. data/sub/avm-git/lib/avm/git/issue/complete.rb +66 -0
  26. data/sub/avm-git/lib/avm/git/launcher/base/class_methods.rb +28 -0
  27. data/sub/avm-git/lib/avm/git/launcher/base/dirty_files.rb +21 -0
  28. data/sub/avm-git/lib/avm/git/launcher/base/remotes.rb +37 -0
  29. data/sub/avm-git/lib/avm/git/launcher/base/subrepo.rb +42 -0
  30. data/sub/avm-git/lib/avm/git/launcher/base/underlying.rb +54 -0
  31. data/sub/avm-git/lib/avm/git/launcher/base.rb +80 -0
  32. data/sub/avm-git/lib/avm/git/launcher/error.rb +13 -0
  33. data/sub/avm-git/lib/avm/git/launcher/mirror_update.rb +36 -0
  34. data/sub/avm-git/lib/avm/git/launcher/publish_base.rb +128 -0
  35. data/sub/avm-git/lib/avm/git/launcher/remote.rb +53 -0
  36. data/sub/avm-git/lib/avm/git/launcher/sub_warp_base.rb +36 -0
  37. data/sub/avm-git/lib/avm/git/launcher/warp_base.rb +63 -0
  38. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/local_project_mixin.rb +16 -0
  39. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/publish.rb +13 -0
  40. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git/warp.rb +25 -0
  41. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git.rb +21 -0
  42. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/publish.rb +29 -0
  43. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +82 -0
  44. data/sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb +35 -0
  45. data/sub/avm-git/lib/avm/git/launcher_stereotypes/provider.rb +16 -0
  46. data/sub/avm-git/lib/avm/git/organize/reference_update.rb +32 -0
  47. data/sub/avm-git/lib/avm/git/organize/repository.rb +74 -0
  48. data/sub/avm-git/lib/avm/git/revision_test.rb +102 -0
  49. data/sub/avm-git/lib/avm/git/runners/base/commit.rb +98 -0
  50. data/sub/avm-git/lib/avm/git/runners/base/deploy.rb +108 -0
  51. data/sub/avm-git/lib/avm/git/runners/base/dirty_files.rb +42 -0
  52. data/sub/avm-git/lib/avm/git/runners/base/organize.rb +72 -0
  53. data/sub/avm-git/lib/avm/git/runners/base/revisions_test.rb +63 -0
  54. data/sub/avm-git/lib/avm/git/runners/base/subrepo/check.rb +45 -0
  55. data/sub/avm-git/lib/avm/git/runners/base/subrepo/clone.rb +80 -0
  56. data/sub/avm-git/lib/avm/git/runners/base/subrepo/fix/rebase.rb +51 -0
  57. data/sub/avm-git/lib/avm/git/runners/base/subrepo/fix.rb +78 -0
  58. data/sub/avm-git/lib/avm/git/runners/base/subrepo.rb +16 -0
  59. data/sub/avm-git/lib/avm/git/runners/base.rb +39 -0
  60. data/sub/avm-git/lib/avm/git/scms/git/branch.rb +28 -0
  61. data/sub/avm-git/lib/avm/git/scms/git/branches.rb +17 -0
  62. data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +34 -0
  63. data/sub/avm-git/lib/avm/git/scms/git/changed_file.rb +25 -0
  64. data/sub/avm-git/lib/avm/git/scms/git/changed_files.rb +21 -0
  65. data/sub/avm-git/lib/avm/git/scms/git/commit/deploy.rb +38 -0
  66. data/sub/avm-git/lib/avm/git/scms/git/commit/deploy_methods.rb +24 -0
  67. data/sub/avm-git/lib/avm/git/scms/git/commit.rb +64 -0
  68. data/sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb +32 -0
  69. data/sub/avm-git/lib/avm/git/scms/git/commits.rb +44 -0
  70. data/sub/avm-git/lib/avm/git/scms/git/interval.rb +28 -0
  71. data/sub/avm-git/lib/avm/git/scms/git/milestones.rb +18 -0
  72. data/sub/avm-git/lib/avm/git/scms/git/remote.rb +18 -0
  73. data/sub/avm-git/lib/avm/git/scms/git/remotes.rb +29 -0
  74. data/sub/avm-git/lib/avm/git/scms/git/run_commit.rb +54 -0
  75. data/sub/avm-git/lib/avm/git/scms/git.rb +46 -0
  76. data/sub/avm-git/lib/avm/git/scms/git_sub_base/changed_file.rb +19 -0
  77. data/sub/avm-git/lib/avm/git/scms/git_sub_base/commit.rb +23 -0
  78. data/sub/avm-git/lib/avm/git/scms/git_sub_base/interval.rb +23 -0
  79. data/sub/avm-git/lib/avm/git/scms/git_sub_base.rb +28 -0
  80. data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +28 -0
  81. data/sub/avm-git/lib/avm/git/scms/git_subtree.rb +29 -0
  82. data/sub/avm-git/lib/avm/git/scms/provider.rb +16 -0
  83. data/sub/avm-git/lib/avm/git/subrepo/check/parent.rb +50 -0
  84. data/sub/avm-git/lib/avm/git/subrepo/check/remote.rb +90 -0
  85. data/sub/avm-git/lib/avm/git/subrepo/check/show_result.rb +32 -0
  86. data/sub/avm-git/lib/avm/git/subrepo/check.rb +38 -0
  87. data/sub/avm-git/lib/avm/git/subrepo/checks.rb +59 -0
  88. data/sub/avm-git/lib/avm/git/vendor/github.rb +20 -0
  89. data/sub/{avm-eac_rails_base0/lib/avm/eac_rails_base0 → avm-git/lib/avm/git}/version.rb +2 -2
  90. data/sub/{avm-eac_rails_base0/lib/avm/eac_rails_base0.rb → avm-git/lib/avm/git.rb} +7 -3
  91. data/sub/avm-git/locale/en.yml +6 -0
  92. data/sub/avm-git/locale/pt-BR.yml +6 -0
  93. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +11 -0
  94. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out +1 -0
  95. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
  96. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.source.out +1 -0
  97. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
  98. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.source.out +1 -0
  99. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
  100. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.source.out +2 -0
  101. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
  102. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
  103. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
  104. data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +54 -0
  105. data/sub/avm-git/spec/lib/avm/git/launcher/base_spec.rb +43 -0
  106. data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec.rb +82 -0
  107. data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec_files/config.yml +5 -0
  108. data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/publish_spec_settings.yml +6 -0
  109. data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec.rb +53 -0
  110. data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec_files/config.yml +3 -0
  111. data/sub/avm-git/spec/lib/avm/git/launcher_stereotypes/git_subrepo/warp_spec_settings.yml +6 -0
  112. data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec.rb +124 -0
  113. data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec_files/append1/stub3.txt.template +1 -0
  114. data/sub/avm-git/spec/lib/avm/git/runners/base/deploy_spec_files/append2/stub4.txt +1 -0
  115. data/sub/avm-git/spec/lib/avm/git/runners/base/subrepo/fix/rebase_spec.rb +28 -0
  116. data/sub/avm-git/spec/lib/avm/git/scms/git/commit/deploy_spec.rb +89 -0
  117. data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +5 -0
  118. data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +5 -0
  119. data/sub/avm-git/spec/lib/avm/git/vendor/github_spec.rb +21 -0
  120. data/sub/{avm-eac_rails_base0 → avm-git}/spec/spec_helper.rb +2 -3
  121. metadata +125 -61
  122. data/sub/avm-eac_rails_base0/.gitrepo +0 -7
  123. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +0 -20
  124. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instances/apache_host.rb +0 -10
  125. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instances/apache_path.rb +0 -10
  126. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instances/base.rb +0 -21
  127. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/instances/deploy.rb +0 -51
  128. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/source_generators/base.rb +0 -10
  129. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base/depends_on_eac_rails_base0.rb +0 -40
  130. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb +0 -39
  131. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/instances/apache_host_spec.rb +0 -19
  132. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/instances/apache_host_spec_files/apache_host_spec_no_ssl_content.conf +0 -11
  133. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/instances/apache_path_spec.rb +0 -20
  134. data/sub/avm-eac_rails_base0/spec/lib/avm/eac_rails_base0/instances/apache_path_spec_files/stub-app_0_apache_path.conf +0 -13
  135. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/instances/deploy/config/database.yml.template +0 -21
  136. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/instances/deploy/config/envvars.d/email.yml.template +0 -11
  137. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/.gitignore +0 -34
  138. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/.rspec +0 -2
  139. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/.rubocop.yml +0 -13
  140. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Gemfile +0 -11
  141. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Rakefile +0 -8
  142. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/config/manifest.js +0 -3
  143. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/javascripts/application.js +0 -1
  144. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/stylesheets/application.scss +0 -1
  145. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/application_controller.rb +0 -4
  146. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/welcome_controller.rb +0 -5
  147. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/views/welcome/index.html.erb +0 -1
  148. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/bundle +0 -5
  149. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rails +0 -11
  150. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rake +0 -11
  151. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/yarn +0 -11
  152. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/application.rb +0 -11
  153. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/boot.rb +0 -5
  154. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/cable.yml +0 -8
  155. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/credentials.yml.enc +0 -1
  156. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/environment.rb +0 -7
  157. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/puma.rb +0 -39
  158. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/routes.rb +0 -5
  159. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/spring.rb +0 -8
  160. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config.ru +0 -7
  161. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/db/schema.rb +0 -1
  162. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability.rb +0 -20
  163. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability_mapping.rb +0 -10
  164. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/log/.keep +0 -0
  165. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/public/favicon.ico +0 -0
  166. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/code/rubocop_spec.rb +0 -3
  167. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/fixtures/.keep +0 -1
  168. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/spec_helper.rb +0 -8
  169. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/tmp/.keep +0 -0
  170. /data/sub/{avm-eac_rails_base0 → avm-git}/.gitignore +0 -0
  171. /data/sub/{avm-eac_rails_base0 → avm-git}/.rspec +0 -0
  172. /data/sub/{avm-eac_rails_base0 → avm-git}/Gemfile +0 -0
  173. /data/sub/{avm-eac_rails_base0 → avm-git}/spec/meta/rubocop_spec.rb +0 -0
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Scms
6
+ class GitSubBase < ::Avm::Scms::Base
7
+ class Commit < ::Avm::Scms::Commit
8
+ common_constructor :scm, :parent_commit
9
+
10
+ delegate :deploy_to_env_path, :fixup?, :id, :merge_with, :reword, :scm_file?, :subject,
11
+ :to_s, to: :parent_commit
12
+
13
+ # @return [Array<Pathname>]
14
+ def changed_files
15
+ parent_commit.changed_files.map do |cf|
16
+ cf.relative_path_from(scm.relative_path_from_parent_scm)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Scms
6
+ class GitSubBase < ::Avm::Scms::Base
7
+ class Interval < ::Avm::Scms::Interval
8
+ # @return [Array<Avm::Git::Scms::GitSubBase::Commit>]
9
+ def commits
10
+ parent_interval.commits.map do |parent_commit|
11
+ Avm::Git::Scms::GitSubBase::Commit.new(scm, parent_commit)
12
+ end
13
+ end
14
+
15
+ # @return [Avm::Git::Scms::Git::Interval]
16
+ def parent_interval
17
+ scm.parent_scm.interval(from, to)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Scms
6
+ class GitSubBase < ::Avm::Scms::Base
7
+ enable_abstract_methods
8
+
9
+ delegate :commit_if_change, :current_milestone_base_commit, :git_repo,
10
+ :head_commit, :reset_and_commit, :run_commit, to: :parent_scm
11
+
12
+ # @return [Enumerable<Avm::Git::Scms::GitSubBase::ChangedFile>]
13
+ def changed_files
14
+ parent_scm.changed_files.map do |parent_changed_file|
15
+ ::Avm::Git::Scms::GitSubBase::ChangedFile.new(self, parent_changed_file)
16
+ end
17
+ end
18
+
19
+ # @param from [Avm::Git::Scms::Git::Commit]
20
+ # @param to [Avm::Git::Scms::Git::Commit]
21
+ # @return [Avm::Git::Scms::GitSubBase::Interval]
22
+ def interval(from, to)
23
+ ::Avm::Git::Scms::GitSubBase::Interval.new(self, from, to)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Scms
6
+ class GitSubrepo < ::Avm::Git::Scms::GitSubBase
7
+ def update
8
+ git_subrepo.command('clean').execute!
9
+ git_subrepo.command('pull').execute!
10
+ end
11
+
12
+ # @return [EacGit::Local::Subrepo]
13
+ def git_subrepo
14
+ @git_subrepo ||= git_repo.subrepo(subpath)
15
+ end
16
+
17
+ # @return [Pathname]
18
+ def subpath
19
+ path.expand_path.relative_path_from(git_repo.root_path.expand_path)
20
+ end
21
+
22
+ def valid?
23
+ path.join('.gitrepo').file?
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Scms
6
+ class GitSubtree < ::Avm::Git::Scms::GitSubBase
7
+ # @return [Boolean]
8
+ def no_other_git_scm?
9
+ (::Avm::Git::Scms::Provider.new.all - [self.class])
10
+ .lazy.map { |scm_class| scm_class.new(path) }.none?(&:valid?)
11
+ end
12
+
13
+ # @return [Boolean]
14
+ def parent_git_scm?
15
+ ::Avm::Git::Scms::Provider.new.all.any? { |scm_class| parent_scm.is_a?(scm_class) }
16
+ end
17
+
18
+ def update
19
+ # Do nothing
20
+ end
21
+
22
+ # @return [Boolean]
23
+ def valid?
24
+ parent_git_scm? && no_other_git_scm?
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Scms
6
+ class Provider
7
+ SCMS = [::Avm::Git::Scms::Git, ::Avm::Git::Scms::GitSubrepo,
8
+ ::Avm::Git::Scms::GitSubtree].freeze
9
+
10
+ def all
11
+ SCMS
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Subrepo
6
+ class Check
7
+ module Parent
8
+ def fix_parent
9
+ return if parent_result.success?
10
+
11
+ info(' Fixing...')
12
+ self.parent_hash = expected_parent_hash
13
+ info_banner
14
+ end
15
+
16
+ private
17
+
18
+ def expected_parent_hash_uncached
19
+ subrepo.local.rev_parse("#{last_file_change_rev}^")
20
+ end
21
+
22
+ def last_file_change_rev
23
+ subrepo.local.command('log', '-n', '1', '--pretty=format:%H', '--',
24
+ subrepo.config_relative_path.to_path).execute!.strip
25
+ end
26
+
27
+ def parent_hash
28
+ subrepo.parent_commit_id
29
+ end
30
+
31
+ def parent_hash=(new_hash)
32
+ subrepo.config.parent_commit_id = new_hash
33
+ subrepo.write_config
34
+ end
35
+
36
+ def parent_hash_ok?
37
+ return false if expected_parent_hash.blank? || parent_hash.blank?
38
+
39
+ expected_parent_hash == parent_hash
40
+ end
41
+
42
+ def parent_result_uncached
43
+ ::Avm::Result.success_or_error(parent_hash_ok?,
44
+ parent_hash.presence || blank_text)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Subrepo
6
+ class Check
7
+ module Remote
8
+ private
9
+
10
+ def fetch_uncached
11
+ subrepo.command('clean').execute!
12
+ subrepo.command('fetch').execute!
13
+ end
14
+
15
+ def check_remote_disabled?
16
+ !check_remote?
17
+ end
18
+
19
+ def check_remote_disabled_result
20
+ ::Avm::Result.neutral('Check remote disabled')
21
+ end
22
+
23
+ def local_descend_remote?
24
+ local_id.present? && remote_id.present? && subrepo.local.descendant?(local_id,
25
+ remote_id)
26
+ end
27
+
28
+ def local_descend_remote_result
29
+ ::Avm::Result.pending(remote_result_value)
30
+ end
31
+
32
+ def local_id_uncached
33
+ fetch
34
+ subrepo.command('branch', '--force').execute!
35
+ subrepo.local.rev_parse("subrepo/#{subrepo.subpath}")
36
+ end
37
+
38
+ def remote_descend_local?
39
+ local_id.present? && remote_id.present? && subrepo.local.descendant?(remote_id,
40
+ local_id)
41
+ end
42
+
43
+ def remote_descend_local_result
44
+ ::Avm::Result.outdated(remote_result_value)
45
+ end
46
+
47
+ def remote_branches
48
+ ['', 'refs/heads/', 'refs/tags/'].map { |prefix| "#{prefix}#{subrepo.remote_branch}" }
49
+ end
50
+
51
+ # @return [String, nil]
52
+ def remote_id_uncached
53
+ subrepo.remote.ls.then do |ls_result|
54
+ remote_branches.lazy.map { |b| ls_result[b] }.find(&:present?) ||
55
+ subrepo.remote_branch
56
+ end
57
+ end
58
+
59
+ def remote_result_uncached
60
+ %w[check_remote_disabled same_ids local_descend_remote remote_descend_local]
61
+ .each do |condition|
62
+ return send("#{condition}_result") if send("#{condition}?")
63
+ end
64
+
65
+ ::Avm::Result.error(remote_result_value)
66
+ end
67
+
68
+ def remote_result_value
69
+ local_s = local_id.presence || blank_text
70
+ remote_s = remote_id.presence || blank_text
71
+
72
+ if local_s == remote_s
73
+ "[L/R=#{local_s}]"
74
+ else
75
+ "[L=#{local_s}, R=#{remote_s}]"
76
+ end
77
+ end
78
+
79
+ def same_ids?
80
+ local_id.present? && remote_id.present? && local_id == remote_id
81
+ end
82
+
83
+ def same_ids_result
84
+ ::Avm::Result.success(remote_result_value)
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Subrepo
6
+ class Check
7
+ module ShowResult
8
+ def show_result
9
+ out(subrepo.subpath.to_path.cyan)
10
+ out_attr('parent', parent_result.label)
11
+ run_fix_parent
12
+ out_attr('remote', remote_result.label)
13
+ out("\n")
14
+ end
15
+
16
+ def run_fix_parent
17
+ return unless fix_parent?
18
+ return unless parent_result.error?
19
+
20
+ out('|Fixing...'.white)
21
+ self.parent_hash = expected_parent_hash
22
+ out_attr('new parent', parent_result.label)
23
+ end
24
+
25
+ def out_attr(key, value)
26
+ out("|#{"#{key}=".white}#{value}")
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Subrepo
6
+ class Check
7
+ require_sub __FILE__, include_modules: true
8
+ enable_speaker
9
+ enable_simple_cache
10
+
11
+ BLANK_TEXT = 'BLANK'
12
+
13
+ common_constructor :subrepo, :options
14
+
15
+ def blank_text
16
+ BLANK_TEXT
17
+ end
18
+
19
+ def check_remote?
20
+ options.fetch(:check_remote) ? true : false
21
+ end
22
+
23
+ def fix_parent?
24
+ options.fetch(:fix_parent) ? true : false
25
+ end
26
+
27
+ private
28
+
29
+ def result_uncached
30
+ return ::Avm::Result.error('Parent failed') if parent_result.error?
31
+ return ::Avm::Result.error('Remote failed') if remote_result.error?
32
+
33
+ ::Avm::Result.success('Parent and remote ok')
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Subrepo
6
+ class Checks
7
+ enable_speaker
8
+ enable_simple_cache
9
+ attr_accessor :check_remote, :fix_parent
10
+
11
+ common_constructor :repository
12
+
13
+ def add_all_subrepos
14
+ add_subrepos(
15
+ *repository.command('subrepo', '-q', 'status').execute!.split("\n").map(&:strip)
16
+ .select(&:present?) # rubocop:disable Rails/CompactBlank
17
+ )
18
+ end
19
+
20
+ def add_subrepos(*subpath_list)
21
+ subpath_list.each do |subpath|
22
+ subpaths.add(subpath)
23
+ end
24
+ reset_cache
25
+ self
26
+ end
27
+
28
+ def check_options
29
+ { fix_parent: fix_parent, check_remote: check_remote }
30
+ end
31
+
32
+ def show_result
33
+ checks.each(&:show_result)
34
+ infov 'Result', result.label
35
+ end
36
+
37
+ private
38
+
39
+ def checks_uncached
40
+ subpaths.map do |subpath|
41
+ ::Avm::Git::Subrepo::Check.new(repository.subrepo(subpath), check_options)
42
+ end
43
+ end
44
+
45
+ def result_uncached
46
+ error_count = checks.count { |check| check.result.error? }
47
+ ::Avm::Result.success_or_error(
48
+ error_count.zero?,
49
+ "#{error_count} of #{checks.count} subrepos failed"
50
+ )
51
+ end
52
+
53
+ def subpaths
54
+ @subpaths ||= ::Set.new
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Git
5
+ module Vendor
6
+ module Github
7
+ class << self
8
+ def to_ssh_url(url)
9
+ return nil if url.blank?
10
+
11
+ url_no_dot_git = url.gsub(/\.git\z/, '')
12
+
13
+ m = %r{\Ahttps://github.com/([^/]+)/([^/]+)\z}.match(url_no_dot_git.to_s)
14
+ m ? "git@github.com:#{m[1]}/#{m[2]}.git" : url
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- module EacRailsBase0
5
- VERSION = '0.11.3'
4
+ module Git
5
+ VERSION = '0.24.0'
6
6
  end
7
7
  end
@@ -3,9 +3,13 @@
3
3
  require 'eac_ruby_utils'
4
4
  EacRubyUtils::RootModuleSetup.perform __FILE__
5
5
 
6
+ require 'avm'
7
+ require 'eac_cli'
8
+ require 'eac_config'
9
+ require 'eac_git'
10
+ require 'git'
11
+
6
12
  module Avm
7
- module EacRailsBase0
13
+ module Git
8
14
  end
9
15
  end
10
-
11
- require 'avm/eac_rails_base1'
@@ -0,0 +1,6 @@
1
+ en:
2
+ avm:
3
+ git:
4
+ scms:
5
+ git_subrepo:
6
+ update_version_scm_message: '**/.gitrepo: fix/update.'
@@ -0,0 +1,6 @@
1
+ pt-BR:
2
+ avm:
3
+ git:
4
+ scms:
5
+ git_subrepo:
6
+ update_version_scm_message: '**/.gitrepo: conserta/atualiza.'
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Avm::Git::Commit::DiffTreeLine, :git do
4
+ include_examples 'source_target_fixtures', __FILE__ do
5
+ def source_data(source_file)
6
+ File.read(source_file).each_line.map do |line|
7
+ described_class.new(line).fields
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1 @@
1
+ :000000 100644 0000000000000000000000000000000000000000 f380aec0bd8dd777edac43b11636e46cad04273a A nomes.txt
@@ -0,0 +1,7 @@
1
+ ---
2
+ - src_mode: '000000'
3
+ dst_mode: '100644'
4
+ src_sha1: '0000000000000000000000000000000000000000'
5
+ dst_sha1: f380aec0bd8dd777edac43b11636e46cad04273a
6
+ status: A
7
+ path: nomes.txt
@@ -0,0 +1 @@
1
+ :100644 100644 40bcdecb4214cd8a3fcf96cd25a2beb87e7e7cd8 4a30dfae816b984f05cfb594e0d5958bb8c387ae M nomes.txt
@@ -0,0 +1,7 @@
1
+ ---
2
+ - src_mode: '100644'
3
+ dst_mode: '100644'
4
+ src_sha1: 40bcdecb4214cd8a3fcf96cd25a2beb87e7e7cd8
5
+ dst_sha1: 4a30dfae816b984f05cfb594e0d5958bb8c387ae
6
+ status: M
7
+ path: nomes.txt
@@ -0,0 +1 @@
1
+ :100644 000000 10728718a2915256ab162f1e05178ebff9efa6ce 0000000000000000000000000000000000000000 D nomes3.txt
@@ -0,0 +1,7 @@
1
+ ---
2
+ - src_mode: '100644'
3
+ dst_mode: '000000'
4
+ src_sha1: 10728718a2915256ab162f1e05178ebff9efa6ce
5
+ dst_sha1: '0000000000000000000000000000000000000000'
6
+ status: D
7
+ path: nomes3.txt
@@ -0,0 +1,2 @@
1
+ :100644 000000 4a30dfae816b984f05cfb594e0d5958bb8c387ae 0000000000000000000000000000000000000000 D nomes.txt
2
+ :000000 100644 0000000000000000000000000000000000000000 4a30dfae816b984f05cfb594e0d5958bb8c387ae A nomes2.txt
@@ -0,0 +1,13 @@
1
+ ---
2
+ - src_mode: '100644'
3
+ dst_mode: '000000'
4
+ src_sha1: 4a30dfae816b984f05cfb594e0d5958bb8c387ae
5
+ dst_sha1: '0000000000000000000000000000000000000000'
6
+ status: D
7
+ path: nomes.txt
8
+ - src_mode: '000000'
9
+ dst_mode: '100644'
10
+ src_sha1: '0000000000000000000000000000000000000000'
11
+ dst_sha1: 4a30dfae816b984f05cfb594e0d5958bb8c387ae
12
+ status: A
13
+ path: nomes2.txt
@@ -0,0 +1,2 @@
1
+ :100644 000000 4a30dfae816b984f05cfb594e0d5958bb8c387ae 0000000000000000000000000000000000000000 D nomes2.txt
2
+ :000000 100644 0000000000000000000000000000000000000000 10728718a2915256ab162f1e05178ebff9efa6ce A nomes3.txt
@@ -0,0 +1,13 @@
1
+ ---
2
+ - src_mode: '100644'
3
+ dst_mode: '000000'
4
+ src_sha1: 4a30dfae816b984f05cfb594e0d5958bb8c387ae
5
+ dst_sha1: '0000000000000000000000000000000000000000'
6
+ status: D
7
+ path: nomes2.txt
8
+ - src_mode: '000000'
9
+ dst_mode: '100644'
10
+ src_sha1: '0000000000000000000000000000000000000000'
11
+ dst_sha1: 10728718a2915256ab162f1e05178ebff9efa6ce
12
+ status: A
13
+ path: nomes3.txt
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Avm::Git::Commit, :git do
4
+ let(:git) { stubbed_git_local_repo }
5
+
6
+ let(:first_commit_sha1) do
7
+ git.file('a.txt').write('AAA')
8
+ git.file('b.txt').write('BBB')
9
+ git.command('add', '.').execute!
10
+ git.command('commit', '-m', 'First commit.').execute!
11
+ git.rev_parse('HEAD')
12
+ end
13
+
14
+ let(:second_commit_sha1) do
15
+ first_commit_sha1
16
+ git.file('a.txt').write('AAAAA')
17
+ git.file('b.txt').delete
18
+ git.file('ç.txt').write('CCC')
19
+ git.command('add', '.').execute!
20
+ git.command('commit', '-m', 'Second commit.').execute!
21
+ git.rev_parse('HEAD')
22
+ end
23
+
24
+ let(:first_commit) { described_class.new(git, first_commit_sha1) }
25
+ let(:second_commit) { described_class.new(git, second_commit_sha1) }
26
+
27
+ describe '#files' do
28
+ it { expect(first_commit.files.count).to eq(2) }
29
+ it { expect(second_commit.files.count).to eq(3) }
30
+
31
+ {
32
+ 'first_commit' => %w[a.txt b.txt],
33
+ 'second_commit' => %w[a.txt b.txt ç.txt]
34
+ }.each do |commit_name, filenames|
35
+ filenames.each do |filename|
36
+ it "find file \"#{filename}\" in commit \"#{commit_name}\"" do
37
+ commit = send(commit_name)
38
+ file = commit.files.find { |f| f.path == filename }
39
+ expect(file).to be_a(Avm::Git::Commit::File)
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ describe '#files_size' do
46
+ it { expect(first_commit.files_size).to eq(6) }
47
+ it { expect(second_commit.files_size).to eq(8) }
48
+ end
49
+
50
+ describe '#root_child?' do
51
+ it { expect(first_commit.root_child?).to be(true) }
52
+ it { expect(second_commit.root_child?).to be(false) }
53
+ end
54
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Avm::Git::Launcher::Base do
4
+ context 'new non-bare repository' do # rubocop:disable RSpec/ContextWording
5
+ let(:repo) do
6
+ r = described_class.new(Dir.mktmpdir)
7
+ r.git
8
+ r
9
+ end
10
+
11
+ describe '#remote_exist?' do
12
+ it { expect(repo.remote_exist?('origin')).to be(false) }
13
+
14
+ context 'after remote added' do # rubocop:disable RSpec/ContextWording
15
+ before { repo.execute!('remote', 'add', 'origin', 'file:///path/to/remote') }
16
+
17
+ it { expect(repo.remote_exist?('origin')).to be(true) }
18
+
19
+ context 'after remote removed' do # rubocop:disable RSpec/ContextWording
20
+ before { repo.execute!('remote', 'remove', 'origin') }
21
+
22
+ it { expect(repo.remote_exist?('origin')).to be(false) }
23
+ end
24
+ end
25
+ end
26
+
27
+ describe '#assert_remote_url' do
28
+ it { expect(repo.remote_exist?('origin')).to be(false) }
29
+
30
+ context 'after asserted remote URL "/remote1"' do # rubocop:disable RSpec/ContextWording
31
+ before { repo.assert_remote_url('origin', '/remote1') }
32
+
33
+ it { expect(repo.git.remote('origin').url).to eq('/remote1') }
34
+
35
+ context 'after asserted remote URL "/remote2"' do # rubocop:disable RSpec/ContextWording
36
+ before { repo.assert_remote_url('origin', '/remote2') }
37
+
38
+ it { expect(repo.git.remote('origin').url).to eq('/remote2') }
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end