eac_tools 0.34.0 → 0.35.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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +24 -18
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +1 -1
  5. data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_collector.rb +0 -0
  6. data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_discovery.rb +0 -0
  7. data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_manager/cached_instance.rb +0 -0
  8. data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_manager/cached_instances.rb +0 -0
  9. data/sub/{avm-tools → avm}/lib/avm/launcher/context/instance_manager.rb +0 -0
  10. data/sub/{avm-tools → avm}/lib/avm/launcher/context/settings.rb +0 -0
  11. data/sub/{avm-tools → avm}/lib/avm/launcher/context.rb +0 -0
  12. data/sub/{avm-tools → avm}/lib/avm/launcher/instances/base/cache.rb +0 -0
  13. data/sub/{avm-tools → avm}/lib/avm/launcher/instances/base.rb +0 -0
  14. data/sub/{avm-tools → avm}/lib/avm/launcher/instances/error.rb +0 -0
  15. data/sub/{avm-tools → avm}/lib/avm/launcher/instances/runner_helper.rb +0 -0
  16. data/sub/{avm-tools → avm}/lib/avm/launcher/instances/settings.rb +0 -0
  17. data/sub/{avm-tools → avm}/lib/avm/launcher/paths/logical.rb +0 -0
  18. data/sub/{avm-tools → avm}/lib/avm/launcher/publish/base.rb +2 -5
  19. data/sub/avm/lib/avm/registry.rb +0 -2
  20. data/sub/avm/lib/avm/version.rb +1 -1
  21. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +1 -1
  22. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/apache_host.rb +2 -1
  23. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  24. data/sub/avm-git/Gemfile +8 -0
  25. data/sub/avm-git/avm-git.gemspec +22 -0
  26. data/sub/avm-git/lib/avm/git/auto_commit/commit_info.rb +23 -0
  27. data/sub/avm-git/lib/avm/git/auto_commit/rules/base.rb +39 -0
  28. data/sub/avm-git/lib/avm/git/auto_commit/rules/last.rb +19 -0
  29. data/sub/avm-git/lib/avm/git/auto_commit/rules/manual.rb +45 -0
  30. data/sub/avm-git/lib/avm/git/auto_commit/rules/new.rb +24 -0
  31. data/sub/avm-git/lib/avm/git/auto_commit/rules/nth.rb +31 -0
  32. data/sub/avm-git/lib/avm/git/auto_commit/rules/unique.rb +21 -0
  33. data/sub/avm-git/lib/avm/git/auto_commit/rules.rb +31 -0
  34. data/sub/avm-git/lib/avm/git/auto_commit_path/ruby.rb +20 -0
  35. data/sub/avm-git/lib/avm/git/auto_commit_path.rb +28 -0
  36. data/sub/avm-git/lib/avm/git/commit/class_methods.rb +31 -0
  37. data/sub/avm-git/lib/avm/git/commit/deploy.rb +38 -0
  38. data/sub/avm-git/lib/avm/git/commit/deploy_methods.rb +19 -0
  39. data/sub/avm-git/lib/avm/git/commit/diff_tree_line.rb +32 -0
  40. data/sub/avm-git/lib/avm/git/commit/file.rb +46 -0
  41. data/sub/avm-git/lib/avm/git/commit.rb +59 -0
  42. data/sub/avm-git/lib/avm/git/file_auto_fixup.rb +83 -0
  43. data/sub/avm-git/lib/avm/git/issue/complete/commits.rb +42 -0
  44. data/sub/avm-git/lib/avm/git/issue/complete/git_subrepos.rb +23 -0
  45. data/sub/avm-git/lib/avm/git/issue/complete/local_branch.rb +61 -0
  46. data/sub/avm-git/lib/avm/git/issue/complete/local_tag.rb +39 -0
  47. data/sub/avm-git/lib/avm/git/issue/complete/push.rb +60 -0
  48. data/sub/avm-git/lib/avm/git/issue/complete/remote.rb +33 -0
  49. data/sub/avm-git/lib/avm/git/issue/complete/test.rb +40 -0
  50. data/sub/avm-git/lib/avm/git/issue/complete/tracker.rb +28 -0
  51. data/sub/avm-git/lib/avm/git/issue/complete/validation.rb +39 -0
  52. data/sub/avm-git/lib/avm/git/issue/complete/validations.rb +53 -0
  53. data/sub/avm-git/lib/avm/git/issue/complete/working_tree.rb +19 -0
  54. data/sub/avm-git/lib/avm/git/issue/complete.rb +66 -0
  55. data/sub/avm-git/lib/avm/git/issue/deliver.rb +56 -0
  56. data/sub/avm-git/lib/avm/git/issue.rb +11 -0
  57. data/sub/avm-git/lib/avm/git/organize/reference_update.rb +34 -0
  58. data/sub/avm-git/lib/avm/git/organize/repository.rb +76 -0
  59. data/sub/avm-git/lib/avm/git/organize.rb +11 -0
  60. data/sub/avm-git/lib/avm/git/revision_test.rb +105 -0
  61. data/sub/avm-git/lib/avm/git/scms/git/change_tracker.rb +35 -0
  62. data/sub/avm-git/lib/avm/git/scms/git/commit.rb +55 -0
  63. data/sub/avm-git/lib/avm/git/scms/git.rb +73 -0
  64. data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +39 -0
  65. data/sub/avm-git/lib/avm/git/scms/provider.rb +19 -0
  66. data/sub/avm-git/lib/avm/git/scms.rb +11 -0
  67. data/sub/avm-git/lib/avm/git/subrepo_check/parent.rb +51 -0
  68. data/sub/avm-git/lib/avm/git/subrepo_check/remote.rb +89 -0
  69. data/sub/avm-git/lib/avm/git/subrepo_check/show_result.rb +32 -0
  70. data/sub/avm-git/lib/avm/git/subrepo_check.rb +38 -0
  71. data/sub/avm-git/lib/avm/git/subrepo_checks.rb +59 -0
  72. data/sub/{avm-tools/lib/avm/launcher → avm-git/lib/avm/git}/vendor/github.rb +1 -1
  73. data/sub/avm-git/lib/avm/git/vendor.rb +11 -0
  74. data/sub/avm-git/lib/avm/git/version.rb +7 -0
  75. data/sub/avm-git/lib/avm/git.rb +11 -0
  76. data/sub/avm-git/spec/lib/avm/git/auto_commit_path_spec.rb +21 -0
  77. data/sub/avm-git/spec/lib/avm/git/commit/deploy_spec.rb +93 -0
  78. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb +13 -0
  79. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out +1 -0
  80. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
  81. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.source.out +1 -0
  82. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
  83. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.source.out +1 -0
  84. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
  85. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.source.out +2 -0
  86. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
  87. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
  88. data/sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
  89. data/sub/avm-git/spec/lib/avm/git/commit_spec.rb +56 -0
  90. data/sub/avm-git/spec/lib/avm/git/scms/git_spec.rb +8 -0
  91. data/sub/avm-git/spec/lib/avm/git/scms/git_subrepo_spec.rb +8 -0
  92. data/sub/{avm-tools/spec/lib/avm/launcher → avm-git/spec/lib/avm/git}/vendor/github_spec.rb +4 -4
  93. data/sub/avm-git/spec/rubocop_spec.rb +3 -0
  94. data/sub/avm-git/spec/spec_helper.rb +4 -0
  95. data/sub/avm-tools/avm-tools.gemspec +2 -2
  96. data/sub/avm-tools/lib/avm/launcher/git/warp_base.rb +2 -2
  97. data/sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo/warp.rb +2 -2
  98. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  99. data/sub/eac_docker/eac_docker.gemspec +2 -2
  100. data/sub/eac_docker/lib/eac_docker/images/templatized.rb +7 -1
  101. data/sub/eac_docker/lib/eac_docker/version.rb +1 -1
  102. metadata +97 -23
  103. data/sub/avm-tools/lib/avm/launcher/vendor.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a07350e5f6e203f916c6b9ef70f92f59eff8d4c3af4159a086385608d56119b
