eac_git 0.12.3 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 748e8547b254bda18faae0b675f1a470c67226a146d4df97a6e6a6debadbaca3
4
- data.tar.gz: 4f1728d62f01dea84ce25b74a98724b44fac1e42a10961ff804a92c817f02139
3
+ metadata.gz: ab3d903a17794bf31cdfbacd18d66c6927f3877ce2214d3999ab7b895a5519b0
4
+ data.tar.gz: 595bb8279d843f7ba6f46cda285fd5144ac3740a82557c8baf2789ea9b19674b
5
5
  SHA512:
6
- metadata.gz: 59a339ea11b4c0eab4ae782bc4e5ff5d638f93bb73503e5c2d34e7c32542298848541eb7a7fedfea0dda64806655be75461fcdf6ea91f173a17a1a8680c6b0c1
7
- data.tar.gz: c534fdf799cfd8b166f5e3e043619179b6000568c6957aba8f13a7e72c0c663845bf4cda1f6052e2bf61b8f7c7a112626203d8aefd750b427542d40d9d76fbf3
6
+ metadata.gz: 29af9d3a7b4dd4d54b7e8dfba7dcf9f72411beb69291f83b29066194a632ebdbaaa1c73d32724e0476eca18e43a1e137abbce1e8e10256d13f7e57c1a0277ebd
7
+ data.tar.gz: cbeb8f4124a92407bb30bedf91acc77553b86859c6315e9e10eba72994e0f867e17764d79e2f3b0831dfbbada0e29d61c4d3a3ea43102fcf204c601bf34d2300
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_git/remote'
3
+ require 'eac_git/remote_like'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module EacGit
@@ -9,6 +9,7 @@ module EacGit
9
9
  NO_SUCH_REMOTE_CODE = 128
10
10
 
11
11
  enable_simple_cache
12
+ include ::EacGit::RemoteLike
12
13
 
13
14
  common_constructor :local, :name
14
15
 
@@ -16,12 +17,27 @@ module EacGit
16
17
  url
17
18
  end
18
19
 
20
+ # @return [EacRubyUtils::Envs::Command
21
+ def git_command(*args)
22
+ local.command(*args)
23
+ end
24
+
25
+ # @return [String]
26
+ def remote_reference
27
+ name
28
+ end
29
+
19
30
  # @return [String, nil]
20
31
  def url
21
32
  local.command('remote', 'get-url', name)
22
33
  .execute!(exit_outputs: { NO_SUCH_REMOTE_CODE => nil })
23
34
  .if_present(nil, &:strip)
24
35
  end
36
+
37
+ # @return [String]
38
+ def url=(new_url)
39
+ local.command('remote', 'set-url', name, new_url).execute!
40
+ end
25
41
  end
26
42
  end
27
43
  end
@@ -1,19 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_git/executables'
4
+ require 'eac_git/remote_like'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
6
7
  module EacGit
7
8
  # A Git remote repository referenced by URI.
8
9
  class Remote
9
- require_sub __FILE__
10
+ include ::EacGit::RemoteLike
10
11
 
11
12
  common_constructor :uri
12
13
 
13
- def ls
14
- ::EacGit::Remote::LsResult.by_ls_remote_command_output(
15
- ::EacGit::Executables.git.command('ls-remote', uri).execute!
16
- )
14
+ # @return [EacRubyUtils::Envs::Command
15
+ def git_command(*args, &block)
16
+ ::EacGit::Executables.git.command(*args, &block)
17
+ end
18
+
19
+ # @return [String]
20
+ def remote_reference
21
+ uri
17
22
  end
18
23
  end
19
24
  end
@@ -3,7 +3,7 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module EacGit
6
- class Remote
6
+ module RemoteLike
7
7
  class LsResult
8
8
  class << self
9
9
  def by_ls_remote_command_output(output)
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacGit
6
+ module RemoteLike
7
+ require_sub __FILE__
8
+ enable_abstract_methods
9
+
10
+ # @return [String] The output of command "git fetch".
11
+ def fetch
12
+ local.command('fetch', name).execute!
13
+ end
14
+
15
+ # @return [EacRubyUtils::Envs::Command
16
+ def git_command(*_args)
17
+ raise_abstract_method __method__
18
+ end
19
+
20
+ # @return [EacGit::RemoteLike::LsResult]
21
+ def ls
22
+ ::EacGit::RemoteLike::LsResult.by_ls_remote_command_output(
23
+ git_command('ls-remote', remote_reference).execute!
24
+ )
25
+ end
26
+
27
+ # @return [String]
28
+ def remote_reference
29
+ raise_abstract_method __method__
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.12.3'
4
+ VERSION = '0.14.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.12.3
4
+ version: 0.14.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: 2022-09-30 00:00:00.000000000 Z
11
+ date: 2022-11-09 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.103'
19
+ version: '0.107'
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.103'
26
+ version: '0.107'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: parseconfig
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +99,8 @@ files:
99
99
  - lib/eac_git/local/subrepo.rb
100
100
  - lib/eac_git/local/subrepo/config.rb
101
101
  - lib/eac_git/remote.rb
102
- - lib/eac_git/remote/ls_result.rb
102
+ - lib/eac_git/remote_like.rb
103
+ - lib/eac_git/remote_like/ls_result.rb
103
104
  - lib/eac_git/rspec.rb
104
105
  - lib/eac_git/rspec/setup.rb
105
106
  - lib/eac_git/rspec/stubbed_git_local_repo.rb