eac_tools 0.49.0 → 0.51.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -23
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +1 -1
  5. data/sub/avm/lib/avm/file_formats/base.rb +7 -0
  6. data/sub/avm/lib/avm/file_formats/search_formatter.rb +2 -12
  7. data/sub/avm/lib/avm/registry/file_formats.rb +4 -0
  8. data/sub/avm/lib/avm/rspec/setup.rb +2 -2
  9. data/sub/avm/lib/avm/rspec/shared_examples/avm_file_format_file_resource_name.rb +15 -0
  10. data/sub/avm/lib/avm/scms/auto_commit/file_resource_name.rb +39 -0
  11. data/sub/avm/lib/avm/scms/auto_commit/for_file.rb +72 -0
  12. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/base.rb +3 -2
  13. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/last.rb +4 -4
  14. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/manual.rb +5 -10
  15. data/sub/avm/lib/avm/scms/auto_commit/rules/new.rb +24 -0
  16. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/nth.rb +4 -4
  17. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/unique.rb +4 -4
  18. data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules.rb +7 -2
  19. data/sub/avm/lib/avm/scms/auto_commit.rb +11 -0
  20. data/sub/avm/lib/avm/scms/base/commits.rb +27 -0
  21. data/sub/avm/lib/avm/scms/base/milestones.rb +21 -0
  22. data/sub/avm/lib/avm/scms/base.rb +8 -2
  23. data/sub/avm/lib/avm/scms/changed_file.rb +26 -0
  24. data/sub/avm/lib/avm/scms/commit.rb +15 -0
  25. data/sub/avm/lib/avm/scms/commit_info.rb +20 -0
  26. data/sub/avm/lib/avm/scms/interval.rb +18 -0
  27. data/sub/avm/lib/avm/scms.rb +9 -0
  28. data/sub/avm/lib/avm/version.rb +1 -1
  29. data/sub/avm/spec/lib/avm/file_formats/base_spec.rb +11 -0
  30. data/sub/{avm-git/spec/lib/avm/git/auto_commit_path_spec.rb → avm/spec/lib/avm/scms/auto_commit/file_resource_name_spec.rb} +2 -2
  31. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  32. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/file_formats/base/file_resource_name.rb +49 -0
  33. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/file_formats/base.rb +2 -0
  34. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  35. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/file_formats/base_spec.rb +8 -0
  36. data/sub/avm-git/avm-git.gemspec +3 -3
  37. data/sub/avm-git/lib/avm/git/scms/git/changed_file.rb +16 -0
  38. data/sub/avm-git/lib/avm/git/scms/git/changed_files.rb +24 -0
  39. data/sub/avm-git/lib/avm/git/scms/git/commit.rb +10 -0
  40. data/sub/avm-git/lib/avm/git/scms/git/commits.rb +57 -0
  41. data/sub/avm-git/lib/avm/git/scms/git/interval.rb +31 -0
  42. data/sub/avm-git/lib/avm/git/scms/git/milestones.rb +21 -0
  43. data/sub/avm-git/lib/avm/git/scms/git/run_commit.rb +57 -0
  44. data/sub/avm-git/lib/avm/git/scms/git.rb +6 -35
  45. data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +2 -1
  46. data/sub/avm-git/lib/avm/git/version.rb +1 -1
  47. data/sub/avm-tools/avm-tools.gemspec +2 -2
  48. data/sub/avm-tools/lib/avm/tools/runner/git/subrepo/fix.rb +12 -4
  49. data/sub/avm-tools/lib/avm/tools/runner/{git → source}/auto_commit.rb +12 -9
  50. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  51. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/{value.rb → item.rb} +7 -13
  52. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +14 -4
  53. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/assert_parent.rb +12 -0
  54. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  55. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +10 -10
  56. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/assert_parent_spec.rb +21 -0
  57. metadata +42 -38
  58. data/sub/avm-git/lib/avm/git/auto_commit/commit_info.rb +0 -23
  59. data/sub/avm-git/lib/avm/git/auto_commit/rules/new.rb +0 -24
  60. data/sub/avm-git/lib/avm/git/auto_commit_path/ruby.rb +0 -20
  61. data/sub/avm-git/lib/avm/git/auto_commit_path.rb +0 -28
  62. data/sub/avm-git/lib/avm/git/file_auto_fixup.rb +0 -83
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95ce6a42783daae88feb2f51ad5a030d0deec5bd232b54134e105ba3aa8e9977
4
- data.tar.gz: cf6bd266decf81b7c6ff1ae75b28f7943772f83b7ea733ab3d73916be36f6c7b
3
+ metadata.gz: 2dbc38a08966af86a3d17c50ad0788770045d7dcbd7c336fbbc31c9883b6a0aa
4
+ data.tar.gz: '0979accd22c7b7651e8ee52d4798efad58550b74e21def1a2df600f4a557386f'
5
5
  SHA512:
