eac_launcher 0.2.1 → 0.2.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
  SHA1:
3
- metadata.gz: 52aa71693d4a4209ac7290124875448649aaed7b
4
- data.tar.gz: 16cd264adfe0fbd7803a0f1226211071fc9c47f6
3
+ metadata.gz: be146005c131fcd24f8226cac90684e1e6580e66
4
+ data.tar.gz: 3699b4549409d7a83879078e8938e455d0767f16
5
5
  SHA512:
6
- metadata.gz: 647bcc691051e3f74abf673997c289ba5246b51104278ebc3e4c9d48669ffb54e3d01c7fcd904f6172d523bdf29cb9610aa5084c43e6fd3ff25bf3a3620dc363
7
- data.tar.gz: 29a16f00a5abd889bc15719dd3e1c3e2a9c8d22ace0a9b41181e397178b3886d5ff9a42ac7199c21fa27d61a1bff5e26c767b40d654c8fb1d0d010c516178a2c
6
+ metadata.gz: 48db93c8e6905615edf42facb4e248964180355dc709e568b03954e23f3abea7d210b6f50102ac40156a54eb93da2aeee9bea6f5071de91c123833d30f5d2b3e
7
+ data.tar.gz: 430bb4b45fe6ff30a9cd6e919fcdb5467343c915f3bfc42f5779939c9c4843d0da08c85e91ac4946c5bc656986960715d95abf91cec28bf2455ecf3aede19835
@@ -0,0 +1,22 @@
1
+ module EacLauncher
2
+ module Git
3
+ module SubWarpBase
4
+ private
5
+
6
+ def parent_instance_uncached
7
+ r = find_parent_instance(instance.parent)
8
+ return r if r
9
+ ::EacLauncher::Instances::Error.new('Git parent not found')
10
+ end
11
+
12
+ def find_parent_instance(current)
13
+ return current if current.stereotype?(::EacLauncher::Stereotypes::Git)
14
+ current.parent ? find_parent_instance(current.parent) : nil
15
+ end
16
+
17
+ def to_parent_git_path
18
+ instance.logical.gsub(%r{\A#{Regexp.quote(parent_instance.logical)}/}, '')
19
+ end
20
+ end
21
+ end
22
+ end
@@ -9,8 +9,12 @@ module EacLauncher
9
9
  base.extend(ClassMethods)
10
10
  end
11
11
 
12
+ def git_stereotypes
13
+ stereotypes.select { |c| c.name.demodulize.downcase.match('git') }
14
+ end
15
+
12
16
  def nogit_stereotypes
13
- stereotypes.reject { |c| c.name.demodulize.downcase.match('git') }
17
+ stereotypes - git_stereotypes
14
18
  end
15
19
  end
16
20
 
@@ -1,7 +1,10 @@
1
+ require 'eac_launcher/git/sub_warp_base'
2
+
1
3
  module EacLauncher
2
4
  module Stereotypes
3
5
  class GitSubrepo
4
6
  class Warp < ::EacLauncher::Paths::Real
7
+ include ::EacLauncher::Git::SubWarpBase
5
8
  include ::Eac::SimpleCache
6
9
 
7
10
  attr_reader :instance
@@ -13,20 +16,20 @@ module EacLauncher
13
16
  push_to_aux
14
17
  reset
15
18
  assert_target_remote
16
- super(cache_git)
19
+ super(warped_git)
17
20
  end
18
21
 
19
22
  private
20
23
 
21
24
  def check_parent
22
- return if parent_cache_git.rev_parse(subrepo_parent_hash) &&
23
- parent_cache_git.descendant?('HEAD', subrepo_parent_hash)
25
+ return if parent_git_warped.rev_parse(subrepo_parent_hash) &&
26
+ parent_git_warped.descendant?('HEAD', subrepo_parent_hash)
24
27
  raise EacLauncher::Instances::Error, "Subrepo parent hash \"#{subrepo_parent_hash}\""\
25
- " not found in \"#{parent_cache_git}\""
28
+ " not found in \"#{parent_git_warped}\""
26
29
  end
27
30
 
28
31
  def subrepo_parent_hash
29
- data = parent_cache_git.subrepo_status(instance.to_parent_path)
32
+ data = parent_git_warped.subrepo_status(to_parent_git_path)
30
33
  h = data['Pull Parent']
31
34
  return h if h.present?
32
35
  raise EacLauncher::Instances::Error, "Subrepo parent hash is blank: #{data}"
@@ -36,15 +39,7 @@ module EacLauncher
36
39
  ::EacLauncher::Git::Base.new(aux_path).init_bare
37
40
  end
38
41
 
39
- def parent_instance
40
- instance.parent
41
- end
42
-
43
- def parent_git_uncached
44
- ::EacLauncher::Git::Base.new(parent_instance.real)
45
- end
46
-
47
- def parent_cache_git_uncached
42
+ def parent_git_warped_uncached
48
43
  ::EacLauncher::Git::Base.new(parent_instance.warped)
49
44
  end
50
45
 
@@ -52,32 +47,28 @@ module EacLauncher
52
47
  instance.cache_path('subrepo_aux_git_repository')
53
48
  end
54
49
 
55
- def cache_git_uncached
50
+ def warped_git_uncached
56
51
  ::EacLauncher::Git::Base.new(instance.cache_path('git_repository'))
57
52
  end
58
53
 
59
54
  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')
63
- end
64
-
65
- def subrepo_subdir
66
- instance.to_parent_path.gsub(%r{\A/+}, '')
55
+ parent_git_warped.execute!('subrepo', 'branch', to_parent_git_path, '-fF')
56
+ h = parent_git_warped.rev_parse("subrepo/#{to_parent_git_path}", true)
57
+ parent_git_warped.execute!('push', aux_path, "#{h}:refs/heads/master", '--force')
67
58
  end
68
59
 
69
60
  def reset
70
- ::EacLauncher::Git::MirrorUpdate.new(cache_git, aux_path, 'master')
61
+ ::EacLauncher::Git::MirrorUpdate.new(warped_git, aux_path, 'master')
71
62
  end
72
63
 
73
64
  def assert_target_remote
74
- cache_git.assert_remote_url(::EacLauncher::Git::WarpBase::TARGET_REMOTE,
75
- target_remote_url)
65
+ warped_git.assert_remote_url(::EacLauncher::Git::WarpBase::TARGET_REMOTE,
66
+ target_remote_url)
76
67
  end
77
68
 
78
69
  def target_remote_url
79
70
  ::EacLauncher::Vendor::Github.to_ssh_url(
80
- parent_cache_git.subrepo_remote_url(subrepo_subdir)
71
+ parent_git_warped.subrepo_remote_url(to_parent_git_path)
81
72
  )
82
73
  end
83
74
  end
@@ -2,25 +2,23 @@ module EacLauncher
2
2
  module Stereotypes
3
3
  class GitSubtree
4
4
  class Warp < ::EacLauncher::Git::WarpBase
5
+ include ::EacLauncher::Git::SubWarpBase
6
+
5
7
  private
6
8
 
7
9
  def current_ref
8
10
  instance.cache_key("git_subtree.parent.#{cache_git.git.object('HEAD').sha}") do
9
- cache_git.subtree_split(to_parent_path)
11
+ cache_git.subtree_split(to_parent_git_path)
10
12
  end
11
13
  end
12
14
 
13
15
  def source_instance
14
- instance.parent
16
+ parent_instance
15
17
  end
16
18
 
17
19
  def source_remote_name
18
20
  instance.project_name
19
21
  end
20
-
21
- def to_parent_path
22
- instance.to_parent_path.gsub(%r{\A/+}, '')
23
- end
24
22
  end
25
23
  end
26
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacLauncher
4
- VERSION = '0.2.1'.freeze
4
+ VERSION = '0.2.2'.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.2.1
4
+ version: 0.2.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: 2018-05-11 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -157,6 +157,7 @@ files:
157
157
  - lib/eac_launcher/git/error.rb
158
158
  - lib/eac_launcher/git/mirror_update.rb
159
159
  - lib/eac_launcher/git/publish_base.rb
160
+ - lib/eac_launcher/git/sub_warp_base.rb
160
161
  - lib/eac_launcher/git/warp_base.rb
161
162
  - lib/eac_launcher/instances/base.rb
162
163
  - lib/eac_launcher/instances/base/cache.rb