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
@@ -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
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Scms
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.58.0'
4
+ VERSION = '0.60.0'
5
5
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/file_formats/base'
4
+
5
+ ::RSpec.describe ::Avm::FileFormats::Base do
6
+ include_examples 'avm_file_format_file_resource_name', {
7
+ 'app/models/mynamespace/the_class.rb' => 'app/models/mynamespace/the_class.rb',
8
+ 'lib/ruby/lib/cliutils/eac_redmine_base0/activity.rb' =>
9
+ 'lib/ruby/lib/cliutils/eac_redmine_base0/activity.rb'
10
+ }
11
+ end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/git/auto_commit_path'
3
+ require 'avm/scms/auto_commit/file_resource_name'
4
4
 
5
- RSpec.describe ::Avm::Git::AutoCommitPath, git: true do
5
+ RSpec.describe ::Avm::Scms::AutoCommit::FileResourceName, git: true do
6
6
  let(:git) { stubbed_git_local_repo }
7
7
 
8
8
  describe '#class_name' do
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.57'
15
+ s.add_dependency 'avm', '~> 0.60'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.8'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.109'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.110', '>= 0.110.1'
18
18
 
19
19
  s.add_development_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.1'
20
20
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_generic_base0/file_formats/base'
4
+ require 'avm/eac_ruby_base1/rubocop'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ module FileFormats
9
+ class Base < ::Avm::EacGenericBase0::FileFormats::Base
10
+ class FileResourceName
11
+ enable_method_class
12
+ common_constructor :file_format, :path do
13
+ self.path = path.to_pathname
14
+ end
15
+
16
+ LIBRARY_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z},
17
+ %r{app/[^/]+/(.+)\.rb\z}].freeze
18
+ SPEC_PATTERNS = [%r{spec/[^/]+/(.+)_spec\.rb\z}].freeze
19
+
20
+ # @param path [Pathname]
21
+ # @return [Avm::FileFormats::FileWith]
22
+ def result
23
+ result_from_spec || result_from_library || result_from_superclass
24
+ end
25
+
26
+ private
27
+
28
+ def result_from_library
29
+ result_from_patterns(LIBRARY_PATTERNS) { |m| m[1].camelize }
30
+ end
31
+
32
+ def result_from_patterns(patterns)
33
+ patterns.lazy.map { |pattern| pattern.to_parser.parse(path.to_path) }
34
+ .find(&:present?).if_present { |v| yield(v) }
35
+ end
36
+
37
+ def result_from_spec
38
+ result_from_patterns(SPEC_PATTERNS) { |m| "RSpec.describe('#{m[1].camelize}')" }
39
+ end
40
+
41
+ def result_from_superclass
42
+ file_format.class.superclass.instance_method(:file_resource_name)
43
+ .bind_call(file_format, path)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -7,6 +7,8 @@ module Avm
7
7
  module EacRubyBase1
8
8
  module FileFormats
9
9
  class Base < ::Avm::EacGenericBase0::FileFormats::Base
10
+ require_sub __FILE__
11
+
10
12
  VALID_BASENAMES = %w[*.gemspec *.rake *.rb Gemfile Rakefile].freeze
11
13
  VALID_TYPES = ['x-ruby'].freeze
12
14
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.27.3'
5
+ VERSION = '0.28.0'
6
6
  end
7
7
  end
@@ -4,4 +4,12 @@ require 'avm/eac_ruby_base1/file_formats/base'
4
4
 
5
5
  ::RSpec.describe ::Avm::EacRubyBase1::FileFormats::Base do
6
6
  include_examples 'avm_file_formats_with_fixtures', __FILE__
7
+ include_examples 'avm_file_format_file_resource_name', {
8
+ 'app/models/mynamespace/the_class.rb' => 'Mynamespace::TheClass',
9
+ 'lib/ruby/lib/cliutils/eac_redmine_base0/activity.rb' => 'Cliutils::EacRedmineBase0::Activity',
10
+ 'a_non_library_file.rb' => 'a_non_library_file.rb',
11
+ 'spec/lib/my_lib_spec.rb' => 'RSpec.describe(\'MyLib\')',
12
+ 'spec/lib/sub/my_lib_spec.rb' => 'RSpec.describe(\'Sub::MyLib\')',
13
+ 'spec/spec_helper.rb' => 'spec/spec_helper.rb'
14
+ }
7
15
  end
@@ -12,11 +12,11 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.57'
15
+ s.add_dependency 'avm', '~> 0.59'
16
16
  s.add_dependency 'avm-files', '~> 0.6'