6
- metadata.gz: 48291d409c8e3c785a0c53911d566c7fefddc7b9380a6109f3ef83baf6bb9e37f11c401725fd6282d362b6883da37c026a7d1023d2f90bccc02a65c8155f5cd1
7
- data.tar.gz: ed7abbbd834bb86398069f0b270e833d5f4a4d694da88e53602f06af44f6bc07a169d90cc297d0a212b5cad0ee7c47221fe212a72d80fbe43f3b4bd02e42760d
6
+ metadata.gz: f3c593fb8b4e163a02e42b7540022bc5180abc1883f1ee2a9b8608035243fe99b43cb484894e0fcc7b40a33b3b63d0b00651885ae4685ba59b7acc40259ff25e
7
+ data.tar.gz: 65b5f4c7a7713ebe7e49892df82e18965fc32d47304b4afc2ca35af8c0a82a0a85df6b238e79645cd7c99002ef09f3a407357ef3089aa77e61e0defa3d24fdec
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.49.0)
5
- avm (~> 0.58)
4
+ eac_tools (0.51.0)
5
+ avm (~> 0.60)
6
6
  avm-eac_asciidoctor_base0 (~> 0.13)
7
7
  avm-eac_generic_base0 (~> 0.8)
8
8
  avm-eac_latex_base0 (~> 0.3)
@@ -13,11 +13,11 @@ PATH
13
13
  avm-eac_rails_base1 (~> 0.8)
14
14
  avm-eac_redmine_base0 (~> 0.18)
15
15
  avm-eac_redmine_plugin_base0 (~> 0.4)
16
- avm-eac_ruby_base1 (~> 0.27, >= 0.27.3)
16
+ avm-eac_ruby_base1 (~> 0.28)
17
17
  avm-eac_webapp_base0 (~> 0.13)
18
18
  avm-eac_wordpress_base0 (~> 0.3)
19
- avm-tools (~> 0.142, >= 0.142.8)
20
- eac_ruby_utils (~> 0.109, >= 0.109.1)
19
+ avm-tools (~> 0.143)
20
+ eac_ruby_utils (~> 0.110, >= 0.110.1)
21
21
 
22
22
  PATH
23
23
  remote: sub/aranha-parsers
@@ -118,10 +118,10 @@ PATH
118
118
  PATH
119
119
  remote: sub/avm-eac_ruby_base1
120
120
  specs:
121
- avm-eac_ruby_base1 (0.27.3)
122
- avm (~> 0.57)
121
+ avm-eac_ruby_base1 (0.28.0)
122
+ avm (~> 0.60)
123
123
  avm-eac_generic_base0 (~> 0.8)
124
- eac_ruby_utils (~> 0.109)
124
+ eac_ruby_utils (~> 0.110, >= 0.110.1)
125
125
 
126
126
  PATH
127
127
  remote: sub/avm-eac_ubuntu_base0
@@ -163,23 +163,23 @@ PATH
163
163
  PATH
164
164
  remote: sub/avm-git
165
165
  specs:
166
- avm-git (0.10.1)
167
- avm (~> 0.57)
166
+ avm-git (0.11.0)
167
+ avm (~> 0.59)
168
168
  avm-files (~> 0.6)
169
169
  eac_git (~> 0.14)
170
- eac_ruby_utils (~> 0.108)
171
- git (~> 1.12)
170
+ eac_ruby_utils (~> 0.110, >= 0.110.1)
171
+ git (~> 1.13)
172
172
 
173
173
  PATH
174
174
  remote: sub/avm-tools
175
175
  specs:
176
- avm-tools (0.142.8)
176
+ avm-tools (0.143.0)
177
177
  aranha-parsers (~> 0.14, >= 0.14.4)
178
- avm (~> 0.57)
178
+ avm (~> 0.59)
179
179
  avm-eac_ruby_base1 (~> 0.27, >= 0.27.3)
180
180
  avm-eac_ubuntu_base0 (~> 0.4)
181
181
  avm-files (~> 0.6)
