avm-tools 0.108.0 → 0.109.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/tools/runner/app_src/info.rb +12 -2
  3. data/lib/avm/tools/runner/app_src/update.rb +2 -2
  4. data/lib/avm/tools/runner/app_src.rb +4 -0
  5. data/lib/avm/tools/runner/self/registry.rb +25 -0
  6. data/lib/avm/tools/version.rb +1 -1
  7. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -1
  8. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -100
  9. data/vendor/avm/avm.gemspec +1 -1
  10. data/vendor/avm/lib/avm/registry/base.rb +65 -0
  11. data/vendor/avm/lib/avm/registry.rb +29 -0
  12. data/vendor/avm/lib/avm/rspec/setup.rb +22 -0
  13. data/vendor/avm/lib/avm/rspec/shared_examples/in_avm_registry.rb +11 -0
  14. data/vendor/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +14 -0
  15. data/vendor/avm/lib/avm/rspec.rb +9 -0
  16. data/vendor/avm/lib/avm/scms/base.rb +28 -0
  17. data/vendor/avm/lib/avm/scms/commit.rb +43 -0
  18. data/vendor/avm/lib/avm/source_stereotypes/base.rb +21 -0
  19. data/vendor/avm/lib/avm/sources/base.rb +22 -0
  20. data/vendor/avm/lib/avm/version.rb +1 -1
  21. data/vendor/avm/spec/lib/avm/scms/base_spec.rb +7 -0
  22. data/vendor/avm/spec/lib/avm/source_stereotypes/base_spec.rb +7 -0
  23. data/vendor/avm-eac_ruby_base1/Gemfile +5 -0
  24. data/vendor/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +19 -0
  25. data/vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches/i18n.rb +7 -0
  26. data/{lib/avm/patches/class.rb → vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches.rb} +0 -0
  27. data/vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_stereotypes/base.rb +25 -0
  28. data/vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_stereotypes/update/sub_update.rb +56 -0
  29. data/vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_stereotypes/update.rb +53 -0
  30. data/vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_stereotypes.rb +11 -0
  31. data/vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +7 -0
  32. data/vendor/avm-eac_ruby_base1/lib/avm/eac_ruby_base1.rb +9 -0
  33. data/vendor/avm-eac_ruby_base1/locale/en.yaml +8 -0
  34. data/vendor/avm-eac_ruby_base1/locale/pt-BR.yaml +8 -0
  35. data/vendor/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_stereotypes/base_spec.rb +7 -0
  36. data/vendor/avm-eac_ruby_base1/spec/rubocop_spec.rb +3 -0
  37. data/vendor/avm-eac_ruby_base1/spec/spec_helper.rb +4 -0
  38. data/vendor/avm-files/Gemfile +5 -0
  39. data/vendor/avm-files/avm-files.gemspec +21 -0
  40. data/vendor/{avm → avm-files}/lib/avm/files/appendable/file_content.rb +0 -0
  41. data/vendor/{avm → avm-files}/lib/avm/files/appendable/plain_directory.rb +0 -0
  42. data/vendor/{avm → avm-files}/lib/avm/files/appendable/resource_base.rb +0 -0
  43. data/vendor/{avm → avm-files}/lib/avm/files/appendable/tar_output_command.rb +0 -0
  44. data/vendor/{avm → avm-files}/lib/avm/files/appendable/templatized_directory.rb +0 -0
  45. data/vendor/{avm → avm-files}/lib/avm/files/appendable.rb +0 -0
  46. data/vendor/{avm → avm-files}/lib/avm/files/appender.rb +0 -0
  47. data/vendor/{avm → avm-files}/lib/avm/files/deploy.rb +0 -0
  48. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/base.rb +0 -0
  49. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/generic_plain.rb +0 -0
  50. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/html.rb +0 -0
  51. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/javascript.rb +0 -0
  52. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/json.rb +0 -0
  53. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/php.rb +0 -0
  54. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/python.rb +0 -0
  55. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/ruby.rb +0 -0
  56. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats/xml.rb +0 -0
  57. data/vendor/{avm → avm-files}/lib/avm/files/formatter/formats.rb +0 -0
  58. data/vendor/{avm → avm-files}/lib/avm/files/formatter/utf8_assert.rb +0 -0
  59. data/vendor/{avm → avm-files}/lib/avm/files/formatter.rb +0 -0
  60. data/vendor/{avm → avm-files}/lib/avm/files/rotate.rb +0 -0
  61. data/vendor/avm-files/lib/avm/files/version.rb +7 -0
  62. data/vendor/avm-files/lib/avm/files.rb +9 -0
  63. data/vendor/avm-files/spec/rubocop_spec.rb +3 -0
  64. data/vendor/avm-files/spec/spec_helper.rb +4 -0
  65. data/vendor/avm-git/Gemfile +5 -0
  66. data/vendor/avm-git/avm-git.gemspec +21 -0
  67. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/commit_info.rb +0 -0
  68. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/rules/base.rb +0 -0
  69. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/rules/last.rb +0 -0
  70. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/rules/manual.rb +0 -0
  71. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/rules/new.rb +0 -0
  72. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/rules/nth.rb +0 -0
  73. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/rules/unique.rb +0 -0
  74. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit/rules.rb +0 -0
  75. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit_path/ruby.rb +0 -0
  76. data/vendor/{avm → avm-git}/lib/avm/git/auto_commit_path.rb +0 -0
  77. data/vendor/{avm → avm-git}/lib/avm/git/commit/class_methods.rb +0 -0
  78. data/vendor/{avm → avm-git}/lib/avm/git/commit/deploy.rb +0 -0
  79. data/vendor/{avm → avm-git}/lib/avm/git/commit/deploy_methods.rb +0 -0
  80. data/vendor/{avm → avm-git}/lib/avm/git/commit/diff_tree_line.rb +0 -0
  81. data/vendor/{avm → avm-git}/lib/avm/git/commit/file.rb +0 -0
  82. data/vendor/{avm → avm-git}/lib/avm/git/commit.rb +0 -0
  83. data/vendor/{avm → avm-git}/lib/avm/git/file_auto_fixup.rb +0 -0
  84. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/commits.rb +0 -0
  85. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/git_subrepos.rb +0 -0
  86. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/local_branch.rb +0 -0
  87. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/local_tag.rb +0 -0
  88. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/push.rb +0 -0
  89. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/remote.rb +0 -0
  90. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/test.rb +0 -0
  91. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/tracker.rb +0 -0
  92. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/validation.rb +0 -0
  93. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/validations.rb +0 -0
  94. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete/working_tree.rb +0 -0
  95. data/vendor/{avm → avm-git}/lib/avm/git/issue/complete.rb +0 -0
  96. data/vendor/{avm → avm-git}/lib/avm/git/issue/deliver.rb +0 -0
  97. data/vendor/{avm → avm-git}/lib/avm/git/issue.rb +0 -0
  98. data/vendor/{avm → avm-git}/lib/avm/git/organize/reference_update.rb +0 -0
  99. data/vendor/{avm → avm-git}/lib/avm/git/organize/repository.rb +0 -0
  100. data/vendor/{avm → avm-git}/lib/avm/git/organize.rb +0 -0
  101. data/vendor/{avm → avm-git}/lib/avm/git/revision_test.rb +0 -0
  102. data/vendor/avm-git/lib/avm/git/scms/git/change_tracker.rb +35 -0
  103. data/vendor/avm-git/lib/avm/git/scms/git/commit.rb +55 -0
  104. data/vendor/avm-git/lib/avm/git/scms/git.rb +65 -0
  105. data/vendor/avm-git/lib/avm/git/scms/git_subrepo.rb +41 -0
  106. data/vendor/avm-git/lib/avm/git/scms/provider.rb +19 -0
  107. data/vendor/avm-git/lib/avm/git/scms.rb +11 -0
  108. data/vendor/{avm → avm-git}/lib/avm/git/subrepo_check/parent.rb +0 -0
  109. data/vendor/{avm → avm-git}/lib/avm/git/subrepo_check/remote.rb +0 -0
  110. data/vendor/{avm → avm-git}/lib/avm/git/subrepo_check/show_result.rb +0 -0
  111. data/vendor/{avm → avm-git}/lib/avm/git/subrepo_check.rb +0 -0
  112. data/vendor/{avm → avm-git}/lib/avm/git/subrepo_checks.rb +0 -0
  113. data/vendor/avm-git/lib/avm/git/version.rb +7 -0
  114. data/vendor/{avm → avm-git}/lib/avm/git.rb +3 -2
  115. data/vendor/{avm → avm-git}/spec/lib/avm/git/auto_commit_path_spec.rb +0 -0
  116. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/deploy_spec.rb +0 -0
  117. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec.rb +0 -0
  118. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out +0 -0
  119. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml +0 -0
  120. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.source.out +0 -0
  121. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.target.yaml +0 -0
  122. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.source.out +0 -0
  123. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.target.yaml +0 -0
  124. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.source.out +0 -0
  125. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.target.yaml +0 -0
  126. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.source.out +0 -0
  127. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.target.yaml +0 -0
  128. data/vendor/{avm → avm-git}/spec/lib/avm/git/commit_spec.rb +0 -0
  129. data/vendor/avm-git/spec/lib/avm/git/scms/git_spec.rb +8 -0
  130. data/vendor/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +8 -0
  131. data/vendor/avm-git/spec/rubocop_spec.rb +3 -0
  132. data/vendor/avm-git/spec/spec_helper.rb +4 -0
  133. data/vendor/eac_git/lib/eac_git/local/commit.rb +21 -2
  134. data/vendor/eac_git/lib/eac_git/local/log.rb +17 -0
  135. data/vendor/eac_git/lib/eac_git/local.rb +26 -0
  136. data/vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb +11 -0
  137. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  138. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +7 -0
  139. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/abstract.rb +9 -0
  140. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/self_included_modules.rb +7 -0
  141. data/{lib/avm/patches/class/i18n.rb → vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/i18n_translate.rb} +8 -7
  142. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/call_if_proc.rb +11 -0
  143. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/i18n_translate.rb +13 -0
  144. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +10 -10
  145. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  146. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/abstract_spec.rb +25 -0
  147. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/self_included_modules_spec.rb +30 -0
  148. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/call_if_proc_spec.rb +11 -0
  149. metadata +133 -86
  150. data/lib/avm/patches/i18n.rb +0 -22
  151. data/lib/avm/patches/object/i18n.rb +0 -9
  152. data/lib/avm/projects/stereotypes/git/update/subrepo.rb +0 -85
  153. data/lib/avm/projects/stereotypes/git/update.rb +0 -41
  154. data/lib/avm/projects/stereotypes/ruby_gem/update.rb +0 -66
  155. data/vendor/avm/lib/avm/files.rb +0 -9
@@ -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
@@ -0,0 +1,8 @@
1
+ en:
2
+ avm:
3
+ eac_ruby_base1:
4
+ source_stereotypes:
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.'
@@ -0,0 +1,8 @@
1
+ pt-BR:
2
+ avm:
3
+ eac_ruby_base1:
4
+ source_stereotypes:
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.'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ruby_base1/source_stereotypes/base'
4
+
5
+ ::RSpec.describe ::Avm::EacRubyBase1::SourceStereotypes::Base do
6
+ include_examples 'in_avm_registry', 'source_stereotypes'
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/files/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-files'
9
+ s.version = Avm::Files::VERSION
10
+ s.authors = ['Put here the authors']
11
+ s.summary = 'Put here de description.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+
15
+ s.add_dependency 'avm', '~> 0.6'
16
+ s.add_dependency 'eac_fs', '~> 0.5'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.76'
18
+ s.add_dependency 'eac_templates', '~> 0.2'
19
+
20
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
21
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module Files
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 Files
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/git/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-git'
9
+ s.version = Avm::Git::VERSION
10
+ s.authors = ['Put here the authors']
11
+ s.summary = 'Put here de description.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+
15
+ s.add_dependency 'avm-files', '~> 0.1'
16
+ s.add_dependency 'eac_git', '~> 0.9'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.76'
18
+
19
+ s.add_development_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
20
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
21
+ end
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ module Scms
8
+ class Git < ::Avm::Scms::Base
9
+ class ChangeTracker
10
+ common_constructor :git_scm, :message
11
+ attr_reader :starting_commit
12
+ delegate :git_repo, to: :git_scm
13
+
14
+ def start
15
+ raise 'Repository is dirty' if git_repo.dirty?
16
+
17
+ self.starting_commit = git_repo.head
18
+ end
19
+
20
+ # @return [Avm::Git::Scms::Git::Commit, nil]
21
+ def stop
22
+ git_scm.commit_dirty
23
+ return nil if starting_commit == git_repo.head
24
+
25
+ git_scm.reset_and_commit(starting_commit, message)
26
+ end
27
+
28
+ private
29
+
30
+ attr_writer :starting_commit
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/commit'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Scms
9
+ class Git < ::Avm::Scms::Base
10
+ class Commit < ::Avm::Scms::Commit
11
+ common_constructor :git_scm, :git_commit do
12
+ git_commit.assert_argument(::EacGit::Local::Commit, 'git_commit')
13
+ end
14
+ delegate :git_repo, to: :git_scm
15
+
16
+ # @return [Array<Pathname>]
17
+ def changed_files
18
+ git_commit.changed_files.map { |cf| cf.path.to_pathname }
19
+ end
20
+
21
+ # @param other [Avm::Git::Scms::Git::Commit]
22
+ # @return [Avm::Git::Scms::Git::Commit]
23
+ def merge_with(other)
24
+ validate_clean_and_head
25
+ raise 'Implemented for only if other is parent' unless
26
+ other.git_commit == git_commit.parent
27
+
28
+ git_scm.reset_and_commit(other.git_commit.parent, other.git_commit.raw_body)
29
+ end
30
+
31
+ def reword(new_message)
32
+ validate_clean_and_head
33
+
34
+ git_repo.command('commit', '--amend', '-m', new_message).execute!
35
+ self.class.new(git_scm, git_repo.head)
36
+ end
37
+
38
+ # @param path [Pathname]
39
+ # @return [TrueClass,FalseClass]
40
+ def scm_file?(path)
41
+ %w[.gitrepo .gitmodules].any? { |file| file.include?(path.basename.to_path) }
42
+ end
43
+
44
+ private
45
+
46
+ def validate_clean_and_head
47
+ raise 'Implemented for only if repository is no dirty' if git_repo.dirty?
48
+ raise 'Implemented for only if self is HEAD' unless
49
+ git_commit == git_repo.head
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Scms
9
+ class Git < ::Avm::Scms::Base
10
+ require_sub __FILE__
11
+ include ::Comparable
12
+
13
+ COMMIT_DIRTY_DEFAULT_MESSAGE = 'Dirty files.'
14
+
15
+ def <=>(other)
16
+ git_repo <=> other.git_repo
17
+ end
18
+
19
+ # @return [Avm::Git::Scms::Git::Commit,nil]
20
+ def commitize(source)
21
+ if source.is_a?(::Avm::Git::Scms::Git::Commit)
22
+ return source if source.git_repo == self
23
+
24
+ raise 'Not same Git repository'
25
+ end
26
+ git_repo.commitize(source).if_present do |v|
27
+ ::Avm::Git::Scms::Git::Commit.new(self, v)
28
+ end
29
+ end
30
+
31
+ # @return [Avm::Git::Scms::Git::Commit,nil]
32
+ def commit_dirty(message = nil)
33
+ return nil unless git_repo.dirty?
34
+
35
+ git_repo.command('add', '.').execute!
36
+ git_repo.command('commit', '-m',
37
+ message.call_if_proc.if_present(COMMIT_DIRTY_DEFAULT_MESSAGE)).execute!
38
+ commitize(git_repo.head)
39
+ end
40
+
41
+ # @return [Avm::Git::Scms::Git::Commit,nil]
42
+ def commit_if_change(message = nil)
43
+ tracker = ::Avm::Git::Scms::Git::ChangeTracker.new(self, message)
44
+ tracker.start
45
+ yield
46
+ tracker.stop
47
+ end
48
+
49
+ def git_repo
50
+ @git_repo ||= ::EacGit::Local.new(path)
51
+ end
52
+
53
+ # @return [Avm::Git::Scms::Git::Commit]
54
+ def reset_and_commit(commit_to_reset, message)
55
+ git_repo.command('reset', '--soft', commitize(commit_to_reset).git_commit.id).execute!
56
+ commit_dirty(message)
57
+ end
58
+
59
+ def valid?
60
+ path.join('.git').exist?
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/base'
4
+ require 'eac_git/local'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Git
9
+ module Scms
10
+ class GitSubrepo < ::Avm::Scms::Base
11
+ def commit_if_change(_message)
12
+ nyi
13
+ end
14
+
15
+ def update
16
+ git_subrepo.command('clean').execute!
17
+ git_subrepo.command('pull').execute!
18
+ end
19
+
20
+ # @return [EacGit::Local]
21
+ def git_repo
22
+ @git_repo ||= ::EacGit::Local.find(path)
23
+ end
24
+
25
+ # @return [EacGit::Local::Subrepo]
26
+ def git_subrepo
27
+ @git_subrepo ||= git_repo.subrepo(subpath)
28
+ end
29
+
30
+ # @return [Pathname]
31
+ def subpath
32
+ path.expand_path.relative_path_from(git_repo.root_path.expand_path)
33
+ end
34
+
35
+ def valid?
36
+ path.join('.gitrepo').file?
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/scms/git'
4
+ require 'avm/git/scms/git_subrepo'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Git
9
+ module Scms
10
+ class Provider
11
+ SCMS = [::Avm::Git::Scms::Git, ::Avm::Git::Scms::GitSubrepo].freeze
12
+
13
+ def all
14
+ SCMS
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ module Scms
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 Git
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
3
+ require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Git
7
+ require_sub __FILE__
8
+
8
9
  DEFAULT_REMOTE_NAME = 'origin'
9
10
  end
10
11
  end