17
17
  s.add_dependency 'eac_git', '~> 0.14'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.108'
19
- s.add_dependency 'git', '~> 1.12'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.110', '>= 0.110.1'
19
+ s.add_dependency 'git', '~> 1.13'
20
20
 
21
21
  s.add_development_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
22
22
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/changed_file'
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 ChangedFile < ::Avm::Scms::ChangedFile
11
+ common_constructor :scm, :path
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/scms/git/changed_file'
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 ChangedFiles
11
+ enable_method_class
12
+ common_constructor :scm
13
+
14
+ # @return [Avm::Git::Scms::Git::ChangedFile]
15
+ def result
16
+ scm.git_repo.dirty_files.map do |dirty_file|
17
+ ::Avm::Git::Scms::Git::ChangedFile.new(scm, dirty_file.path)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -15,11 +15,18 @@ module Avm
15
15
  delegate :git_repo, to: :git_scm
16
16
  delegate :id, to: :git_commit
17
17
 
18
+ FIXUP_SUBJECT_PATTERN = /\Afixup\!/.freeze
19
+
18
20
  # @return [Array<Pathname>]
19
21
  def changed_files
20
22
  git_commit.changed_files.map { |cf| cf.path.to_pathname }
21
23
  end
22
24
 
25
+ # @return [Boolean]
26
+ def fixup?
27
+ FIXUP_SUBJECT_PATTERN.match?(git_commit.subject)
28
+ end
29
+
23
30
  # @param other [Avm::Git::Scms::Git::Commit]
24
31
  # @return [Avm::Git::Scms::Git::Commit]
25
32
  def merge_with(other)
@@ -43,6 +50,9 @@ module Avm
43
50
  %w[.gitrepo .gitmodules].any? { |file| file.include?(path.basename.to_path) }
44
51
  end
45
52
 
53
+ # @return [String]
54
+ delegate :subject, to: :git_commit
55
+
46
56
  private
47
57
 
48
58
  def validate_clean_and_head
@@ -0,0 +1,57 @@
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
+ module Commits
11
+ # @return [Avm::Git::Scms::Git::Commit,nil]
12
+ def commit(source)
13
+ if source.is_a?(::Avm::Git::Scms::Git::Commit)
14
+ return source if source.git_repo == git_repo
15
+
16
+ raise 'Not same Git repository'
17
+ end
18
+ git_repo.commitize(source).if_present do |v|
19
+ ::Avm::Git::Scms::Git::Commit.new(self, v)
20
+ end
21
+ end
22
+
23
+ # @return [Avm::Git::Scms::Git::Commit,nil]
24
+ def commit_dirty(message = nil)
25
+ return nil unless git_repo.dirty?
26
+
27
+ git_repo.command('add', '.').execute!
28
+ git_repo.command(
29
+ 'commit', '-m',
30
+ message.call_if_proc.if_present(COMMIT_DIRTY_DEFAULT_MESSAGE)
31
+ ).execute!
32
+ head_commit
33
+ end
34
+
35
+ # @return [Avm::Git::Scms::Git::Commit,nil]
36
+ def commit_if_change(message = nil)
37
+ tracker = ::Avm::Git::Scms::Git::ChangeTracker.new(self, message)
38
+ tracker.start
39
+ yield
40
+ tracker.stop
41
+ end
42
+
43
+ # @return [Avm::Git::Scms::Git::Commit]
44
+ def head_commit
45
+ commit(git_repo.head)
46
+ end
47
+
48
+ # @return [Avm::Git::Scms::Git::Commit]
49
+ def reset_and_commit(commit_to_reset, message)
50
+ git_repo.command('reset', '--soft', commit(commit_to_reset).git_commit.id).execute!
51
+ commit_dirty(message)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/interval'
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 Interval < ::Avm::Scms::Interval
11
+ def initialize(scm, from, to)
12
+ super(scm, from, to)
13
+ self.from = scm.commit(from)
14
+ self.to = scm.commit(to)
15
+ end
16
+
17
+ # @return [Array<Avm::Git::Scms::Git::Commit>]
18
+ def commits
19
+ scm.git_repo.command('log', '--pretty=format:%H', git_commit_interval).execute!
20
+ .each_line.map { |sha1| scm.commit(sha1.strip) }
21
+ end
22
+
23
+ # @return [String]
24
+ def git_commit_interval
25
+ [from.id, to.id].join('..')
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/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
+ module Milestones
11
+ BASE_COMMIT_REFERENCE = 'origin/master'
12
+
13
+ # @return [Avm::Git::Scms::Git::Commit]
14
+ def current_milestone_base_commit
15
+ commit(BASE_COMMIT_REFERENCE)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,57 @@
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 RunCommit
11
+ enable_method_class
12
+
13
+ common_constructor :scm, :commit_info
14
+
15
+ # @return [Avm::Git::Scms::Git::Commit]
16
+ def result
17
+ reset
18
+ add_paths
19
+ commit
20
+
21
+ scm.head_commit
22
+ end
23
+
24
+ protected
25
+
26
+ def add_path(path)
27
+ scm.git_repo.command(
28
+ *(path.exist? ? ['add'] : ['rm', '-f']),
29
+ path.relative_path_from(scm.path)
30
+ ).execute!
31
+ end
32
+
33
+ def add_paths
34
+ commit_info.paths.each { |path| add_path(path) }
35
+ end
36
+
37
+ def commit
38
+ scm.git_repo.command('commit', *commit_args).execute!
39
+ end
40
+
41
+ # @return [Array<String>]
42
+ def commit_args
43
+ r = commit_info.fixup.if_present([]) { |v| ['--fixup', v.id] }
44
+ r += commit_info.message.if_present([]) { |v| ['--message', v] }
45
+ return r if r.any?
46
+
47
+ raise 'Argument list is empty'
48
+ end
49
+
50
+ def reset
51
+ scm.git_repo.command('reset', '--soft', 'HEAD').execute!
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -8,7 +8,7 @@ module Avm
8
8
  module Git
