eac_launcher 0.6.1 → 0.6.2

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: f453a237fe5a382f052500e8178c85135a8583557818ea13452d775f3579bddd
4
- data.tar.gz: c51e91c7a7529219470a359a706f9655b5a5c2b5305ccbbb2a2a7b390032380c
3
+ metadata.gz: 565fc4ab1f27c68e3cfd0004bdae700508cedf36b1e6ada6e768f77e6a47fbd9
4
+ data.tar.gz: 18c26e86d04b2e1e0bf0f058af24ef3f6402132e0fff33cac07ff6dba2f25754
5
5
  SHA512:
6
- metadata.gz: 9fbd53bb2c9c6b8b58fe1fe2de939a4f971df5c6afa0833fe5d75228008879cf8d02a279c02ff8df544988d8a6399fa7254504ea9631514af2f9177f24dff2a0
7
- data.tar.gz: fd25983e2b02d4a216be0bba799e6b5a0d67f6557ca46034353e97b469474fbcdac419f6eddd10fcd0ce9e7e6341374069897ab1388678e182305b1145071c7a
6
+ metadata.gz: ef72bcbda016a06d3c67263dc0edc9da63909365d3680a6d6fc38669ec8abf4b05215478fa7b76a1dbb797cdfbbf38326a2e12f5fbe3f4c28dc8e499689bc892
7
+ data.tar.gz: 36c0cbb61f3085af3b019b752dffc11a880e405ce0c8c8231094b2de5288dbe06bcf9d8350d9348c94c7d2fc5521ade3bff497b8ad2706ae836aa03334580436
@@ -92,7 +92,7 @@ module EacLauncher
92
92
 
93
93
  def fetch(remote_name, options = {})
94
94
  args = ['fetch', '-p', remote_name]
95
- args << '--tags' if options[:tags]
95
+ args += %w[--tags --prune-tags --force] if options[:tags]
96
96
  execute!(*args)
97
97
  end
98
98
 
@@ -10,38 +10,55 @@ module EacLauncher
10
10
  include ::EacRubyUtils::SimpleCache
11
11
  include ::EacRubyUtils::Console::Speaker
12
12
 
13
- CHECKERS = %w[publish_remote_no_exist remote_equal remote_following local_following].freeze
13
+ CHECKERS = %w[remote_fetch publish_remote_no_exist remote_equal remote_following
14
+ local_following].freeze
15
+
16
+ REMOTE_UNAVAILABLE_MESSAGES = ['could not resolve hostname', 'connection timed out',
17
+ 'no route to host'].map(&:downcase).freeze
14
18
 
15
19
  protected
16
20
 
17
21
  def internal_check
18
- CHECKERS.each { |checker| return send("#{checker}_check_result") if send("#{checker}?") }
22
+ CHECKERS.each do |checker|
23
+ result = send("#{checker}_check_result")
24
+ return result if result
25
+ end
19
26
  divergent_result_check_result
20
27
  end
21
28
 
22
29
  private
23
30
 
24
- def publish_remote_no_exist?
25
- !sgit.remote_exist?(::EacLauncher::Git::WarpBase::TARGET_REMOTE)
31
+ def remote_fetch_check_result
32
+ remote_fetch
33
+ nil
34
+ rescue ::StandardError => e
35
+ raise e unless remote_unavailable_error?(e)
36
+
37
+ ::EacLauncher::Publish::CheckResult.blocked(e.message)
26
38
  end
27
39
 
28
- def publish_remote_no_exist_check_result
29
- ::EacLauncher::Publish::CheckResult.blocked('Remote does not exist')
40
+ def remote_unavailable_error?(error)
41
+ error_message = error.message.downcase
42
+ REMOTE_UNAVAILABLE_MESSAGES.any? do |message|
43
+ error_message.include?(message)
44
+ end
30
45
  end
31
46
 
32
- def remote_equal?
33
- remote_sha.present? && remote_sha == local_sha
47
+ def publish_remote_no_exist_check_result
48
+ return nil if sgit.remote_exist?(::EacLauncher::Git::WarpBase::TARGET_REMOTE)
49
+
50
+ ::EacLauncher::Publish::CheckResult.blocked('Remote does not exist')
34
51
  end
35
52
 
36
53
  def remote_equal_check_result
37
- ::EacLauncher::Publish::CheckResult.updated('Remote equal')
38
- end
54
+ return nil unless remote_sha.present? && remote_sha == local_sha
39
55
 
40
- def remote_following?
41
- remote_sha.present? && sgit.descendant?(remote_sha, local_sha)
56
+ ::EacLauncher::Publish::CheckResult.updated('Remote equal')
42
57
  end
43
58
 
44
59
  def remote_following_check_result
60
+ return nil unless remote_sha.present? && sgit.descendant?(remote_sha, local_sha)
61
+
45
62
  ::EacLauncher::Publish::CheckResult.outdated('Remote following')
46
63
  end
47
64
 
@@ -77,10 +94,14 @@ module EacLauncher
77
94
  end
78
95
 
79
96
  def remote_sha_uncached
80
- sgit.fetch(::EacLauncher::Git::WarpBase::TARGET_REMOTE)
97
+ remote_fetch
81
98
  b = sgit.git.branches["#{::EacLauncher::Git::WarpBase::TARGET_REMOTE}/master"]
82
99
  b ? b.gcommit.sha : nil
83
100
  end
101
+
102
+ def remote_fetch_uncached
103
+ sgit.fetch(::EacLauncher::Git::WarpBase::TARGET_REMOTE)
104
+ end
84
105
  end
85
106
  end
86
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacLauncher
4
- VERSION = '0.6.1'
4
+ VERSION = '0.6.2'
5
5
  end
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.1
4
+ version: 0.6.2
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-08-21 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport