eac_git 0.20.0 → 0.22.1

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: cf1c794aae2ec2cefc1bcfd8be3f4d6df58ec845764f1bb36f8a8b309627b9af
4
- data.tar.gz: 4cd65e068822c2de3bb7e520f5b1aba5785468e4e008659c6ac4edbcc8502caa
3
+ metadata.gz: bf4272006fb184bc833ba0a393c6f53bd54b9c0b8faf508dfc314aba47255217
4
+ data.tar.gz: ec4af90358dd5b79502db4054022f55cc38a68cb1e4262e56287351a9dac2ea7
5
5
  SHA512:
6
- metadata.gz: e20b2c800f816fa587e4563debd2cb89d4639c82ee6b9ddf792a4011b7b0f069fafe61755fd5487b251206f1e2fc87e1f50240ffc7349e390369a4ba2c39de67
7
- data.tar.gz: 70a3986881972199f22550a453b271267e23f352b13b3cc09dfe317cfdbee842461e0d7add6c4908488c7975591deab381b3c9e412d447cbd39cf500b0cdf144
6
+ metadata.gz: c99d1ecba28badb204831466c23cb214adf38537c2373c364a9ed53e2647ded18149dda118e07bcf191f2e0c2ea744f4e629d8c538934af2ea4fa02e3675fe6b
7
+ data.tar.gz: 26b2e4ee6b2e449cc3ace713685af90b3202bf2031adaf7d00c9fc5060e5a9b52e62b90ae7c82eadb41b8296ba982cb18fc11efbd795077abd313f1c0c821b7e
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacGit
4
+ module Executables
5
+ module GitCommandExtensions
6
+ def command(*args)
7
+ super.envvar('PATH', path_with_git_subrepo)
8
+ end
9
+
10
+ def gem_root
11
+ '../..'.to_pathname.expand_path(__dir__)
12
+ end
13
+
14
+ def git_subrepo_root
15
+ gem_root.join('vendor', 'git-subrepo')
16
+ end
17
+
18
+ def path_with_git_subrepo
19
+ ([git_subrepo_root.join('lib').to_path] +
20
+ ENV['PATH'].if_present('').split(::File::PATH_SEPARATOR))
21
+ .join(::File::PATH_SEPARATOR)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -3,43 +3,21 @@
3
3
  module EacGit
4
4
  module Executables
5
5
  class << self
6
- include ::EacRubyUtils::SimpleCache
6
+ enable_memoized
7
7
 
8
8
  def env
9
9
  ::EacRubyUtils::Envs.local
10
10
  end
11
11
 
12
- private
13
-
14
- def git_uncached
12
+ memoize def git
15
13
  r = env.executable('git', '--version')
16
- r.extend(GitCommandExtensions)
14
+ r.extend(::EacGit::Executables::GitCommandExtensions)
17
15
  r
18
16
  end
19
17
 
20
- def tar_uncached
18
+ memoize def tar
21
19
  env.executable('tar', '--version')
22
20
  end
23
-
24
- module GitCommandExtensions
25
- def command(*args)
26
- super.envvar('PATH', path_with_git_subrepo)
27
- end
28
-
29
- def gem_root
30
- '../..'.to_pathname.expand_path(__dir__)
31
- end
32
-
33
- def git_subrepo_root
34
- gem_root.join('vendor', 'git-subrepo')
35
- end
36
-
37
- def path_with_git_subrepo
38
- ([git_subrepo_root.join('lib').to_path] +
39
- ENV['PATH'].if_present('').split(::File::PATH_SEPARATOR))
40
- .join(::File::PATH_SEPARATOR)
41
- end
42
- end
43
21
  end
44
22
  end
45
23
  end
@@ -4,7 +4,7 @@ module EacGit
4
4
  class Local
5
5
  class Commit
6
6
  class ChangedFile
7
- enable_simple_cache
7
+ enable_memoized
8
8
 
9
9
  attr_reader :commit, :diff_tree
10
10
 
@@ -22,11 +22,11 @@ module EacGit
22
22
  "#{path}|#{status}"
23
23
  end
24
24
 
25
- def src_size_uncached
25
+ memoize def src_size
26
26
  size(src_sha1)
27
27
  end
28
28
 
29
- def dst_size_uncached
29
+ memoize def dst_size
30
30
  size(dst_sha1)