9
9
  module Scms
10
10
  class Git < ::Avm::Scms::Base
11
- require_sub __FILE__
11
+ require_sub __FILE__, include_modules: true
12
12
  include ::Comparable
13
13
 
14
14
  COMMIT_DIRTY_DEFAULT_MESSAGE = 'Dirty files.'
@@ -17,44 +17,15 @@ module Avm
17
17
  git_repo <=> other.git_repo
18
18
  end
19
19
 
20
- # @return [Avm::Git::Scms::Git::Commit,nil]
21
- def commit(source)
22
- if source.is_a?(::Avm::Git::Scms::Git::Commit)
23
- return source if source.git_repo == self
24
-
25
- raise 'Not same Git repository'
26
- end
27
- git_repo.commitize(source).if_present do |v|
28
- ::Avm::Git::Scms::Git::Commit.new(self, v)
29
- end
30
- end
31
-
32
- # @return [Avm::Git::Scms::Git::Commit,nil]
33
- def commit_dirty(message = nil)
34
- return nil unless git_repo.dirty?
35
-
36
- git_repo.command('add', '.').execute!
37
- git_repo.command('commit', '-m',
38
- message.call_if_proc.if_present(COMMIT_DIRTY_DEFAULT_MESSAGE)).execute!
39
- commit(git_repo.head)
40
- end
41
-
42
- # @return [Avm::Git::Scms::Git::Commit,nil]
43
- def commit_if_change(message = nil)
44
- tracker = ::Avm::Git::Scms::Git::ChangeTracker.new(self, message)
45
- tracker.start
46
- yield
47
- tracker.stop
48
- end
49
-
50
20
  def git_repo
51
21
  @git_repo ||= ::EacGit::Local.new(path)
52
22
  end
53
23
 
54
- # @return [Avm::Git::Scms::Git::Commit]
55
- def reset_and_commit(commit_to_reset, message)
56
- git_repo.command('reset', '--soft', commit(commit_to_reset).git_commit.id).execute!
57
- commit_dirty(message)
24
+ # @param from [Avm::Git::Scms::Git::Commit]
25
+ # @param to [Avm::Git::Scms::Git::Commit]
26
+ # @return [Avm::Git::Scms::Git::Interval]
27
+ def interval(from, to)
28
+ ::Avm::Git::Scms::Git::Interval.new(self, from, to)
58
29
  end
59
30
 
60
31
  # @return [Enumerable<Avm::Git::Scms::GitSubrepo>]
@@ -8,7 +8,8 @@ module Avm
8
8
  module Git
9
9
  module Scms
10
10
  class GitSubrepo < ::Avm::Scms::Base
11
- delegate :commit_if_change, to: :parent_scm
11
+ delegate :changed_files, :commit_if_change, :current_milestone_base_commit, :interval,
12
+ :head_commit, :run_commit, to: :parent_scm
12
13
 
13
14
  def update
14
15
  git_subrepo.command('clean').execute!
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.10.1'
5
+ VERSION = '0.11.0'
6
6
  end