182
- avm-git (~> 0.10, >= 0.10.1)
182
+ avm-git (~> 0.11)
183
183
  clipboard (~> 1.3, >= 1.3.6)
184
184
  curb (~> 0.9, >= 0.9.11)
185
185
  eac_git (~> 0.14)
@@ -191,14 +191,14 @@ PATH
191
191
  PATH
192
192
  remote: sub/avm
193
193
  specs:
194
- avm (0.58.0)
194
+ avm (0.60.0)
195
195
  aranha-parsers (~> 0.14, >= 0.14.4)
196
196
  eac_cli (~> 0.30)
197
197
  eac_config (~> 0.12)
198
198
  eac_docker (~> 0.5)
199
199
  eac_fs (~> 0.16)
200
200
  eac_git (~> 0.14)
201
- eac_ruby_utils (~> 0.109, >= 0.109.1)
201
+ eac_ruby_utils (~> 0.110, >= 0.110.1)
202
202
  eac_templates (~> 0.3, >= 0.3.2)
203
203
  filesize (~> 0.2)
204
204
  htmlbeautifier (~> 1.4, >= 1.4.2)
@@ -253,7 +253,7 @@ PATH
253
253
  PATH
254
254
  remote: sub/eac_ruby_utils
255
255
  specs:
256
- eac_ruby_utils (0.109.1)
256
+ eac_ruby_utils (0.110.1)
257
257
  activesupport (>= 4, < 7)
258
258
  addressable (~> 2.8, >= 2.8.1)
259
259
  bundler
@@ -329,7 +329,7 @@ GEM
329
329
  concurrent-ruby (~> 1.0)
330
330
  jaro_winkler (1.5.4)
331
331
  minitar (0.9)
332
- minitest (5.16.3)
332
+ minitest (5.17.0)
333
333
  multipart-post (2.2.3)
334
334
  net-ssh (4.2.0)
335
335
  nokogiri (1.13.10-x86_64-linux)
@@ -339,12 +339,12 @@ GEM
339
339
  os (1.1.4)
340
340
  parallel (1.22.1)
341
341
  parseconfig (1.1.2)
342
- parser (3.1.3.0)
342
+ parser (3.2.0.0)
343
343
  ast (~> 2.4.1)
344
344
  parslet (2.0.0)
345
345
  public_suffix (5.0.1)
346
346
  racc (1.6.2)
347
- rack (3.0.2)
347
+ rack (3.0.3)
348
348
  rainbow (3.1.1)
349
349
  rchardet (1.8.0)
350
350
  rexml (3.2.5)
@@ -355,10 +355,10 @@ GEM
355
355
  rspec-mocks (~> 3.12.0)
356
356
  rspec-core (3.12.0)
357
357
  rspec-support (~> 3.12.0)
358
- rspec-expectations (3.12.1)
358
+ rspec-expectations (3.12.2)
359
359
  diff-lcs (>= 1.2.0, < 2.0)
360
360
  rspec-support (~> 3.12.0)
361
- rspec-mocks (3.12.1)
361
+ rspec-mocks (3.12.2)
362
362
  diff-lcs (>= 1.2.0, < 2.0)
363
363
  rspec-support (~> 3.12.0)