4
- data.tar.gz: 03f349d5cee7e0865d05c26fb7e8a2e394f070cc22199bd4b306a81131f955af
3
+ metadata.gz: 4e7be8c10a31eca92c292ca5a2aff340237809512a2477c04b9212b9a246264d
4
+ data.tar.gz: 7de8fb83e7fbc7583c0577e5de1a561952b17d1b2768951e6706f645933966bb
5
5
  SHA512:
6
- metadata.gz: c44c9eedc11252a33e9f23cc07a13bd732b2808fd9d63900fa6a7d3583f15758dc0b561533ceb2f271e628d135e05786398744efce321ac8022219c55458da76
7
- data.tar.gz: 83a02656f81b1248636ba07fbe6b96ebccbd74f3d4c2a09587e5b2f8561a03832a57ac75d79a6db6fed85edb67462c2b347fed11954258b43ad3b74d543c98ab
6
+ metadata.gz: 71a2a76a1b55a74f18f7aa18db4b25c269c8ffff5e397669ff0d8782fe21db1269e2b571dbf1d7b2b0fa70a696e2cccbdf0921d57a329ff62a15de115d8d1bd4
7
+ data.tar.gz: f5a62fb8592908556546226ff6232eef6b8be3a7d72f87080dd2b31a38cfdb60c724069439037942549b72b319672ebd1af1e06bfb378d526f0a2014c1499318
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.34.0)
5
- avm (~> 0.45)
4
+ eac_tools (0.35.0)
5
+ avm (~> 0.46)
6
6
  avm-eac_asciidoctor_base0 (~> 0.7, >= 0.7.1)