7
7
  end
@@ -15,11 +15,11 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
17
  s.add_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.4'
18
- s.add_dependency 'avm', '~> 0.57'
18
+ s.add_dependency 'avm', '~> 0.59'
19
19
  s.add_dependency 'avm-eac_ruby_base1', '~> 0.27', '>= 0.27.3'
20
20
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4'
21
21
  s.add_dependency 'avm-files', '~> 0.6'
22
- s.add_dependency 'avm-git', '~> 0.10', '>= 0.10.1'
22
+ s.add_dependency 'avm-git', '~> 0.11'
23
23
  s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
24
24
  s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
25
25
  s.add_dependency 'eac_git', '~> 0.14'
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/tools/core_ext'
4
- require 'avm/git/auto_commit/rules/unique'
5
- require 'avm/git/file_auto_fixup'
4
+ require 'avm/git/scms/git'
6
5
  require 'avm/git/subrepo_checks'
6
+ require 'avm/scms/auto_commit/rules/unique'
7
+ require 'avm/scms/auto_commit/for_file'
7
8
  require 'eac_git/local'
8
9
 
9
10
  module Avm
@@ -31,8 +32,10 @@ module Avm
31
32
  infov 'Dirty files', local_repos.dirty_files.count
32
33
  local_repos.dirty_files.each do |file|
33
34
  infov ' * Ammending', file.path
34
- ::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file.path,
35
- [::Avm::Git::AutoCommit::Rules::Unique.new]).run
35
+ ::Avm::Scms::AutoCommit::ForFile.new(
36
+ git_scm, file.path,
37
+ [::Avm::Scms::AutoCommit::Rules::Unique.new]
38
+ ).run
36
39
  end
37
40
  end
38
41
 
@@ -43,6 +46,11 @@ module Avm
43
46
  !c.result.error?
44
47
  end
45
48
 
49
+ # @return [Avm::Git::Scms::Git]
50
+ def git_scm_uncached
51
+ ::Avm::Git::Scms::Git.new(runner_context.call(:git).root_path)
52
+ end
53
+
46
54
  def new_check(fix_parent = false)
47
55
  r = ::Avm::Git::SubrepoChecks.new(local_repos).add_all_subrepos
48
56
  r.fix_parent = fix_parent
@@ -2,13 +2,13 @@
2
2
 
3
3
  require 'eac_cli/core_ext'
4
4
  require 'avm/file_formats/search_formatter'
5
- require 'avm/git/file_auto_fixup'
6
- require 'avm/git/auto_commit/rules'
5
+ require 'avm/scms/auto_commit/for_file'
6
+ require 'avm/scms/auto_commit/rules'
7
7
 
8
8
  module Avm
9
9
  module Tools
10
10
  class Runner
11
- class Git
11
+ class Source < ::Avm::Sources::Runner
12
12
  class AutoCommit
13
13
  runner_with :help do
14
14
  desc 'Auto fixup files.'
@@ -19,13 +19,18 @@ module Avm
19
19
  end
20
20
 
21
21
  def run
22
- runner_context.call(:git).command('reset', 'HEAD').system!
23
22
  format_files
24
23
  files.each do |file|
25
- ::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file, rules).run
24
+ ::Avm::Scms::AutoCommit::ForFile.new(runner_context.call(:source).scm, file, rules)
25
+ .run
26
26
  end
27
27
  end
28
28
 
29
+ def help_extra_text
30
+ "Rules\n" + ::Avm::Scms::AutoCommit::Rules.all
31
+ .map { |r| ' ' + r.keys.join(', ') + "\n" }.join
32
+ end
33
+
29
34
  private
30
35
 
31
36
  def files_uncached
@@ -48,14 +53,12 @@ module Avm
48
53
  def dirty_files
49
54
  return [] unless parsed.dirty?
50
55
 
51
- runner_context.call(:git).dirty_files.map do |file|
52
- file.path.to_pathname.expand_path(runner_context.call(:git).root_path)
53
- end
56
+ runner_context.call(:source).scm.changed_files.map(&:absolute_path)
54
57
  end
55
58
 
56
59
  def rules
57
60
  parsed.rule.map do |rule_string|
58
- ::Avm::Git::AutoCommit::Rules.parse(rule_string)
61
+ ::Avm::Scms::AutoCommit::Rules.parse(rule_string)
59
62
  end
60
63
  end
61
64
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.142.8'
5
+ VERSION = '0.143.0'
6
6
  end
7
7
  end