eac_git 0.16.0 → 0.18.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5801ee9f2b28bd73bd27e83254c1eaff5a473492c3f89dfe05b833f210fa42c3
4
- data.tar.gz: '0233988a062e873923b7f7d37a4a866f316d30f7589275a22afdf68c3047b0b7'
3
+ metadata.gz: b3daa829b6232f56446b82684a071ebcf939bd1e98307284a2c9b559b881a70b
4
+ data.tar.gz: 6ddd44efac225b1813761e4e4a4de0e7d3a4e3d2a8a45e386ee49a59ddd3c1e6
5
5
  SHA512:
6
- metadata.gz: cb54953f41934dca5f5bc3dfc119cf8197bfa04947376ba96cd06a8945fe9f43bf4eeba748dcd01a13c2dc98ccee6952a40e8e49cc688704468498dd93097b12
7
- data.tar.gz: 4d6663b3671b046883363d8a1712fc8029636a9a4cbfdbadc9f1de3367125c8949126aea6dab622ab87600f62a58fc7f6ae5aadf91754a90634cfe2f67d5db6c
6
+ metadata.gz: 5ff9b942f598fd22e0e7eec9de6ef7932ee78d069cba3e226e771c5430f2b0ddcc23d9716da160e6b172683d787d0765a062ac737052e1dde119a69bb4dc6ef0
7
+ data.tar.gz: 3312de1776a0e748bf271669e5a16fc4f2cd1c8d903530bb8715c8827d00629609600d11bfbfe44f2c14609a8b6956ffdbcbed24d18a6299147db7f1108b092d
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/envs'
5
-
6
3
  module EacGit
7
4
  module Executables
8
5
  class << self
@@ -26,7 +23,7 @@ module EacGit
26
23
 
27
24
  module GitCommandExtensions
28
25
  def command(*args)
29
- super(*args).envvar('PATH', path_with_git_subrepo)
26
+ super.envvar('PATH', path_with_git_subrepo)
30
27
  end
31
28
 
32
29
  def gem_root
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Branch
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacGit
4
+ class Local
5
+ class ChangedFile
6
+ QUOTED_PATH_PATTERN = /\A"(.+)"\z/.freeze
7
+ STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
8
+
9
+ class << self
10
+ def by_porcelain_v1_line(local_repo, line)
11
+ STATUS_LINE_PATTERN.match(line.gsub(/\n\z/, '')).then do |m|
12
+ new(local_repo, m[1], m[2], parse_status_line_path(m[3]).to_pathname)
13
+ end
14
+ end
15
+
16
+ # @param path [String]
17
+ # @return [String]
18
+ def parse_status_line_path(path)
19
+ m = QUOTED_PATH_PATTERN.match(path)
20
+ m ? m[1] : path
21
+ end
22
+ end
23
+
24
+ common_constructor :local_repo, :index, :worktree, :path
25
+
26
+ # @return [Pathname]
27
+ def absolute_path
28
+ path.expand_path(local_repo.root_path)
29
+ end
30
+
31
+ # @return [Boolean]
32
+ def add?
33
+ (index == '?' && worktree == '?') || (index == 'A' && worktree == ' ')
34
+ end
35
+
36
+ # @return [Boolean]
37
+ def delete?
38
+ [index, worktree].include?('D')
39
+ end
40
+
41
+ # @return [Boolean]
42
+ def modify?
43
+ [index, worktree].include?('M')
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Commit
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_git/local/commit/diff_tree_line'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  class Commit
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Commit
@@ -53,7 +51,7 @@ module EacGit
53
51
 
54
52
  # @return [Array<EacGit::Local::Commit>]
55
53
  def parents
56
- format('%P').each_line.map { |line| repo.commitize(line) }
54
+ format('%P').each_line.map { |line| repo.commitize(line) } # rubocop:disable Style/RedundantFormat
57
55
  end
58
56
 
59
57
  def root_child?
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
3
  require 'ostruct'
5
4
 
6
5
  module EacGit
7
6
  class Local
8
7
  module DirtyFiles
9
- QUOTED_PATH_PATTERN = /\A"(.+)"\z/.freeze
10
- STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
11
-
12
8
  def dirty?
13
9
  dirty_files.any?
14
10
  end
