eac_git 0.15.0 → 0.16.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: 3fe4d94f7db9bca8bb4b528a63f88d5468814df46f29964ba93583f8f250356b
4
- data.tar.gz: a546176555f4ecc7b3a0ddac7d13ad6d69346158c3a834c4d8c255955de1a0a8
3
+ metadata.gz: 5801ee9f2b28bd73bd27e83254c1eaff5a473492c3f89dfe05b833f210fa42c3
4
+ data.tar.gz: '0233988a062e873923b7f7d37a4a866f316d30f7589275a22afdf68c3047b0b7'
5
5
  SHA512:
6
- metadata.gz: a2d29cfc5cc2bae11893f7abab005d796e309ff3572e4d44d708c0d45f71214deae8b256eb480b5c96c283d395d9c402f6614f2e83b6a42d4fd119b7aeaa6d7d
7
- data.tar.gz: 6d30cbad563fe641196afefb77602b96de464c736eea5cb295c8209e5fdc106f98bb594ac51be06ad971cfd51ec94b23da28ba3cbdd3b0e6730f07dad2df0a96
6
+ metadata.gz: cb54953f41934dca5f5bc3dfc119cf8197bfa04947376ba96cd06a8945fe9f43bf4eeba748dcd01a13c2dc98ccee6952a40e8e49cc688704468498dd93097b12
7
+ data.tar.gz: 4d6663b3671b046883363d8a1712fc8029636a9a4cbfdbadc9f1de3367125c8949126aea6dab622ab87600f62a58fc7f6ae5aadf91754a90634cfe2f67d5db6c
@@ -10,8 +10,9 @@ module EacGit
10
10
  common_constructor :local, :name
11
11
 
12
12
  # @return [String]
13
+ # @deprecated Use {#head_commit_id} instead.
13
14
  def current_commit_id
14
- local.rev_parse(full_ref_name, true)
15
+ head_commit_id
15
16
  end
16
17
 
17
18
  # @return [Boolean]
@@ -22,6 +23,25 @@ module EacGit
22
23
  def full_ref_name
23
24
  "#{REFS_PREFIX}#{name}"
24
25
  end
26
+
27
+ # @return [EacGit::Local::Commit]
28
+ def head_commit
29
+ local.commit(head_commit_id, true)
30
+ end
31
+
32
+ # @return [String]
33
+ def head_commit_id
34
+ local.rev_parse(full_ref_name, true)
35
+ end
36
+
37
+ # @param remote [EacGit::Local::Remote]
38
+ # @return [void]
39
+ def push(remote, options = {})
40
+ options[:refspec] = name
41
+ options.inject(remote.push) do |a, e|
42
+ a.send(*e)
43
+ end.perform
44
+ end
25
45
  end
26
46
  end
27
47
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacGit
6
+ class Local
7
+ class Remote
8
+ class Push
9
+ acts_as_immutable
10
+ immutable_accessor :force, type: :boolean
11
+ immutable_accessor :refspec, type: :array
12
+
13
+ common_constructor :remote
14
+ delegate :local, to: :remote
15
+
16
+ # @return [Array<Object>]
17
+ def immutable_constructor_args
18
+ [remote]
19
+ end
20
+
21
+ # @return [void]
22
+ def perform
23
+ local.command(*git_command_args).system!
24
+ end
25
+
26
+ # @return [Enumerable<String>]
27
+ def git_command_args
28
+ r = ['push', remote.name]
29
+ r << '--force' if force?
30
+ r + refspecs
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -22,6 +22,11 @@ module EacGit
22
22
  local.command(*args)
23
23
  end
24
24
 
25
+ # @return [EacGit::Local::Remote::Push]
26
+ def push
27
+ ::EacGit::Local::Remote::Push.new(self)
28
+ end
29
+
25
30
  # @return [String]
26
31
  def remote_reference
27
32
  name
@@ -38,6 +43,8 @@ module EacGit
38
43
  def url=(new_url)
39
44
  local.command('remote', 'set-url', name, new_url).execute!
40
45
  end
46
+
47
+ require_sub __FILE__
41
48
  end
42
49
  end
43
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.15.0'
4
+ VERSION = '0.16.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.15.0
4
+ version: 0.16.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: 2023-12-22 00:00:00.000000000 Z
11
+ date: 2024-02-18 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.120'
19
+ version: '0.121'
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.120'
26
+ version: '0.121'
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.9'
53
+ version: '0.10'
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.9'
60
+ version: '0.10'
61
61
  description:
62
62
  email:
63
63
  executables: []
@@ -75,6 +75,7 @@ files:
75
75
  - lib/eac_git/local/dirty_files.rb
76
76
  - lib/eac_git/local/log.rb
77
77
  - lib/eac_git/local/remote.rb
78
+ - lib/eac_git/local/remote/push.rb
78
79
  - lib/eac_git/local/remotes.rb
79
80
  - lib/eac_git/local/subrepo.rb
80
81
  - lib/eac_git/local/subrepo/config.rb