7
7
  avm-eac_generic_base0 (~> 0.5)
8
8
  avm-eac_latex_base0 (~> 0.2, >= 0.2.1)
@@ -11,9 +11,9 @@ PATH
11
11
  avm-eac_redmine_base0 (~> 0.16)
12
12
  avm-eac_redmine_plugin_base0 (~> 0.3)
13
13
  avm-eac_ruby_base1 (~> 0.22)
14
- avm-eac_webapp_base0 (~> 0.9)
14
+ avm-eac_webapp_base0 (~> 0.9, >= 0.9.1)
15
15
  avm-eac_wordpress_base0 (~> 0.2, >= 0.2.1)
16
- avm-tools (~> 0.138)
16
+ avm-tools (~> 0.139)
17
17
  eac_ruby_utils (~> 0.104)
18
18
 
19
19
  PATH
@@ -88,8 +88,8 @@ PATH
88
88
  PATH
89
89
  remote: sub/avm-eac_webapp_base0
90
90
  specs:
91
- avm-eac_webapp_base0 (0.9.0)
92
- avm (~> 0.45)
91
+ avm-eac_webapp_base0 (0.9.1)
92
+ avm (~> 0.46)
93
93
  avm-eac_generic_base0 (~> 0.5)
94
94
  avm-eac_postgresql_base0 (~> 0.2)
95
95
  avm-eac_ubuntu_base0 (~> 0.3)
@@ -113,16 +113,25 @@ PATH
113
113
  eac_ruby_utils (~> 0.103)
114
114
  eac_templates (~> 0.3, >= 0.3.2)
115
115
 
116
+ PATH
117
+ remote: sub/avm-git
118
+ specs:
119
+ avm-git (0.5.0)
120
+ avm (~> 0.46)
121
+ avm-files (~> 0.4, >= 0.4.1)
122
+ eac_git (~> 0.12, >= 0.12.3)
123
+ eac_ruby_utils (~> 0.104)
124
+
116
125
  PATH
117
126
  remote: sub/avm-tools
118
127
  specs:
119
- avm-tools (0.138.0)
128
+ avm-tools (0.139.0)
120
129
  aranha-parsers (~> 0.14, >= 0.14.3)
121
- avm (~> 0.45)
130
+ avm (~> 0.46)
122
131
  avm-eac_ruby_base1 (~> 0.22)
123
132
  avm-eac_ubuntu_base0 (~> 0.3)
124
133
  avm-files (~> 0.4, >= 0.4.1)
125
- avm-git (~> 0.4)
134
+ avm-git (~> 0.5)
126
135
  clipboard (~> 1.3, >= 1.3.6)
