eac_tools 0.48.1 → 0.50.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -21
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/registry/sources.rb +21 -0
- data/sub/avm/lib/avm/scms/auto_commit/file_resource_name/ruby.rb +23 -0
- data/sub/avm/lib/avm/scms/auto_commit/file_resource_name.rb +31 -0
- data/sub/avm/lib/avm/scms/auto_commit/for_file.rb +72 -0
- data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/base.rb +3 -2
- data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/last.rb +4 -4
- data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/manual.rb +5 -10
- data/sub/avm/lib/avm/scms/auto_commit/rules/new.rb +24 -0
- data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/nth.rb +4 -4
- data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules/unique.rb +4 -4
- data/sub/{avm-git/lib/avm/git → avm/lib/avm/scms}/auto_commit/rules.rb +7 -2
- data/sub/avm/lib/avm/scms/auto_commit.rb +11 -0
- data/sub/avm/lib/avm/scms/base/commits.rb +27 -0
- data/sub/avm/lib/avm/scms/base/milestones.rb +21 -0
- data/sub/avm/lib/avm/scms/base.rb +8 -2
- data/sub/avm/lib/avm/scms/changed_file.rb +26 -0
- data/sub/avm/lib/avm/scms/commit.rb +15 -0
- data/sub/avm/lib/avm/scms/commit_info.rb +20 -0
- data/sub/avm/lib/avm/scms/interval.rb +18 -0
- data/sub/avm/lib/avm/scms.rb +9 -0
- data/sub/avm/lib/avm/sources/base/stereotype.rb +18 -0
- data/sub/avm/lib/avm/version.rb +1 -1
- 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
- data/sub/avm-git/avm-git.gemspec +3 -3
- data/sub/avm-git/lib/avm/git/scms/git/changed_file.rb +16 -0
- data/sub/avm-git/lib/avm/git/scms/git/changed_files.rb +24 -0
- data/sub/avm-git/lib/avm/git/scms/git/commit.rb +10 -0
- data/sub/avm-git/lib/avm/git/scms/git/commits.rb +57 -0
- data/sub/avm-git/lib/avm/git/scms/git/interval.rb +31 -0
- data/sub/avm-git/lib/avm/git/scms/git/milestones.rb +21 -0
- data/sub/avm-git/lib/avm/git/scms/git/run_commit.rb +57 -0
- data/sub/avm-git/lib/avm/git/scms/git.rb +6 -35
- data/sub/avm-git/lib/avm/git/scms/git_subrepo.rb +2 -1
- data/sub/avm-git/lib/avm/git/version.rb +1 -1
- data/sub/avm-tools/avm-tools.gemspec +2 -2
- data/sub/avm-tools/lib/avm/tools/runner/git/subrepo/fix.rb +12 -4
- data/sub/avm-tools/lib/avm/tools/runner/{git → source}/auto_commit.rb +12 -9
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/{value.rb → item.rb} +7 -13
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +14 -4
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/assert_parent.rb +12 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +10 -10
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/assert_parent_spec.rb +21 -0
- metadata +39 -30
- data/sub/avm-git/lib/avm/git/auto_commit/commit_info.rb +0 -23
- data/sub/avm-git/lib/avm/git/auto_commit/rules/new.rb +0 -24
- data/sub/avm-git/lib/avm/git/auto_commit_path/ruby.rb +0 -20
- data/sub/avm-git/lib/avm/git/auto_commit_path.rb +0 -28
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4beb83e6ea4860f6c6b5a5e9cc4d06bc5fb2dbea75a75d431a9c37bae9070e9
|
4
|
+
data.tar.gz: c982c7cd5fd95f92ac4d656df233600745a0a6f58cc1d662456804eda7a3a9e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10951929bb08a90e4d521c8f04baede258a04b8a4832a7770b765395616d5e7ec57dd88b5c6631d96a7aaeb5bb10f87cb99206e33ea86e3db635bee1b72a8d69
|
7
|
+
data.tar.gz: a2134fad70db674197dade76b08aa2acfd16e4c8e6af35d5eb12b9a7447145055941e22af96e3280b8de0c1770ec6ac40486fde50fa4ba6c3e7c95f883a9db16
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.
|
5
|
-
avm (~> 0.
|
4
|
+
eac_tools (0.50.0)
|
5
|
+
avm (~> 0.59)
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.13)
|
7
7
|
avm-eac_generic_base0 (~> 0.8)
|
8
8
|
avm-eac_latex_base0 (~> 0.3)
|
@@ -16,8 +16,8 @@ PATH
|
|
16
16
|
avm-eac_ruby_base1 (~> 0.27, >= 0.27.3)
|
17
17
|
avm-eac_webapp_base0 (~> 0.13)
|
18
18
|
avm-eac_wordpress_base0 (~> 0.3)
|
19
|
-
avm-tools (~> 0.
|
20
|
-
eac_ruby_utils (~> 0.
|
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
|
@@ -163,23 +163,23 @@ PATH
|
|
163
163
|
PATH
|
164
164
|
remote: sub/avm-git
|
165
165
|
specs:
|
166
|
-
avm-git (0.
|
167
|
-
avm (~> 0.
|
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.
|
171
|
-
git (~> 1.
|
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.
|
176
|
+
avm-tools (0.143.0)
|
177
177
|
aranha-parsers (~> 0.14, >= 0.14.4)
|
178
|
-
avm (~> 0.
|
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.
|
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.
|
194
|
+
avm (0.59.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
|
-
eac_fs (~> 0.
|
199
|
+
eac_fs (~> 0.16)
|
200
200
|
eac_git (~> 0.14)
|
201
|
-
eac_ruby_utils (~> 0.
|
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.
|
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.
|
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.
|
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
|
-
racc (1.6.
|
347
|
-
rack (3.0.
|
346
|
+
racc (1.6.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.
|
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.
|
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)
|
data/lib/eac_tools/version.rb
CHANGED
data/sub/avm/avm.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency 'eac_cli', '~> 0.30'
|
17
17
|
s.add_dependency 'eac_config', '~> 0.12'
|
18
18
|
s.add_dependency 'eac_docker', '~> 0.5'
|
19
|
-
s.add_dependency 'eac_fs', '~> 0.
|
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.
|
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'
|
@@ -5,6 +5,27 @@ require 'avm/registry/with_path'
|
|
5
5
|
module Avm
|
6
6
|
module Registry
|
7
7
|
class Sources < ::Avm::Registry::WithPath
|
8
|
+
# @return [Avm::ApplicationStereotypes::Base]
|
9
|
+
def application_stereotype_by_name(name)
|
10
|
+
::Avm::Registry.application_stereotypes.detect(name)
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [Avm::Sources::Base, nil]
|
14
|
+
def detect_optional(*detect_args)
|
15
|
+
detect_optional_by_configuration(*detect_args) || super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Avm::Sources::Base, nil]
|
19
|
+
def detect_optional_by_configuration(path, *detect_args)
|
20
|
+
source_configured_stereotype_name(path).if_present do |v|
|
21
|
+
application_stereotype_by_name(v).source_class.new(path, *detect_args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String]
|
26
|
+
def source_configured_stereotype_name(path)
|
27
|
+
::Avm::Sources::Base.new(path).stereotype_name_by_configuration
|
28
|
+
end
|
8
29
|
end
|
9
30
|
end
|
10
31
|
end
|
@@ -0,0 +1,23 @@
|
|
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
|
+
module Ruby
|
10
|
+
RUBY_CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z},
|
11
|
+
%r{app/[^/]+/(.+)\.rb\z}].freeze
|
12
|
+
|
13
|
+
def ruby_class_name
|
14
|
+
RUBY_CLASS_NAME_PATTERNS.each do |pattern|
|
15
|
+
pattern.if_match(relative_path.to_path, false) { |m| return m[1].camelize }
|
16
|
+
end
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
common_constructor :source_root, :path do
|
11
|
+
self.source_root = source_root.to_pathname
|
12
|
+
self.path = path.to_pathname
|
13
|
+
end
|
14
|
+
|
15
|
+
def class_name
|
16
|
+
ruby_class_name || relative_path.to_path
|
17
|
+
end
|
18
|
+
|
19
|
+
def commit_message
|
20
|
+
r = class_name
|
21
|
+
r += ': remove' unless path.file?
|
22
|
+
r + '.'
|
23
|
+
end
|
24
|
+
|
25
|
+
def relative_path
|
26
|
+
path.expand_path.relative_path_from(source_root.expand_path)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
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
|
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::
|
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/
|
3
|
+
require 'avm/scms/auto_commit/rules/base'
|
4
4
|
|
5
5
|
module Avm
|
6
|
-
module
|
6
|
+
module Scms
|
7
7
|
module AutoCommit
|
8
8
|
module Rules
|
9
|
-
class Last < ::Avm::
|
10
|
-
class WithFile < ::Avm::
|
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/
|
3
|
+
require 'avm/scms/auto_commit/rules/base'
|
4
4
|
|
5
5
|
module Avm
|
6
|
-
module
|
6
|
+
module Scms
|
7
7
|
module AutoCommit
|
8
8
|
module Rules
|
9
|
-
class Manual < ::Avm::
|
10
|
-
class WithFile < ::Avm::
|
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}",
|
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/
|
3
|
+
require 'avm/scms/auto_commit/rules/base'
|
4
4
|
|
5
5
|
module Avm
|
6
|
-
module
|
6
|
+
module Scms
|
7
7
|
module AutoCommit
|
8
8
|
module Rules
|
9
|
-
class Nth < ::Avm::
|
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::
|
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/
|
3
|
+
require 'avm/scms/auto_commit/rules/base'
|
4
4
|
|
5
5
|
module Avm
|
6
|
-
module
|
6
|
+
module Scms
|
7
7
|
module AutoCommit
|
8
8
|
module Rules
|
9
|
-
class Unique < ::Avm::
|
10
|
-
class WithFile < ::Avm::
|
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
|
8
|
+
module Scms
|
9
9
|
module AutoCommit
|
10
10
|
module Rules
|
11
11
|
RULES_CLASSES = %w[last manual new nth unique]
|
12
|
-
|
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,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::
|
18
|
-
def
|
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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Scms
|
7
|
+
class CommitInfo
|
8
|
+
enable_immutable
|
9
|
+
|
10
|
+
immutable_accessor :fixup, :message
|
11
|
+
immutable_accessor :path, type: :array
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
self.class.name.demodulize + '[' +
|
15
|
+
%w[fixup message].map { |m| [m, send(m)] }.reject { |m| m[1].blank? }
|
16
|
+
.map { |m| m.join(': ') }.join(',') + ']'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Scms
|
7
|
+
class Interval
|
8
|
+
enable_abstract_methods
|
9
|
+
|
10
|
+
common_constructor :scm, :from, :to
|
11
|
+
|
12
|
+
# @return [Array<Avm::Scms::Commit>]
|
13
|
+
def commits
|
14
|
+
raise_abstract_method __method__
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|