eac_git 0.18.2 → 0.19.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: 97abca2bae305c62a10830e563e640d9b9373fcb05af38b5e0c7ccd31fdb9158
4
- data.tar.gz: 39ceeb6a1df4e4c03dda2207418d65b34c09f268a297bf250aa3bb8e8407e41f
3
+ metadata.gz: '092b52ceaea2db09c3c8f5b6292b860f87a775cd818462718b6789e74b209ba1'
4
+ data.tar.gz: c871c89726e686ed404cf72fb7e188aa73ac97c724d3c9bc3626db2ddd4dd808
5
5
  SHA512:
6
- metadata.gz: 7a388edee6bb00a8e2fe9a6e110bbb4ab59eb23927192080c57ad587346bab65ed62b8dc7391e52ee44c71e8f48f7fcf6fea611fd3a77701bed464d657cdd38c
7
- data.tar.gz: 00b092015373876a2617953681e0ae32da4cc25f19a673a56d4b43e08617eae07fb1abeb1b5dc09ff0a41c60ecbcc579ee23dc6b560093c65045c98d73afb18d
6
+ metadata.gz: c7e0ba1a5ebad04b8dccd20d01aa3a5f490554f170652fffdea8bdfbb980106fcd946cefc9b95c08595f643541c9db9ee948625998a848846f63b97f84311a76
7
+ data.tar.gz: c18f5abbbdf68cf5718c77aad368d2afa99888a550f5f8350f8de7cd022674363f5831ecd7c2f0e15cce1a3c8a5dcf33c4000f22297269d044652acbdf9d1010
@@ -3,8 +3,8 @@
3
3
  module EacGit
4
4
  class Local
5
5
  class ChangedFile
6
- QUOTED_PATH_PATTERN = /\A"(.+)"\z/.freeze
7
- STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
6
+ QUOTED_PATH_PATTERN = /\A"(.+)"\z/
7
+ STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/
8
8
  TO_HASH_ATTRIBUTES = %i[absolute_path index path worktree].freeze
9
9
 
10
10
  class << self
@@ -4,7 +4,7 @@ module EacGit
4
4
  class Local
5
5
  class Commit
6
6
  class DiffTreeLine
7
- DIFF_TREE_PATTERN = /\A:(\d{6}) (\d{6}) (\S+) (\S+) (\S+)\t(\S.*)\z/.freeze
7
+ DIFF_TREE_PATTERN = /\A:(\d{6}) (\d{6}) (\S+) (\S+) (\S+)\t(\S.*)\z/
8
8
  FIELDS = %w[src_mode dst_mode src_sha1 dst_sha1 status path].freeze
9
9
  GIT_COMMAND_ARGS = %w[-c core.quotepath=off diff-tree --no-commit-id -r --full-index].freeze
10
10
 
@@ -10,13 +10,19 @@ module EacGit
10
10
 
11
11
  common_constructor :local, :name
12
12
 
13
+ # @return [String]
14
+ def add(url)
15
+ local.command('remote', 'add', name, url).execute!
16
+ end
17
+
18
+ # @return [Boolean]
13
19
  def exist?
14
- url
20
+ url.present?
15
21
  end
16
22
 
17
23
  # @return [EacRubyUtils::Envs::Command
18
- def git_command(*args)
19
- local.command(*args)
24
+ def git_command(*)
25
+ local.command(*)
20
26
  end
21
27
 
22
28
  # @return [EacGit::Local::Remote::Push]
@@ -29,16 +35,36 @@ module EacGit
29
35
  name
30
36
  end
31
37
 
38
+ # @return [String]
39
+ def remove
40
+ local.command('remote', 'remove', name).execute!
41
+ end
42
+
32
43
  # @return [String, nil]
33
44
  def url
34
- local.command('remote', 'get-url', name)
35
- .execute!(exit_outputs: { NO_SUCH_REMOTE_CODE => nil })
36
- .if_present(nil, &:strip)
45
+ url_get(exit_outputs: { NO_SUCH_REMOTE_CODE => nil }).if_present(nil, &:strip)
37
46
  end
38
47
 
39
48
  # @return [String]
40
49
  def url=(new_url)
41
- local.command('remote', 'set-url', name, new_url).execute!
50
+ case [exist?, new_url.present?]
51
+ when [false, false] # do nothing
52
+ when [false, true] then add(new_url)
53
+ when [true, false] then remove
54
+ when [true, true] then url_set(new_url)
55
+ else ibr
56
+ end
57
+ end
58
+
59
+ # @return [String, nil]
60
+ def url_get(**)
61
+ local.command('remote', 'get-url', name).execute!(**)
62
+ end
63
+
64
+ # @param url [String]
65
+ # @return [String]
66
+ def url_set(url)
67
+ local.command('remote', 'set-url', name, url).execute!
42
68
  end
43
69
  end
44
70
  end
data/lib/eac_git/local.rb CHANGED
@@ -83,8 +83,8 @@ module EacGit
83
83
  refs.first
84
84
  end
85
85
 
86
- def command(*args)
87
- ::EacGit::Executables.git.command('-C', root_path.to_path, *args)
86
+ def command(*)
87
+ ::EacGit::Executables.git.command('-C', root_path.to_path, *)
88
88
  end
89
89
 
90
90
  def raise_error(message)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.18.2'
4
+ VERSION = '0.19.0'
5
5
  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.18.2
4
+ version: 0.19.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: 2026-05-02 00:00:00.000000000 Z
11
+ date: 2026-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_ruby_utils
@@ -50,20 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.12'
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.12.2
53
+ version: '0.13'
57
54
  type: :development
58
55
  prerelease: false
59
56
  version_requirements: !ruby/object:Gem::Requirement
60
57
  requirements:
61
58
  - - "~>"
62
59
  - !ruby/object:Gem::Version
63
- version: '0.12'
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 0.12.2
60
+ version: '0.13'
67
61
  description:
68
62
  email:
69
63
  executables: []
@@ -319,7 +313,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
319
313
  requirements:
320
314
  - - ">="
321
315
  - !ruby/object:Gem::Version
322
- version: '2.7'
316
+ version: '3.2'
323
317
  required_rubygems_version: !ruby/object:Gem::Requirement
324
318
  requirements:
325
319
  - - ">="