eac_launcher 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: 0ab5bf921659df3c88a83fe103ebd637cdf31867
4
- data.tar.gz: cecdcb2756bc6a5588631da4c3add9c69af43169
3
+ metadata.gz: fa09c1db1d7f7920eda7d026847a546e94b65bc2
4
+ data.tar.gz: 96b777bdb3d914eaa887068900ec1b7d70f7a753
5
5
  SHA512:
6
- metadata.gz: 7ce5c60b145385320aafc6e051246e4dd3b11b8d8406d22743a99c3b3561f2f67ec2f15a9b5ce70cb8dcb87e8f8770fbd1df3549d48999112653ece979343491
7
- data.tar.gz: 0eaea78113863318f8a0579cd377b47fb4487962a38bf76bd9a54f271880de0e3a29ce22204458548b45d7a7ec67432d77764798636ac4dbd3cc96166e7cb68a
6
+ metadata.gz: ac3ba7b71c29973e5f709dec912b6cb87809312b4ea7c2424e51ed64efeb378ab8f287b6b7999d7846cd73f616e0e8896bf1fb6450f03cabe54ffc9f99df1bd8
7
+ data.tar.gz: 1dec30133f1e3544012e458bf4c89aa0cf28ed53e9ab4adeed854f89fb3452741158d2e5aff4f31546571ccfd153254a8ff53bb5698518c71586a55eb2b1cae8
data/lib/eac_launcher.rb CHANGED
@@ -19,6 +19,7 @@ module EacLauncher
19
19
  require 'eac_launcher/stereotype'
20
20
  require 'eac_launcher/context/settings'
21
21
  require 'eac_launcher/git/base'
22
+ require 'eac_launcher/git/error'
22
23
  require 'eac_launcher/git/mirror_update'
23
24
  require 'eac_launcher/git/publish_base'
24
25
  require 'eac_launcher/git/warp_base'
@@ -14,11 +14,12 @@ module EacLauncher
14
14
  File.exist?(subpath('.git'))
15
15
  end
16
16
 
17
- def rev_parse(ref)
17
+ def rev_parse(ref, required = false)
18
18
  r = execute!('rev-parse', ref, exit_outputs: { 128 => nil, 32_768 => nil })
19
19
  r.strip! if r.is_a?(String)
20
- r = nil if r == ''
21
- r
20
+ return r if r.present?
21
+ return nil unless required
22
+ raise "Reference \"#{ref}\" not found"
22
23
  end
23
24
 
24
25
  def remote_hashs(remote_name)
@@ -95,6 +96,10 @@ module EacLauncher
95
96
  execute!('reset', '--hard', ref)
96
97
  end
97
98
 
99
+ def raise(message)
100
+ ::Kernel.raise EacLauncher::Git::Error.new(self, message)
101
+ end
102
+
98
103
  private
99
104
 
100
105
  def merge_base_pair(c1, c2)
@@ -4,6 +4,15 @@ module EacLauncher
4
4
  module Subrepo
5
5
  def subrepo_status(subrepo_path)
6
6
  s = execute!('subrepo', 'status', subrepo_path.gsub(%r{\A/}, ''))
7
+ raise s.strip.to_s if s.include?('is not a subrepo')
8
+ r = subrepo_status_parse_output(s)
9
+ raise "Empty subrepo status for |#{s}|\n" unless r.any?
10
+ r
11
+ end
12
+
13
+ private
14
+
15
+ def subrepo_status_parse_output(s)
7
16
  r = {}.with_indifferent_access
8
17
  s.each_line do |l|
9
18
  m = /\A([^\:]+)\:(.*)\z/.match(l.strip)
@@ -12,6 +12,11 @@ module EacLauncher
12
12
  ::EacRubyUtils::Envs.local.command(*args).system!(options)
13
13
  end
14
14
 
15
+ def init
16
+ git
17
+ self
18
+ end
19
+
15
20
  private
16
21
 
17
22
  def build_args(args)