127
136
  curb (~> 0.9, >= 0.9.11)
128
137
  eac_git (~> 0.12, >= 0.12.3)
@@ -134,10 +143,10 @@ PATH
134
143
  PATH
135
144
  remote: sub/avm
136
145
  specs:
137
- avm (0.45.0)
146
+ avm (0.46.0)
138
147
  eac_cli (~> 0.28)
139
148
  eac_config (~> 0.11, >= 0.11.1)
140
- eac_docker (~> 0.4, >= 0.4.2)
149
+ eac_docker (~> 0.5)
141
150
  eac_git (~> 0.12, >= 0.12.3)
142
151
  eac_ruby_utils (~> 0.104)
143
152
  eac_templates (~> 0.3, >= 0.3.2)
@@ -163,9 +172,9 @@ PATH
163
172
  PATH
164
173
  remote: sub/eac_docker
165
174
  specs:
166
- eac_docker (0.4.2)
167
- eac_ruby_utils (~> 0.96)
168
- eac_templates (~> 0.3, >= 0.3.1)
175
+ eac_docker (0.5.0)
176
+ eac_ruby_utils (~> 0.104)
177
+ eac_templates (~> 0.3, >= 0.3.2)
169
178
 
170
179
  PATH
171
180
  remote: sub/eac_fs
@@ -230,10 +239,6 @@ GEM
230
239
  avm (~> 0.7)
231
240
  eac_ruby_utils (~> 0.77, >= 0.77.1)
232
241
  eac_templates (~> 0.3)
233
- avm-git (0.4.0)
234
- avm-files (~> 0.1)
235
- eac_git (~> 0.11)
236
- eac_ruby_utils (~> 0.76)
237
242
  clipboard (1.3.6)
238
243
  colorize (0.8.1)
239
244
  concurrent-ruby (1.1.10)
@@ -361,6 +366,7 @@ DEPENDENCIES
361
366
  avm-eac_webapp_base0!
362
367
  avm-eac_wordpress_base0!
363
368
  avm-files!
369
+ avm-git!
364
370
  avm-tools!
365
371
  eac_cli!
366
372
  eac_config!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.34.0'
4
+ VERSION = '0.35.0'
5
5
  end
data/sub/avm/avm.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'eac_cli', '~> 0.28'
16
16
  s.add_dependency 'eac_config', '~> 0.11', '>= 0.11.1'
17
- s.add_dependency 'eac_docker', '~> 0.4', '>= 0.4.2'
17
+ s.add_dependency 'eac_docker', '~> 0.5'
18
18
  s.add_dependency 'eac_git', '~> 0.12', '>= 0.12.3'
19
19
  s.add_dependency 'eac_ruby_utils', '~> 0.104'
20
20
  s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
File without changes
@@ -1,16 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/launcher/errors/base'
4
+ require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
7
  module Launcher
7
8
  module Publish
8
9
  class Base
9
- attr_reader :instance
10
-
11
- def initialize(instance)
12
- @instance = instance
13
- end
10
+ common_constructor :instance
14
11
 
15
12
  def run
16
13
  s = check
@@ -10,8 +10,6 @@ module Avm
10
10
  lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms,
11
11
  :source_generators, :sources
12
12
 
13
- WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze
14
-
15
13
  class << self
16
14
  enable_simple_cache
17
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.45.0'
4
+ VERSION = '0.46.0'
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.45'
15
+ s.add_dependency 'avm', '~> 0.46'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.5'
17
17
  s.add_dependency 'avm-eac_postgresql_base0', '~> 0.2'
18
18
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.3'
@@ -15,7 +15,8 @@ module Avm
15
15
  include ::Avm::Entries::Jobs::Base
16
16
 
17
17
  def directory_extra_config
18
- instance.entry(APACHE_DIRECTORY_EXTRA_CONFIG_KEY).value.if_present { |v| " #{v}\n" }
18
+ instance.entry(APACHE_DIRECTORY_EXTRA_CONFIG_KEY).optional_value
19
+ .if_present { |v| " #{v}\n" }
19
20
  end
20
21
 