@@ -22,26 +18,8 @@ module EacGit
22
18
 
23
19
  def dirty_files
24
20
  command('status', '--porcelain=v1', '--untracked-files', '--no-renames')
25
- .execute!.each_line.map { |line| parse_status_line(line.gsub(/\n\z/, '')) }
26
- end
27
-
28
- private
29
-
30
- # @param line [String]
31
- # @return [Struct]
32
- def parse_status_line(line)
33
- STATUS_LINE_PATTERN.if_match(line) do |m|
34
- path = parse_status_line_path(m[3]).to_pathname
35
- { index: m[1], worktree: m[2], path: path, absolute_path: path.expand_path(root_path) }
36
- .to_struct
37
- end
38
- end
39
-
40
- # @param path [String]
41
- # @return [String]
42
- def parse_status_line_path(path)
43
- m = QUOTED_PATH_PATTERN.match(path)
44
- m ? m[1] : path
21
+ .execute!.each_line
22
+ .map { |line| ::EacGit::Local::ChangedFile.by_porcelain_v1_line(self, line) }
45
23
  end
46
24
  end
47
25
  end
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/remote'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  module Log
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  class Local
7
5
  class Remote
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/remote_like'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  class Remote
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'eac_git/local/remote'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  module Remotes
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
- require 'parseconfig'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  class Subrepo
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/remote'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module EacGit
7
4
  class Local
8
5
  # A git-subrepo (https://github.com/ingydotnet/git-subrepo) in a [EacGit::Local].
data/lib/eac_git/local.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/executables'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
3
  module EacGit
7
4
  # A Git repository in local filesystem.
8
5
  class Local
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/executables'
4
- require 'eac_git/remote_like'
5
- require 'eac_ruby_utils/core_ext'
6
-
7
3
  module EacGit
8
4
  # A Git remote repository referenced by URI.
9
5
  class Remote
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  module RemoteLike
7
5
  class LsResult
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  module RemoteLike
7
5
  require_sub __FILE__
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/executables'
4
- require 'eac_git/rspec/stubbed_git_local_repo'
5
-
6
3
  module EacGit
7
4
  module Rspec
8
5
  module Setup
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/rspec/stubbed_git_local_repo/fs_object'
4
3
  require 'fileutils'
5
4
 
6
5
  module EacGit
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/rspec/stubbed_git_local_repo/fs_object'
4
3
  require 'fileutils'
5
4
 
6
5
  module EacGit
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  module Rspec
7
5
  module StubbedGitLocalRepo
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/local'
4
- require 'eac_git/rspec/stubbed_git_local_repo/directory'
5
- require 'eac_git/rspec/stubbed_git_local_repo/file'
6
- require 'eac_ruby_utils/core_ext'
7
3
  require 'securerandom'
8
4
 
9
5
  module EacGit
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/envs'
4
3
  require 'tmpdir'
5
4
 
6
5
  module EacGit
data/lib/eac_git/rspec.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
4
-
5
3
  module EacGit
6
4
  module Rspec
7
5
  require_sub __FILE__
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.16.0'
4
+ VERSION = '0.18.0'
5
5
  end
data/lib/eac_git.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/core_ext'
3
+ require 'eac_ruby_utils'
4
+ EacRubyUtils::RootModuleSetup.perform __FILE__
5
+
6
+ require 'parseconfig'
4
7
 
5
8
  module EacGit
6
- require_sub __FILE__
7
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.18.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: 2024-02-18 00:00:00.000000000 Z
11
+ date: 2025-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_ruby_utils
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.121'
19
+ version: '0.128'
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.121'
26
+ version: '0.128'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: parseconfig
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.10'
53
+ version: '0.12'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.10'
60
+ version: '0.12'
61
61
  description:
62
62
  email:
63
63
  executables: []
@@ -68,6 +68,7 @@ files:
68
68
  - lib/eac_git/executables.rb
69
69
  - lib/eac_git/local.rb
70
70
  - lib/eac_git/local/branch.rb
71
+ - lib/eac_git/local/changed_file.rb
71
72
  - lib/eac_git/local/commit.rb
72
73
  - lib/eac_git/local/commit/archive.rb
73
74
  - lib/eac_git/local/commit/changed_file.rb