364
364
  rspec-support (3.12.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.49.0'
4
+ VERSION = '0.51.0'
5
5
  end
data/sub/avm/avm.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'eac_docker', '~> 0.5'
19
19
  s.add_dependency 'eac_fs', '~> 0.16'
20
20
  s.add_dependency 'eac_git', '~> 0.14'
21
- s.add_dependency 'eac_ruby_utils', '~> 0.109', '>= 0.109.1'
21
+ s.add_dependency 'eac_ruby_utils', '~> 0.110', '>= 0.110.1'
22
22
  s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
23
23
  s.add_dependency 'filesize', '~> 0.2'
24
24
  s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
@@ -8,6 +8,7 @@ module Avm
8
8
  module FileFormats
9
9
  class Base
10
10
  enable_abstract_methods
11
+ compare_by :class
11
12
 
12
13
  def apply(files)
13
14
  old_content = Hash[files.map { |f| [f, File.read(f)] }]
@@ -15,6 +16,12 @@ module Avm
15
16
  files.map { |f| build_file_result(f, old_content[f]) }
16
17
  end
17
18
 
19
+ # @param path [Pathname]
20
+ # @return [Avm::FileFormats::FileWith]
21
+ def file_resource_name(path)
22
+ path.to_pathname.to_path
23
+ end
24
+
18
25
  def name
19
26
  self.class.name.demodulize
20
27
  end
@@ -50,19 +50,9 @@ module Avm
50
50
  @result = []
51
51
  end
52
52
 
53
+ # @return [Avm::FileFormats::Base, nil]
53
54
  def find_format(file)
54
- formats.each do |c|
55
- return c if c.match?(file)
56
- end
57
- nil
58
- end
59
-
60
- def formats_uncached
61
- formats_from_registry
62
- end
63
-
64
- def formats_from_registry
65
- ::Avm::Registry.file_formats.available.reverse.map(&:new)
55
+ ::Avm::Registry.file_formats.detect_optional(file)
66
56
  end
67
57
 
68
58
  def search_files
@@ -5,6 +5,10 @@ require 'avm/registry/from_gems'
5
5
  module Avm
6
6
  module Registry
7
7
  class FileFormats < ::Avm::Registry::FromGems
8
+ # @return [Avm::FileFormats::Base]
9
+ def class_detect(klass, detect_args)
10
+ klass.new if klass.new.match?(detect_args.first)
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -7,8 +7,8 @@ module Avm
7
7
  module Rspec
8
8
  module Setup
9
9
  require_sub __FILE__
10
- EXAMPLES = %w[avm_file_formats_with_fixtures avm_source_generated entries_values
11
- in_avm_registry not_in_avm_registry].freeze
10
+ EXAMPLES = %w[avm_file_formats_with_fixtures avm_file_format_file_resource_name
11
+ avm_source_generated entries_values in_avm_registry not_in_avm_registry].freeze
12
12
 
13
13
  def self.extended(obj)
14
14
  obj.setup_examples
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ ::RSpec.shared_examples 'avm_file_format_file_resource_name' do |input_expected|
6
+ describe '#file_resource_name' do
7
+ input_expected.each do |path, expected_resource_name|
8
+ context "when path is \"#{path}\"" do
9
+ let(:instance) { described_class.new }
10
+
11
+ it { expect(instance.file_resource_name(path)).to eq(expected_resource_name) }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ module AutoCommit
8
+ class FileResourceName
9
+ require_sub __FILE__, include_modules: true
10
+ enable_simple_cache
11
+ common_constructor :source_root, :path do
12
+ self.source_root = source_root.to_pathname
13
+ self.path = path.to_pathname
14
+ end
15
+
16
+ def class_name
17
+ file_format.file_resource_name(path)
18
+ end
19
+
20
+ def commit_message
21
+ r = class_name
22
+ r += ': remove' unless path.file?
23
+ r + '.'
24
+ end
25
+
26
+ def relative_path
27
+ path.expand_path.relative_path_from(source_root.expand_path)
28
+ end
29
+
30
+ private
31
+
32
+ # @return [Avm::FileFormats::Base]
33
+ def file_format_uncached
34
+ ::Avm::Registry.file_formats.detect(path)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/commit_info'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Scms
8
+ module AutoCommit
9
+ class ForFile
10
+ enable_speaker
11
+ enable_simple_cache
12
+ enable_listable
13
+
14
+ common_constructor :scm, :path, :rules do
15
+ self.path = path.to_pathname.expand_path(scm.path)
16
+ end
17
+
18
+ COMMITS_SEARCH_INTERVAL = 'origin/master..HEAD'
19
+
20
+ def scm_relative_path
21
+ path.to_pathname.relative_path_from(scm.path)
22
+ end
23
+
24
+ def run
25
+ start_banner
26
+ run_commit || warn("No rule returned commit information for \"#{path}\"")
27
+ end
28
+
29
+ private
30
+
31
+ def commit_info_uncached
32
+ rules.lazy.map { |rule| rule.with_file(self).commit_info }.find(&:present?)
33
+ .if_present { |v| v.path(path) }
34
+ end
35
+
36
+ def start_banner
37
+ infov 'Path', path
38
+ infov ' Commits found', commits.count
39
+ end
40
+
41
+ def run_commit
42
+ return false if commit_info.blank?
43
+
44
+ infov ' Commit info', commit_info
45
+ scm.run_commit(commit_info)
46
+ success ' Commited'
47
+ true
48
+ end
49
+
50
+ def commits_uncached
51
+ scm.current_milestone_interval.commits
52
+ .select { |c| c.changed_files.include?(path.relative_path_from(scm.path)) }
53
+ .reject(&:fixup?).each_with_index
54
+ .map { |commit, index| CommitDelegator.new(commit, index) }
55
+ end
56
+
57
+ class CommitDelegator < ::SimpleDelegator
58
+ attr_reader :index
59
+
60
+ def initialize(commit, index)
61
+ super(commit)
62
+ @index = index
63
+ end
64
+
65
+ def position
66
+ index + 1
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/scms/commit_info'
3
4
  require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
- module Git
7
+ module Scms
7
8
  module AutoCommit
8
9
  module Rules
9
10
  class Base
@@ -29,7 +30,7 @@ module Avm
29
30
  common_constructor :rule, :file
30
31
 
31
32
  def new_commit_info
32
- ::Avm::Git::AutoCommit::CommitInfo.new
33
+ ::Avm::Scms::CommitInfo.new
33
34
  end
34
35
  end
35
36
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/git/auto_commit/rules/base'
3
+ require 'avm/scms/auto_commit/rules/base'
4
4
 
5
5
  module Avm
6
- module Git
6
+ module Scms
7
7
  module AutoCommit
8
8
  module Rules
9
- class Last < ::Avm::Git::AutoCommit::Rules::Base
10
- class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
9
+ class Last < ::Avm::Scms::AutoCommit::Rules::Base
10
+ class WithFile < ::Avm::Scms::AutoCommit::Rules::Base::WithFile
11
11
  def commit_info
12
12
  file.commits.last.if_present { |v| new_commit_info.fixup(v) }
13
13
  end
@@ -1,16 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/git/auto_commit/rules/base'
3
+ require 'avm/scms/auto_commit/rules/base'
4
4
 
5
5
  module Avm
6
- module Git
6
+ module Scms
7
7
  module AutoCommit
8
8
  module Rules
9
- class Manual < ::Avm::Git::AutoCommit::Rules::Base
10
- class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
9
+ class Manual < ::Avm::Scms::AutoCommit::Rules::Base
10
+ class WithFile < ::Avm::Scms::AutoCommit::Rules::Base::WithFile
11
11
  enable_speaker
12
12
 
13
- COMMIT_FORMAT = '%h - %s (%cr)'
14
13
  SKIP_OPTION = 's'
15
14
 
16
15
  def commit_info
@@ -24,7 +23,7 @@ module Avm
24
23
 
25
24
  def commits_banner
26
25
  file.commits.each_with_index do |commit, _index|
27
- infov " #{commit.position}", format_commit(commit)
26
+ infov " #{commit.position}", commit
28
27
  end
29
28
  infov " #{SKIP_OPTION}", 'skip'
30
29
  end
@@ -33,10 +32,6 @@ module Avm
33
32
  (file.commits.map { |commit| [commit.position.to_s, commit] } + [[SKIP_OPTION, nil]])
34
33
  .to_h
35
34
  end
36
-
37
- def format_commit(commit)
38
- commit.format(COMMIT_FORMAT)
39
- end
40
35
  end
41
36
  end
42
37
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/auto_commit/rules/base'
4
+ require 'avm/scms/auto_commit/file_resource_name'
5
+
6
+ module Avm
7
+ module Scms
8
+ module AutoCommit
9
+ module Rules
10
+ class New < ::Avm::Scms::AutoCommit::Rules::Base
11
+ class WithFile < ::Avm::Scms::AutoCommit::Rules::Base::WithFile
12
+ def auto_commit_path
13
+ ::Avm::Scms::AutoCommit::FileResourceName.new(file.scm.path, 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
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/git/auto_commit/rules/base'
3
+ require 'avm/scms/auto_commit/rules/base'
4
4
 
5
5
  module Avm
6
- module Git
6
+ module Scms
7
7
  module AutoCommit
8
8
  module Rules
9
- class Nth < ::Avm::Git::AutoCommit::Rules::Base
9
+ class Nth < ::Avm::Scms::AutoCommit::Rules::Base
10
10
  SHORT_KEY = 't'
11
11
 
12
12
  class << self
@@ -19,7 +19,7 @@ module Avm
19
19
  self.number = number.to_i
20
20
  end
21
21
 
22
- class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
22
+ class WithFile < ::Avm::Scms::AutoCommit::Rules::Base::WithFile
23
23
  def commit_info
24
24
  file.commits(number - 1).if_present { |v| new_commit_info.fixup(v) }
25
25
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/git/auto_commit/rules/base'
3
+ require 'avm/scms/auto_commit/rules/base'
4
4
 
5
5
  module Avm
6
- module Git
6
+ module Scms
7
7
  module AutoCommit
8
8
  module Rules
9
- class Unique < ::Avm::Git::AutoCommit::Rules::Base
10
- class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
9
+ class Unique < ::Avm::Scms::AutoCommit::Rules::Base
10
+ class WithFile < ::Avm::Scms::AutoCommit::Rules::Base::WithFile
11
11
  def commit_info
12
12
  return nil unless file.commits.count == 1
13
13
 
@@ -5,13 +5,18 @@ require 'eac_ruby_utils/core_ext'
5
5
  ::EacRubyUtils.require_sub __FILE__
6
6
 
7
7
  module Avm
8
- module Git
8
+ module Scms
9
9
  module AutoCommit
10
10
  module Rules
11
11
  RULES_CLASSES = %w[last manual new nth unique]
12
- .map { |key| ::Avm::Git::AutoCommit::Rules.const_get(key.camelcase) }
12
+ .map { |key| ::Avm::Scms::AutoCommit::Rules.const_get(key.camelcase) }
13
13
 
14
14
  class << self
15
+ # @return [Array<Avm::Scms::AutoCommit::Rules>]
16
+ def all
17
+ RULES_CLASSES
18
+ end
19
+
15
20
  def parse(string)
16
21
  parts = string.split(':')
17
22
 
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ module AutoCommit
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ class Base
8
+ module Commits
9
+ # @return [Avm::Scms::Commit,NilClass]
10
+ def commit_if_change(_message = nil)
11
+ raise_abstract_method __method__
12
+ end
13
+
14
+ # @return [Avm::Scms::Commit]
15
+ def head_commit
16
+ raise_abstract_method __method__
17
+ end
18
+
19
+ # @param commit_info [Avm::Scms::CommitInfo]
20
+ # @return [Avm::Scms::Commit]
21
+ def run_commit(_commit_info)
22
+ raise_abstract_method __method__
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ class Base
8
+ module Milestones
9
+ # @return [Avm::Scms::Interval]
10
+ def current_milestone_interval
11
+ interval(current_milestone_base_commit, head_commit)
12
+ end
13
+
14
+ # @return [Avm::Scms::Commit]
15
+ def current_milestone_base_commit
16
+ raise_abstract_method __method__
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -6,6 +6,7 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Scms
8
8
  class Base
9
+ require_sub __FILE__, include_modules: true
9
10
  enable_abstract_methods
10
11
  enable_simple_cache
11
12
  include ::Avm::With::ApplicationStereotype
@@ -14,8 +15,13 @@ module Avm
14
15
  self.path = path.to_pathname
15
16
  end
16
17
 
17
- # @return [Avm::Scms::Commit,NilClass]
18
- def commit_if_change(_message = nil)
18
+ # @return [Avm::Scms::ChangedFile]
19
+ def changed_files
20
+ raise_abstract_method __method__
21
+ end
22
+
23
+ # @return [Avm::Scms::Interval]
24
+ def interval(_from, _to)
19
25
  raise_abstract_method __method__
20
26
  end
21
27
 
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ class ChangedFile
8
+ enable_abstract_methods
9
+
10
+ # @return [Pathname]
11
+ def absolute_path
12
+ path.expand_path(scm.path)
13
+ end
14
+
15
+ # @return [Pathname]
16
+ def path
17
+ raise_abstract_method __method__
18
+ end
19
+
20
+ # @return [Avm::Scms::Base]
21
+ def scm
22
+ raise_abstract_method __method__
23
+ end
24
+ end
25
+ end
26
+ end
@@ -16,6 +16,11 @@ module Avm
16
16
  raise_abstract_method __method__
17
17
  end
18
18
 
19
+ # @return [Boolean]
20
+ def fixup?
21
+ raise_abstract_method __method__
22
+ end
23
+
19
24
  def id
20
25
  raise_abstract_method __method__
21
26
  end
@@ -46,6 +51,16 @@ module Avm
46
51
  def scm_file?(_path)
47
52
  raise_abstract_method __method__
48
53
  end
54
+
55
+ # @return [String]
56
+ def subject
57
+ raise_abstract_method __method__
58
+ end
59
+
60
+ # @return [String]
61
+ def to_s
62
+ "#{subject} [#{id}]"
63
+ end
49
64
  end
50
65
  end
51
66
  end