31
31
  end
32
32
 
@@ -4,7 +4,7 @@ module EacGit
4
4
  class Local
5
5
  class Commit
6
6
  require_sub __FILE__, include_modules: true
7
- enable_simple_cache
7
+ enable_memoized
8
8
  include ::Comparable
9
9
 
10
10
  FIELDS = {
@@ -31,13 +31,13 @@ module EacGit
31
31
  define_method(field) { format(format) }
32
32
  end
33
33
 
34
- def changed_files_uncached
34
+ memoize def changed_files
35
35
  diff_tree_execute.each_line.map do |line|
36
36
  ::EacGit::Local::Commit::ChangedFile.new(self, line)
37
37
  end
38
38
  end
39
39
 
40
- def changed_files_size_uncached
40
+ memoize def changed_files_size
41
41
  changed_files.inject(0) { |a, e| a + e.dst_size }
42
42
  end
43
43
 
@@ -5,7 +5,6 @@ module EacGit
5
5
  class Remote
6
6
  NO_SUCH_REMOTE_CODE = 512
7
7
 
8
- enable_simple_cache
9
8
  include ::EacGit::RemoteLike
10
9
 
11
10
  common_constructor :local, :name
@@ -5,10 +5,18 @@ module EacGit
5
5
  # A git-subrepo (https://github.com/ingydotnet/git-subrepo) in a [EacGit::Local].
6
6
  class Subrepo
7
7
  require_sub __FILE__
8
- enable_simple_cache
8
+ enable_memoized
9
+
10
+ class << self
11
+ # @param subpath [Pathname, String]
12
+ # @return [String]
13
+ def sanitize_subpath(subpath)
14
+ subpath.to_pathname.to_path.gsub(%r{/+$}, '').to_pathname
15
+ end
16
+ end
9
17
 
10
18
  common_constructor :local, :subpath do
11
- self.subpath = subpath.to_pathname
19
+ self.subpath = self.class.sanitize_subpath(subpath)
12
20
  local.raise_error "Config file \"#{config_absolute_path}\" not found" unless
13
21
  config_absolute_path.file?
14
22
  end
@@ -18,27 +26,25 @@ module EacGit
18
26
  *subrepo_subcommand_args)
19
27
  end
20
28
 
21
- delegate(*::EacGit::Local::Subrepo::Config::MAPPING.keys, to: :config)
29
+ delegate(*::EacGit::Subrepo::Configuration::MAPPING.keys, to: :config)
22
30
 
23
31
  def write_config
24
32
  config_absolute_path.write(config.to_content)
25
33
  end
26
34
 
27
- private
28
-
29
- def config_uncached
30
- ::EacGit::Local::Subrepo::Config.from_file(config_absolute_path)
35
+ memoize def config
36
+ ::EacGit::Subrepo::Configuration.from_file(config_absolute_path)
31
37
  end
32
38
 
33
- def config_absolute_path_uncached
39
+ memoize def config_absolute_path
34
40
  config_relative_path.expand_path(local.root_path)
35
41
  end
36
42
 
37
- def config_relative_path_uncached
43
+ memoize def config_relative_path
38
44
  subpath.join('.gitrepo')
39
45
  end
40
46
 
41
- def remote_uncached
47
+ memoize def remote
42
48
  ::EacGit::Remote.new(remote_uri)
43
49
  end
44
50
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'parseconfig'
4
+
5
+ module EacGit
6
+ module Subrepo
7
+ class Configuration
8
+ MAPPING = {
9
+ command_version: :cmdver, commit_id: :commit, join_method: :method,
10
+ parent_commit_id: :parent, remote_branch: :branch, remote_uri: :remote
11
+ }.freeze
12
+
13
+ class << self
14
+ def from_file(file_path)
15
+ new(
16
+ ::ParseConfig.new(file_path.to_pathname)['subrepo']
17
+ )
18
+ end
19
+ end
20
+
21
+ common_constructor :values do
22
+ self.values = values.with_indifferent_access
23
+ end
24
+
25
+ MAPPING.each_key do |method_name|
26
+ define_method(method_name) do
27
+ values[MAPPING.fetch(method_name)]
28
+ end
29
+
30
+ define_method("#{method_name}=") do |value|
31
+ values[MAPPING.fetch(method_name)] = value
32
+ end
33
+ end
34
+
35
+ def to_content
36
+ "[subrepo]\n" + MAPPING.map { |k, v| " #{v} = #{send(k)}\n" }.join # rubocop:disable Style/StringConcatenation
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.20.0'
4
+ VERSION = '0.22.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.22.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-05-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: eac_ruby_utils
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0.131'
18
+ version: '0.134'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0.131'
25
+ version: '0.134'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: parseconfig
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -50,22 +49,21 @@ dependencies:
50
49
  requirements:
51
50
  - - "~>"
52
51
  - !ruby/object:Gem::Version
53
- version: '0.13'
52
+ version: '0.15'
54
53
  type: :development
55
54
  prerelease: false
56
55
  version_requirements: !ruby/object:Gem::Requirement
57
56
  requirements:
58
57
  - - "~>"
59
58
  - !ruby/object:Gem::Version
60
- version: '0.13'
61
- description:
62
- email:
59
+ version: '0.15'
63
60
  executables: []
64
61
  extensions: []
65
62
  extra_rdoc_files: []
66
63
  files:
67
64
  - lib/eac_git.rb
68
65
  - lib/eac_git/executables.rb
66
+ - lib/eac_git/executables/git_command_extensions.rb
69
67
  - lib/eac_git/local.rb
70
68
  - lib/eac_git/local/branch.rb
71
69
  - lib/eac_git/local/changed_file.rb
@@ -79,7 +77,6 @@ files:
79
77
  - lib/eac_git/local/remote/push.rb
80
78
  - lib/eac_git/local/remotes.rb
81
79
  - lib/eac_git/local/subrepo.rb
82
- - lib/eac_git/local/subrepo/config.rb
83
80
  - lib/eac_git/remote.rb
84
81
  - lib/eac_git/remote_like.rb
85
82
  - lib/eac_git/remote_like/ls_result.rb
@@ -90,6 +87,7 @@ files:
90
87
  - lib/eac_git/rspec/stubbed_git_local_repo/file.rb
91
88
  - lib/eac_git/rspec/stubbed_git_local_repo/fs_object.rb
92
89
  - lib/eac_git/rspec/stubbed_git_local_repo/repository.rb
90
+ - lib/eac_git/subrepo/configuration.rb
93
91
  - lib/eac_git/version.rb
94
92
  - vendor/git-subrepo/.fish.rc
95
93
  - vendor/git-subrepo/.gitattributes
@@ -302,10 +300,8 @@ files:
302
300
  - vendor/git-subrepo/test/status.t
303
301
  - vendor/git-subrepo/test/submodule.t
304
302
  - vendor/git-subrepo/test/zsh.t
305
- homepage:
306
303
  licenses: []
307
304
  metadata: {}
308
- post_install_message:
309
305
  rdoc_options: []
310
306
  require_paths:
311
307
  - lib
@@ -320,8 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
316
  - !ruby/object:Gem::Version
321
317
  version: '0'
322
318
  requirements: []
323
- rubygems_version: 3.4.19
324
- signing_key:
319
+ rubygems_version: 3.6.9
325
320
  specification_version: 4
326
321
  summary: Put here de description.
327
322
  test_files: []
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'parseconfig'
4
-
5
- module EacGit
6
- class Local
7
- class Subrepo
8
- class Config
9
- MAPPING = {
10
- command_version: :cmdver, commit_id: :commit, join_method: :method,
11
- parent_commit_id: :parent, remote_branch: :branch, remote_uri: :remote
12
- }.freeze
13
-
14
- class << self
15
- def from_file(file_path)
16
- new(
17
- ::ParseConfig.new(file_path.to_pathname)['subrepo']
18
- )
19
- end
20
- end
21
-
22
- common_constructor :values do
23
- self.values = values.with_indifferent_access
24
- end
25
-
26
- MAPPING.each_key do |method_name|
27
- define_method(method_name) do
28
- values[MAPPING.fetch(method_name)]
29
- end
30
-
31
- define_method("#{method_name}=") do |value|
32
- values[MAPPING.fetch(method_name)] = value
33
- end
34
- end
35
-
36
- def to_content
37
- "[subrepo]\n" + MAPPING.map { |k, v| " #{v} = #{send(k)}\n" }.join # rubocop:disable Style/StringConcatenation
38
- end
39
- end
40
- end
41
- end
42
- end