eac_launcher 0.6.2 → 0.6.3
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 +4 -4
- data/lib/eac_launcher/git/base.rb +2 -26
- data/lib/eac_launcher/git/base/_remotes.rb +36 -0
- data/lib/eac_launcher/git/publish_base.rb +15 -5
- data/lib/eac_launcher/git/remote.rb +53 -0
- data/lib/eac_launcher/git/warp_base.rb +3 -2
- data/lib/eac_launcher/version.rb +1 -1
- metadata +6 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7072e95fd5469a713475499353cb9afaa0d1c26fe7c75f12118ba8ed4b9fa741
|
4
|
+
data.tar.gz: c7baa168a8b4032895bfe9671ef666b9c78226e0472ae0d1ef61bf624c321359
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39e340849a2e5031388fac6b0ddb457aaee69702b99cc035e6d3c9790fc421763ba8da8aead169a462350ac787318220c2de899b8bdb4b4368811ef7767815bc
|
7
|
+
data.tar.gz: 808fc5482fb750e82d53a25e71a6a51172e7ee7c843cf85bb2760e24fa0335fa1798a18e4257044a8a5bafef0ec6b0054436bf50748a2de58522ac497b94dfe4
|
@@ -5,6 +5,7 @@ require 'eac_ruby_utils/envs'
|
|
5
5
|
require 'eac_launcher/paths/real'
|
6
6
|
require 'eac_launcher/git/base/underlying'
|
7
7
|
require 'eac_launcher/git/base/subrepo'
|
8
|
+
require 'eac_launcher/git/error'
|
8
9
|
|
9
10
|
module EacLauncher
|
10
11
|
module Git
|
@@ -12,6 +13,7 @@ module EacLauncher
|
|
12
13
|
include ::EacRubyUtils::SimpleCache
|
13
14
|
include ::EacLauncher::Git::Base::Subrepo
|
14
15
|
include ::EacLauncher::Git::Base::Underlying
|
16
|
+
require_relative ::File.join(__dir__, 'base', '_remotes')
|
15
17
|
|
16
18
|
def init_bare
|
17
19
|
FileUtils.mkdir_p(self)
|
@@ -28,19 +30,6 @@ module EacLauncher
|
|
28
30
|
raise "Reference \"#{ref}\" not found"
|
29
31
|
end
|
30
32
|
|
31
|
-
def remote_hashs(remote_name)
|
32
|
-
r = {}
|
33
|
-
execute!(['ls-remote', remote_name]).each_line do |line|
|
34
|
-
x = line.strip.split(/\s+/)
|
35
|
-
r[x[1]] = x[0]
|
36
|
-
end
|
37
|
-
r
|
38
|
-
end
|
39
|
-
|
40
|
-
def remote_exist?(remote_name)
|
41
|
-
git.remote(remote_name).url.present?
|
42
|
-
end
|
43
|
-
|
44
33
|
def descendant?(descendant, ancestor)
|
45
34
|
base = merge_base(descendant, ancestor)
|
46
35
|
return false if base.blank?
|
@@ -64,19 +53,6 @@ module EacLauncher
|
|
64
53
|
execute!('subtree', '-q', 'split', '-P', prefix).strip
|
65
54
|
end
|
66
55
|
|
67
|
-
def assert_remote_url(remote_name, url)
|
68
|
-
r = git.remote(remote_name)
|
69
|
-
if !r.url || r.url != url
|
70
|
-
r.remove if r.url
|
71
|
-
git.add_remote(remote_name, url)
|
72
|
-
end
|
73
|
-
r
|
74
|
-
end
|
75
|
-
|
76
|
-
def remote_branch_sha(remote_name, branch_name)
|
77
|
-
remote_hashs(remote_name)["refs/heads/#{branch_name}"]
|
78
|
-
end
|
79
|
-
|
80
56
|
def push(remote_name, refspecs, options = {})
|
81
57
|
refspecs = [refspecs] unless refspecs.is_a?(Array)
|
82
58
|
args = ['push']
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_launcher/git/remote'
|
5
|
+
|
6
|
+
module EacLauncher
|
7
|
+
module Git
|
8
|
+
class Base < ::EacLauncher::Paths::Real
|
9
|
+
# @return [EacLauncher::Git::Remote]
|
10
|
+
def remote(name)
|
11
|
+
::EacLauncher::Git::Remote.new(self, name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def remote_hashs(remote_name)
|
15
|
+
remote(remote_name).ls
|
16
|
+
end
|
17
|
+
|
18
|
+
def remote_exist?(remote_name)
|
19
|
+
remote(remote_name).exist?
|
20
|
+
end
|
21
|
+
|
22
|
+
def assert_remote_url(remote_name, url)
|
23
|
+
r = git.remote(remote_name)
|
24
|
+
if !r.url || r.url != url
|
25
|
+
r.remove if r.url
|
26
|
+
git.add_remote(remote_name, url)
|
27
|
+
end
|
28
|
+
r
|
29
|
+
end
|
30
|
+
|
31
|
+
def remote_branch_sha(remote_name, branch_name)
|
32
|
+
remote_hashs(remote_name)["refs/heads/#{branch_name}"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -10,7 +10,7 @@ module EacLauncher
|
|
10
10
|
include ::EacRubyUtils::SimpleCache
|
11
11
|
include ::EacRubyUtils::Console::Speaker
|
12
12
|
|
13
|
-
CHECKERS = %w[remote_fetch publish_remote_no_exist remote_equal remote_following
|
13
|
+
CHECKERS = %w[remote_url remote_fetch publish_remote_no_exist remote_equal remote_following
|
14
14
|
local_following].freeze
|
15
15
|
|
16
16
|
REMOTE_UNAVAILABLE_MESSAGES = ['could not resolve hostname', 'connection timed out',
|
@@ -28,6 +28,12 @@ module EacLauncher
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
+
def remote_url_check_result
|
32
|
+
return if sgit.remote(remote_name).url.present?
|
33
|
+
|
34
|
+
::EacLauncher::Publish::CheckResult.blocked("Remote \"#{remote_name}\" has blank path")
|
35
|
+
end
|
36
|
+
|
31
37
|
def remote_fetch_check_result
|
32
38
|
remote_fetch
|
33
39
|
nil
|
@@ -45,7 +51,7 @@ module EacLauncher
|
|
45
51
|
end
|
46
52
|
|
47
53
|
def publish_remote_no_exist_check_result
|
48
|
-
return nil if sgit.remote_exist?(
|
54
|
+
return nil if sgit.remote_exist?(remote_name)
|
49
55
|
|
50
56
|
::EacLauncher::Publish::CheckResult.blocked('Remote does not exist')
|
51
57
|
end
|
@@ -84,7 +90,7 @@ module EacLauncher
|
|
84
90
|
|
85
91
|
def publish
|
86
92
|
info 'Pushing...'
|
87
|
-
sgit.push(
|
93
|
+
sgit.push(remote_name, 'HEAD:master',
|
88
94
|
dryrun: !::EacLauncher::Context.current.publish_options[:confirm])
|
89
95
|
info 'Pushed!'
|
90
96
|
end
|
@@ -95,12 +101,16 @@ module EacLauncher
|
|
95
101
|
|
96
102
|
def remote_sha_uncached
|
97
103
|
remote_fetch
|
98
|
-
b = sgit.git.branches["#{
|
104
|
+
b = sgit.git.branches["#{remote_name}/master"]
|
99
105
|
b ? b.gcommit.sha : nil
|
100
106
|
end
|
101
107
|
|
102
108
|
def remote_fetch_uncached
|
103
|
-
sgit.fetch(
|
109
|
+
sgit.fetch(remote_name)
|
110
|
+
end
|
111
|
+
|
112
|
+
def remote_name
|
113
|
+
::EacLauncher::Git::WarpBase::TARGET_REMOTE
|
104
114
|
end
|
105
115
|
end
|
106
116
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacLauncher
|
6
|
+
module Git
|
7
|
+
class Remote
|
8
|
+
common_constructor :git, :name
|
9
|
+
|
10
|
+
def exist?
|
11
|
+
git.execute!('remote').each_line.any? { |line| line.strip == name }
|
12
|
+
end
|
13
|
+
|
14
|
+
def ls
|
15
|
+
execute!(['ls-remote', name]).each_line.map do |line|
|
16
|
+
x = line.strip.split(/\s+/)
|
17
|
+
[x[1], x[0]]
|
18
|
+
end.to_h
|
19
|
+
end
|
20
|
+
|
21
|
+
# +git remote add ...+
|
22
|
+
def add(url)
|
23
|
+
git.execute!('remote', 'add', name, url)
|
24
|
+
end
|
25
|
+
|
26
|
+
# +git remote rm ...+
|
27
|
+
def remove
|
28
|
+
git.execute!('remote', 'rm', name)
|
29
|
+
end
|
30
|
+
|
31
|
+
# +git remote get-url ...+
|
32
|
+
def url
|
33
|
+
git.execute!('remote', 'get-url', name).strip.if_present(nil)
|
34
|
+
end
|
35
|
+
|
36
|
+
# git remote set-url ...
|
37
|
+
def url_set(url)
|
38
|
+
git.execute!('remote', 'set-url', name, url)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Add or set URL if +url+ is present, remove remote if is blank.
|
42
|
+
def url=(url)
|
43
|
+
if exist? && url.blank?
|
44
|
+
remove
|
45
|
+
elsif exist? && self.url != url
|
46
|
+
url_set(url)
|
47
|
+
elsif !exist?
|
48
|
+
add(url)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_launcher/git/mirror_update'
|
4
4
|
require 'eac_launcher/vendor/github'
|
5
|
+
require 'eac_launcher/stereotypes/git/publish'
|
5
6
|
|
6
7
|
module EacLauncher
|
7
8
|
module Git
|
@@ -12,12 +13,12 @@ module EacLauncher
|
|
12
13
|
class WarpBase < ::EacLauncher::Paths::Real
|
13
14
|
include ::EacRubyUtils::SimpleCache
|
14
15
|
|
15
|
-
TARGET_REMOTE =
|
16
|
+
TARGET_REMOTE = ::EacLauncher::Stereotypes::Git::Publish::PUBLISH_GIT_REMOTE_NAME
|
16
17
|
|
17
18
|
def initialize(instance)
|
18
19
|
@instance = instance
|
19
20
|
cache_git.git.reset_hard(current_ref)
|
20
|
-
cache_git.
|
21
|
+
cache_git.remote(TARGET_REMOTE).url = target_remote_url
|
21
22
|
super(path)
|
22
23
|
end
|
23
24
|
|
data/lib/eac_launcher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -64,20 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 0.10.1
|
67
|
+
version: '0.15'
|
71
68
|
type: :runtime
|
72
69
|
prerelease: false
|
73
70
|
version_requirements: !ruby/object:Gem::Requirement
|
74
71
|
requirements:
|
75
72
|
- - "~>"
|
76
73
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0.
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: 0.10.1
|
74
|
+
version: '0.15'
|
81
75
|
- !ruby/object:Gem::Dependency
|
82
76
|
name: git
|
83
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,11 +145,13 @@ files:
|
|
151
145
|
- lib/eac_launcher/context/settings.rb
|
152
146
|
- lib/eac_launcher/git.rb
|
153
147
|
- lib/eac_launcher/git/base.rb
|
148
|
+
- lib/eac_launcher/git/base/_remotes.rb
|
154
149
|
- lib/eac_launcher/git/base/subrepo.rb
|
155
150
|
- lib/eac_launcher/git/base/underlying.rb
|
156
151
|
- lib/eac_launcher/git/error.rb
|
157
152
|
- lib/eac_launcher/git/mirror_update.rb
|
158
153
|
- lib/eac_launcher/git/publish_base.rb
|
154
|
+
- lib/eac_launcher/git/remote.rb
|
159
155
|
- lib/eac_launcher/git/sub_warp_base.rb
|
160
156
|
- lib/eac_launcher/git/warp_base.rb
|
161
157
|
- lib/eac_launcher/instances.rb
|