eac_tools 0.49.0 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -19
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +1 -1
- 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/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 +38 -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
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.50.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.59'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.59'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: avm-eac_asciidoctor_base0
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,40 +236,34 @@ dependencies:
|
|
236
236
|
requirements:
|
237
237
|
- - "~>"
|
238
238
|
- !ruby/object:Gem::Version
|
239
|
-
version: '0.
|
240
|
-
- - ">="
|
241
|
-
- !ruby/object:Gem::Version
|
242
|
-
version: 0.142.8
|
239
|
+
version: '0.143'
|
243
240
|
type: :runtime
|
244
241
|
prerelease: false
|
245
242
|
version_requirements: !ruby/object:Gem::Requirement
|
246
243
|
requirements:
|
247
244
|
- - "~>"
|
248
245
|
- !ruby/object:Gem::Version
|
249
|
-
version: '0.
|
250
|
-
- - ">="
|
251
|
-
- !ruby/object:Gem::Version
|
252
|
-
version: 0.142.8
|
246
|
+
version: '0.143'
|
253
247
|
- !ruby/object:Gem::Dependency
|
254
248
|
name: eac_ruby_utils
|
255
249
|
requirement: !ruby/object:Gem::Requirement
|
256
250
|
requirements:
|
257
251
|
- - "~>"
|
258
252
|
- !ruby/object:Gem::Version
|
259
|
-
version: '0.
|
253
|
+
version: '0.110'
|
260
254
|
- - ">="
|
261
255
|
- !ruby/object:Gem::Version
|
262
|
-
version: 0.
|
256
|
+
version: 0.110.1
|
263
257
|
type: :runtime
|
264
258
|
prerelease: false
|
265
259
|
version_requirements: !ruby/object:Gem::Requirement
|
266
260
|
requirements:
|
267
261
|
- - "~>"
|
268
262
|
- !ruby/object:Gem::Version
|
269
|
-
version: '0.
|
263
|
+
version: '0.110'
|
270
264
|
- - ">="
|
271
265
|
- !ruby/object:Gem::Version
|
272
|
-
version: 0.
|
266
|
+
version: 0.110.1
|
273
267
|
- !ruby/object:Gem::Dependency
|
274
268
|
name: eac_ruby_gem_support
|
275
269
|
requirement: !ruby/object:Gem::Requirement
|
@@ -857,21 +851,10 @@ files:
|
|
857
851
|
- sub/avm-git/Gemfile
|
858
852
|
- sub/avm-git/avm-git.gemspec
|
859
853
|
- sub/avm-git/lib/avm/git.rb
|
860
|
-
- sub/avm-git/lib/avm/git/auto_commit/commit_info.rb
|
861
|
-
- sub/avm-git/lib/avm/git/auto_commit/rules.rb
|
862
|
-
- sub/avm-git/lib/avm/git/auto_commit/rules/base.rb
|
863
|
-
- sub/avm-git/lib/avm/git/auto_commit/rules/last.rb
|
864
|
-
- sub/avm-git/lib/avm/git/auto_commit/rules/manual.rb
|
865
|
-
- sub/avm-git/lib/avm/git/auto_commit/rules/new.rb
|
866
|
-
- sub/avm-git/lib/avm/git/auto_commit/rules/nth.rb
|
867
|
-
- sub/avm-git/lib/avm/git/auto_commit/rules/unique.rb
|
868
|
-
- sub/avm-git/lib/avm/git/auto_commit_path.rb
|
869
|
-
- sub/avm-git/lib/avm/git/auto_commit_path/ruby.rb
|
870
854
|
- sub/avm-git/lib/avm/git/commit.rb
|
871
855
|
- sub/avm-git/lib/avm/git/commit/class_methods.rb
|
872
856
|
- sub/avm-git/lib/avm/git/commit/diff_tree_line.rb
|
873
857
|
- sub/avm-git/lib/avm/git/commit/file.rb
|
874
|
-
- sub/avm-git/lib/avm/git/file_auto_fixup.rb
|
875
858
|
- sub/avm-git/lib/avm/git/issue.rb
|
876
859
|
- sub/avm-git/lib/avm/git/issue/complete.rb
|
877
860
|
- sub/avm-git/lib/avm/git/issue/complete/commits.rb
|
@@ -918,9 +901,15 @@ files:
|
|
918
901
|
- sub/avm-git/lib/avm/git/scms.rb
|
919
902
|
- sub/avm-git/lib/avm/git/scms/git.rb
|
920
903
|
- sub/avm-git/lib/avm/git/scms/git/change_tracker.rb
|
904
|
+
- sub/avm-git/lib/avm/git/scms/git/changed_file.rb
|
905
|
+
- sub/avm-git/lib/avm/git/scms/git/changed_files.rb
|
921
906
|
- sub/avm-git/lib/avm/git/scms/git/commit.rb
|
922
907
|
- sub/avm-git/lib/avm/git/scms/git/commit/deploy.rb
|
923
908
|
- sub/avm-git/lib/avm/git/scms/git/commit/deploy_methods.rb
|
909
|
+
- sub/avm-git/lib/avm/git/scms/git/commits.rb
|
910
|
+
- sub/avm-git/lib/avm/git/scms/git/interval.rb
|
911
|
+
- sub/avm-git/lib/avm/git/scms/git/milestones.rb
|
912
|
+
- sub/avm-git/lib/avm/git/scms/git/run_commit.rb
|
924
913
|
- sub/avm-git/lib/avm/git/scms/git_subrepo.rb
|
925
914
|
- sub/avm-git/lib/avm/git/scms/provider.rb
|
926
915
|
- sub/avm-git/lib/avm/git/subrepo_check.rb
|
@@ -931,7 +920,6 @@ files:
|
|
931
920
|
- sub/avm-git/lib/avm/git/vendor.rb
|
932
921
|
- sub/avm-git/lib/avm/git/vendor/github.rb
|
933
922
|
- sub/avm-git/lib/avm/git/version.rb
|
934
|
-
- sub/avm-git/spec/lib/avm/git/auto_commit_path_spec.rb
|
935
923
|
- sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec.rb
|
936
924
|
- sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.source.out
|
937
925
|
- sub/avm-git/spec/lib/avm/git/commit/diff_tree_line_spec_files/add.target.yaml
|
@@ -969,7 +957,6 @@ files:
|
|
969
957
|
- sub/avm-tools/lib/avm/tools/runner/files/format.rb
|
970
958
|
- sub/avm-tools/lib/avm/tools/runner/files/rotate.rb
|
971
959
|
- sub/avm-tools/lib/avm/tools/runner/git.rb
|
972
|
-
- sub/avm-tools/lib/avm/tools/runner/git/auto_commit.rb
|
973
960
|
- sub/avm-tools/lib/avm/tools/runner/git/commit.rb
|
974
961
|
- sub/avm-tools/lib/avm/tools/runner/git/deploy.rb
|
975
962
|
- sub/avm-tools/lib/avm/tools/runner/git/dirty_files.rb
|
@@ -991,6 +978,7 @@ files:
|
|
991
978
|
- sub/avm-tools/lib/avm/tools/runner/self/docker.rb
|
992
979
|
- sub/avm-tools/lib/avm/tools/runner/self/registry.rb
|
993
980
|
- sub/avm-tools/lib/avm/tools/runner/source.rb
|
981
|
+
- sub/avm-tools/lib/avm/tools/runner/source/auto_commit.rb
|
994
982
|
- sub/avm-tools/lib/avm/tools/runner/source/info.rb
|
995
983
|
- sub/avm-tools/lib/avm/tools/runner/source/issue.rb
|
996
984
|
- sub/avm-tools/lib/avm/tools/runner/source/issue/complete.rb
|
@@ -1149,9 +1137,26 @@ files:
|
|
1149
1137
|
- sub/avm/lib/avm/rspec/shared_examples/in_avm_registry.rb
|
1150
1138
|
- sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb
|
1151
1139
|
- sub/avm/lib/avm/runners/base.rb
|
1140
|
+
- sub/avm/lib/avm/scms.rb
|
1141
|
+
- sub/avm/lib/avm/scms/auto_commit.rb
|
1142
|
+
- sub/avm/lib/avm/scms/auto_commit/file_resource_name.rb
|
1143
|
+
- sub/avm/lib/avm/scms/auto_commit/file_resource_name/ruby.rb
|
1144
|
+
- sub/avm/lib/avm/scms/auto_commit/for_file.rb
|
1145
|
+
- sub/avm/lib/avm/scms/auto_commit/rules.rb
|
1146
|
+
- sub/avm/lib/avm/scms/auto_commit/rules/base.rb
|
1147
|
+
- sub/avm/lib/avm/scms/auto_commit/rules/last.rb
|
1148
|
+
- sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
|
1149
|
+
- sub/avm/lib/avm/scms/auto_commit/rules/new.rb
|
1150
|
+
- sub/avm/lib/avm/scms/auto_commit/rules/nth.rb
|
1151
|
+
- sub/avm/lib/avm/scms/auto_commit/rules/unique.rb
|
1152
1152
|
- sub/avm/lib/avm/scms/base.rb
|
1153
|
+
- sub/avm/lib/avm/scms/base/commits.rb
|
1154
|
+
- sub/avm/lib/avm/scms/base/milestones.rb
|
1155
|
+
- sub/avm/lib/avm/scms/changed_file.rb
|
1153
1156
|
- sub/avm/lib/avm/scms/commit.rb
|
1157
|
+
- sub/avm/lib/avm/scms/commit_info.rb
|
1154
1158
|
- sub/avm/lib/avm/scms/inflector.rb
|
1159
|
+
- sub/avm/lib/avm/scms/interval.rb
|
1155
1160
|
- sub/avm/lib/avm/scms/null.rb
|
1156
1161
|
- sub/avm/lib/avm/self/docker_image.rb
|
1157
1162
|
- sub/avm/lib/avm/self/instance.rb
|
@@ -1197,6 +1202,7 @@ files:
|
|
1197
1202
|
- sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/lib/ruby_gem_stub/version.rb
|
1198
1203
|
- sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/ruby_gem_stub.gemspec
|
1199
1204
|
- sub/avm/spec/lib/avm/launcher/instances/base_spec_files/settings.yaml
|
1205
|
+
- sub/avm/spec/lib/avm/scms/auto_commit/file_resource_name_spec.rb
|
1200
1206
|
- sub/avm/spec/lib/avm/scms/base_spec.rb
|
1201
1207
|
- sub/avm/spec/lib/avm/sources/base_spec.rb
|
1202
1208
|
- sub/avm/spec/lib/avm/sources/runner_spec.rb
|
@@ -1677,11 +1683,11 @@ files:
|
|
1677
1683
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/class_methods.rb
|
1678
1684
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/instance_methods.rb
|
1679
1685
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/integer_list.rb
|
1686
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/item.rb
|
1680
1687
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb
|
1681
1688
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/lists.rb
|
1682
1689
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/string_list.rb
|
1683
1690
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/symbol_list.rb
|
1684
|
-
- sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb
|
1685
1691
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb
|
1686
1692
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/locales.rb
|
1687
1693
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/locales/from_all_gems.rb
|
@@ -1738,6 +1744,7 @@ files:
|
|
1738
1744
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_pathname.rb
|
1739
1745
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/to_uri.rb
|
1740
1746
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname.rb
|
1747
|
+
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/assert_parent.rb
|
1741
1748
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_noext.rb
|
1742
1749
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb
|
1743
1750
|
- sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/if_exist.rb
|
@@ -1824,6 +1831,7 @@ files:
|
|
1824
1831
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb
|
1825
1832
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
|
1826
1833
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec_files/path/my_stub_with_template
|
1834
|
+
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/assert_parent_spec.rb
|
1827
1835
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_noext_spec.rb
|
1828
1836
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/basename_sub_spec.rb
|
1829
1837
|
- sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
|
@@ -1,23 +0,0 @@
|
|
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
|
@@ -1,24 +0,0 @@
|
|
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
|
@@ -1,20 +0,0 @@
|
|
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
|
@@ -1,28 +0,0 @@
|
|
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
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/git/auto_commit/commit_info'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Git
|
8
|
-
class FileAutoFixup
|
9
|
-
enable_speaker
|
10
|
-
enable_simple_cache
|
11
|
-
enable_listable
|
12
|
-
|
13
|
-
common_constructor :git, :path, :rules do
|
14
|
-
self.path = path.to_pathname.expand_path(git.root_path)
|
15
|
-
end
|
16
|
-
|
17
|
-
COMMITS_SEARCH_INTERVAL = 'origin/master..HEAD'
|
18
|
-
|
19
|
-
def git_relative_path
|
20
|
-
path.to_pathname.relative_path_from(git.root_path)
|
21
|
-
end
|
22
|
-
|
23
|
-
def run
|
24
|
-
start_banner
|
25
|
-
run_commit || warn("No rule returned commit information for \"#{path}\"")
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def commit_args
|
31
|
-
commit_info.if_present([], &:git_commit_args) + ['--', git_relative_path]
|
32
|
-
end
|
33
|
-
|
34
|
-
def commit_info_uncached
|
35
|
-
rules.lazy.map { |rule| rule.with_file(self).commit_info }.find(&:present?)
|
36
|
-
end
|
37
|
-
|
38
|
-
def start_banner
|
39
|
-
infov 'Path', path
|
40
|
-
infov ' Commits found', commits.count
|
41
|
-
end
|
42
|
-
|
43
|
-
def run_commit
|
44
|
-
return false if commit_info.blank?
|
45
|
-
|
46
|
-
infov ' Commit arguments', ::Shellwords.join(commit_args)
|
47
|
-
run_git_add_and_commit
|
48
|
-
success ' Commited'
|
49
|
-
true
|
50
|
-
end
|
51
|
-
|
52
|
-
def run_git_add_and_commit
|
53
|
-
git.execute!('reset', '--soft', 'HEAD')
|
54
|
-
if path.exist?
|
55
|
-
git.execute!('add', git_relative_path)
|
56
|
-
else
|
57
|
-
git.execute!('rm', '-f', git_relative_path)
|
58
|
-
end
|
59
|
-
git.execute!('commit', *commit_args)
|
60
|
-
end
|
61
|
-
|
62
|
-
def commits_uncached
|
63
|
-
git.execute!('log', '--pretty=format:%H', COMMITS_SEARCH_INTERVAL, '--', path)
|
64
|
-
.each_line.map { |sha1| ::Avm::Git::Commit.new(git, sha1.strip) }
|
65
|
-
.reject { |commit| commit.subject.start_with?('fixup!') }
|
66
|
-
.each_with_index.map { |commit, index| CommitDelegator.new(commit, index) }
|
67
|
-
end
|
68
|
-
|
69
|
-
class CommitDelegator < ::SimpleDelegator
|
70
|
-
attr_reader :index
|
71
|
-
|
72
|
-
def initialize(commit, index)
|
73
|
-
super(commit)
|
74
|
-
@index = index
|
75
|
-
end
|
76
|
-
|
77
|
-
def position
|
78
|
-
index + 1
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|