@@ -0,0 +1,9 @@
1
+ module EacLauncher
2
+ module Git
3
+ class Error < StandardError
4
+ def initialize(git_instance, message)
5
+ super("#{message} (Repository: #{git_instance})")
6
+ end
7
+ end
8
+ end
9
+ end
@@ -24,9 +24,7 @@ module EacLauncher
24
24
  end
25
25
 
26
26
  def reset_source_rev
27
- h = @source_git.rev_parse(@source_rev)
28
- raise "Hash not found for ref. \"#{@source_rev}\" in \"#{@source_git}\"" unless h
29
- @target_git.reset_hard(h)
27
+ @target_git.reset_hard(@source_git.rev_parse(@source_rev, true))
30
28
  end
31
29
  end
32
30
  end
@@ -12,6 +12,8 @@ module EacLauncher
12
12
  internal_check
13
13
  rescue ::EacLauncher::Instances::Error => ex
14
14
  ::EacLauncher::Publish::CheckResult.blocked("Error: #{ex}")
15
+ rescue ::EacLauncher::Git::Error => ex
16
+ ::EacLauncher::Publish::CheckResult.blocked("Git error: #{ex}")
15
17
  end
16
18
  end
17
19
  end
@@ -17,7 +17,7 @@ module EacLauncher
17
17
  m = /remote\s*=\s(.+)/.match(l)
18
18
  return m[1] if m
19
19
  end
20
- raise "\"remote = ... \" not found (Path: #{path})"
20
+ raise ::EacLauncher::Git::Error.new(path, '"remote = ... " not found')
21
21
  end
22
22
  end
23
23
  end
@@ -10,8 +10,7 @@ module EacLauncher
10
10
  @instance = instance
11
11
  check_parent
12
12
  init_aux
13
- fetch
14
- push
13
+ push_to_aux
15
14
  reset
16
15
  assert_target_remote
17
16
  super(cache_git)
@@ -27,9 +26,10 @@ module EacLauncher
27
26
  end
28
27
 
29
28
  def subrepo_parent_hash
30
- h = parent_cache_git.subrepo_status(instance.to_parent_path)['Pull Parent']
29
+ data = parent_cache_git.subrepo_status(instance.to_parent_path)
30
+ h = data['Pull Parent']
31
31
  return h if h.present?
32
- raise 'Subrepo parent hash is blank'
32
+ raise EacLauncher::Instances::Error, "Subrepo parent hash is blank: #{data}"
33
33
  end
34
34
 
35
35
  def init_aux
@@ -56,13 +56,10 @@ module EacLauncher
56
56
  ::EacLauncher::Git::Base.new(instance.cache_path('git_repository'))
57
57
  end
58
58
 
59
- def fetch
60
- parent_cache_git.execute!('subrepo', 'clean', subrepo_subdir)
61
- parent_cache_git.execute!('subrepo', 'fetch', subrepo_subdir)
62
- end
63
-
64
- def push
65
- parent_cache_git.execute!('subrepo', 'push', subrepo_subdir, '-r', aux_path, '-f')
59
+ def push_to_aux
60
+ parent_cache_git.execute!('subrepo', 'branch', subrepo_subdir, '-fF')
61
+ h = parent_cache_git.rev_parse("subrepo/#{subrepo_subdir}", true)
62
+ parent_cache_git.execute!('push', aux_path, "#{h}:refs/heads/master", '--force')
66
63
  end
67
64
 
68
65
  def subrepo_subdir
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacLauncher
4
- VERSION = '0.1.6'.freeze
4
+ VERSION = '0.1.7'.freeze
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.1.6
4
+ version: 0.1.7
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: 2018-05-04 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -154,6 +154,7 @@ files:
154
154
  - lib/eac_launcher/git/base.rb
155
155
  - lib/eac_launcher/git/base/subrepo.rb
156
156
  - lib/eac_launcher/git/base/underlying.rb
157
+ - lib/eac_launcher/git/error.rb
157
158
  - lib/eac_launcher/git/mirror_update.rb
158
159
  - lib/eac_launcher/git/publish_base.rb
159
160
  - lib/eac_launcher/git/warp_base.rb