21
22
  def no_ssl_site_content
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacWebappBase0
5
- VERSION = '0.9.0'
5
+ VERSION = '0.9.1'
6
6
  end
7
7
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -0,0 +1,22 @@
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', '~> 0.46'
16
+ s.add_dependency 'avm-files', '~> 0.4', '>= 0.4.1'
17
+ s.add_dependency 'eac_git', '~> 0.12', '>= 0.12.3'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.104'
19
+
20
+ s.add_development_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
21
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
22
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ module AutoCommit
8
+ class CommitInfo
9
+ enable_immutable
10
+
11
+ immutable_accessor :fixup, :message
12
+
13
+ def git_commit_args
14
+ r = fixup.if_present([]) { |v| ['--fixup', v.sha1] }
15
+ r += message.if_present([]) { |v| ['--message', v] }
16
+ return r if r.any?
17
+
18
+ raise 'Argument list is empty'
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ module AutoCommit
8
+ module Rules
9
+ class Base
10
+ class << self
11
+ def keys
12
+ [long_key, short_key]
13
+ end
14
+
15
+ def long_key
16
+ name.demodulize.variableize
17
+ end
18
+
19
+ def short_key
20
+ long_key[0, 1]
21
+ end
22
+ end
23
+
24
+ def with_file(file)
25
+ self.class.const_get('WithFile').new(self, file)
26
+ end
27
+
28
+ class WithFile
29
+ common_constructor :rule, :file
30
+
31
+ def new_commit_info
32
+ ::Avm::Git::AutoCommit::CommitInfo.new
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/auto_commit/rules/base'
4
+
5
+ module Avm
6
+ module Git
7
+ module AutoCommit
8
+ module Rules
9
+ class Last < ::Avm::Git::AutoCommit::Rules::Base
10
+ class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
11
+ def commit_info
12
+ file.commits.last.if_present { |v| new_commit_info.fixup(v) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/auto_commit/rules/base'
4
+
5
+ module Avm
6
+ module Git
7
+ module AutoCommit
8
+ module Rules
9
+ class Manual < ::Avm::Git::AutoCommit::Rules::Base
10
+ class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
11
+ enable_speaker
12
+
13
+ COMMIT_FORMAT = '%h - %s (%cr)'
14
+ SKIP_OPTION = 's'
15
+
16
+ def commit_info
17
+ return nil unless file.commits.any?
18
+
19
+ commits_banner
20
+ input('Which commit?', list: commits_by_position).if_present do |v|
21
+ new_commit_info.fixup(v)
22
+ end
23
+ end
24
+
25
+ def commits_banner
26
+ file.commits.each_with_index do |commit, _index|
27
+ infov " #{commit.position}", format_commit(commit)
28
+ end
29
+ infov " #{SKIP_OPTION}", 'skip'
30
+ end
31
+
32
+ def commits_by_position
33
+ (file.commits.map { |commit| [commit.position.to_s, commit] } + [[SKIP_OPTION, nil]])
34
+ .to_h
35
+ end
36
+
37
+ def format_commit(commit)
38
+ commit.format(COMMIT_FORMAT)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/auto_commit/rules/base'
4
+ require 'avm/git/auto_commit_path'
5
+
6
+ module Avm
7
+ module Git
8
+ module AutoCommit
9
+ module Rules
10
+ class New < ::Avm::Git::AutoCommit::Rules::Base
11
+ class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
12
+ def auto_commit_path
13
+ ::Avm::Git::AutoCommitPath.new(file.git, file.path)
14
+ end
15
+
16
+ def commit_info
17
+ new_commit_info.message(auto_commit_path.commit_message)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/auto_commit/rules/base'
4
+
5
+ module Avm
6
+ module Git
7
+ module AutoCommit
8
+ module Rules
9
+ class Nth < ::Avm::Git::AutoCommit::Rules::Base
10
+ SHORT_KEY = 't'
11
+
12
+ class << self
13
+ def short_key
14
+ SHORT_KEY
15
+ end
16
+ end
17
+
18
+ common_constructor :number do
19
+ self.number = number.to_i
20
+ end
21
+
22
+ class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
23
+ def commit_info
24
+ file.commits(number - 1).if_present { |v| new_commit_info.fixup(v) }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/auto_commit/rules/base'
4
+
5
+ module Avm
6
+ module Git
7
+ module AutoCommit
8
+ module Rules
9
+ class Unique < ::Avm::Git::AutoCommit::Rules::Base
10
+ class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
11
+ def commit_info
12
+ return nil unless file.commits.count == 1
13
+
14
+ new_commit_info.fixup(file.commits.first)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ ::EacRubyUtils.require_sub __FILE__
6
+
7
+ module Avm
8
+ module Git
9
+ module AutoCommit
10
+ module Rules
11
+ RULES_CLASSES = %w[last manual new nth unique]
12
+ .map { |key| ::Avm::Git::AutoCommit::Rules.const_get(key.camelcase) }
13
+
14
+ class << self
15
+ def parse(string)
16
+ parts = string.split(':')
17
+
18
+ klass = rule_class_by_key(parts.shift)
19
+ klass.new(*parts)
20
+ end
21
+
22
+ def rule_class_by_key(key)
23
+ RULES_CLASSES.find { |klass| klass.keys.include?(key) } ||
24
+ raise("Rule not find with key \"#{key}\" (Available: " +
25
+ RULES_CLASSES.flat_map(&:keys).join(', ') + ')')
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ class AutoCommitPath
8
+ module Ruby
9
+ RUBY_CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
10
+
11
+ def ruby_class_name
12
+ RUBY_CLASS_NAME_PATTERNS.each do |pattern|
13
+ pattern.if_match(relative_path.to_path, false) { |m| return m[1].camelize }
14
+ end
15
+ nil
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ class AutoCommitPath
8
+ require_sub __FILE__, include_modules: true
9
+ common_constructor :git, :path do
10
+ self.path = path.to_pathname
11
+ end
12
+
13
+ def class_name
14
+ ruby_class_name || relative_path.to_path
15
+ end
16
+
17
+ def commit_message
18
+ r = class_name
19
+ r += ': remove' unless path.file?
20
+ r + '.'
21
+ end
22
+
23
+ def relative_path
24
+ path.expand_path.relative_path_from(git.root_path.expand_path)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ class Commit
8
+ module ClassMethods
9
+ common_concern
10
+
11
+ module ClassMethods
12
+ def target_url_to_env_path(target_url)
13
+ uri = ::Addressable::URI.parse(target_url)
14
+ uri.scheme = 'file' if uri.scheme.blank?
15
+ [uri_to_env(uri), uri.path]
16
+ end
17
+
18
+ private
19
+
20
+ def uri_to_env(uri)
21
+ case uri.scheme
22
+ when 'file' then ::EacRubyUtils::Envs.local
23
+ when 'ssh' then ::EacRubyUtils::Envs.ssh(uri)
24
+ else "Invalid schema \"#{uri.schema}\" (URI: #{uri})"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'avm/files/appendable'
6
+ require 'avm/files/deploy'
7
+
8
+ module Avm
9
+ module Git
10
+ class Commit
11
+ class Deploy
12
+ include ::Avm::Files::Appendable
13
+ enable_simple_cache
14
+
15
+ attr_reader :build_dir, :commit, :target_env, :target_path
16
+
17
+ def initialize(commit, target_env, target_path)
18
+ @commit = commit
19
+ @target_env = target_env
20
+ @target_path = target_path
21
+ end
22
+
23
+ def run
24
+ fd = ::Avm::Files::Deploy.new(target_env, target_path)
25
+ fd.append_tar_output_command(git_archive_command)
26
+ fd.appended.push(*appended)
27
+ fd.run
28
+ end
29
+
30
+ private
31
+
32
+ def git_archive_command
33
+ commit.git.command('archive', '--format=tar', commit.sha1)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Git
7
+ class Commit
8
+ module DeployMethods
9
+ def deploy_to_env_path(target_env, target_path)
10
+ Deploy.new(self, target_env, target_path)
11
+ end
12
+
13
+ def deploy_to_url(target_url)
14
+ Deploy.new(self, *self.class.target_url_to_env_path(target_url))
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end