avm-git 0.6.0 → 0.8.0
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/avm/git/launcher/base/underlying.rb +8 -10
- data/lib/avm/git/launcher/error.rb +3 -1
- data/lib/avm/git/launcher/warp_base.rb +2 -2
- data/lib/avm/git/launcher_stereotypes/git/local_project_mixin.rb +19 -0
- data/lib/avm/git/launcher_stereotypes/git/publish.rb +15 -0
- data/lib/avm/git/launcher_stereotypes/git/warp.rb +27 -0
- data/lib/avm/git/launcher_stereotypes/git.rb +25 -0
- data/lib/avm/git/launcher_stereotypes/git_subrepo/publish.rb +14 -0
- data/lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb +88 -0
- data/lib/avm/git/launcher_stereotypes/git_subrepo.rb +34 -0
- data/lib/avm/git/launcher_stereotypes/git_subtree/publish.rb +14 -0
- data/lib/avm/git/launcher_stereotypes/git_subtree/warp.rb +32 -0
- data/lib/avm/git/launcher_stereotypes/git_subtree.rb +51 -0
- data/lib/avm/git/launcher_stereotypes/provider.rb +22 -0
- data/lib/avm/git/launcher_stereotypes.rb +11 -0
- data/lib/avm/git/version.rb +1 -1
- metadata +34 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b950c0eeed70482dab12ee583f6df30f6bd1d7a9b7094bfd02a8cd733e93281
|
4
|
+
data.tar.gz: 41f39901cad5df8567da52f9bd02206c62094c60904f74ff4107d6a108fdfd7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46cd50310c58b60a078268e225635097e86ac1cb89f18c4f40cb4e82402b0ea18ac14d0c30ff38846bb6924b1524738ef08b2fd5807b16b5522ff9d4291c16a8
|
7
|
+
data.tar.gz: ddc772bee2ae2d83f80e151737c62181cde440976daec88fa471203109cdeebe44357f146b456d1f2d3a761e2343a33ea013c89cce47b139a9b214d27d27fab1
|
@@ -19,16 +19,14 @@ module Avm
|
|
19
19
|
r
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def system!(*args)
|
31
|
-
command(*args).system!
|
22
|
+
%w[execute execute! system system!].each do |exec_type|
|
23
|
+
define_method exec_type do |*args|
|
24
|
+
begin
|
25
|
+
command(*args).send(exec_type)
|
26
|
+
rescue ::EacRubyUtils::Envs::Command::ExecError
|
27
|
+
raise ::Avm::Git::Launcher::Error
|
28
|
+
end
|
29
|
+
end
|
32
30
|
end
|
33
31
|
|
34
32
|
def init
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/launcher/errors/base'
|
4
|
+
|
3
5
|
module Avm
|
4
6
|
module Git
|
5
7
|
module Launcher
|
6
|
-
class Error <
|
8
|
+
class Error < ::Avm::Launcher::Errors::Base
|
7
9
|
def initialize(git_instance, message)
|
8
10
|
super("#{message} (Repository: #{git_instance})")
|
9
11
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'avm/git/launcher/mirror_update'
|
4
4
|
require 'avm/launcher/instances/error'
|
5
5
|
require 'avm/git/vendor/github'
|
6
|
-
require 'avm/
|
6
|
+
require 'avm/git/launcher_stereotypes/git/publish'
|
7
7
|
|
8
8
|
module Avm
|
9
9
|
module Git
|
@@ -15,7 +15,7 @@ module Avm
|
|
15
15
|
class WarpBase < ::Avm::Launcher::Paths::Real
|
16
16
|
include ::EacRubyUtils::SimpleCache
|
17
17
|
|
18
|
-
TARGET_REMOTE = ::Avm::
|
18
|
+
TARGET_REMOTE = ::Avm::Git::LauncherStereotypes::Git::Publish::PUBLISH_GIT_REMOTE_NAME
|
19
19
|
|
20
20
|
def initialize(instance)
|
21
21
|
@instance = instance
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_git/local'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Git
|
8
|
+
module LauncherStereotypes
|
9
|
+
class Git
|
10
|
+
module LocalProjectMixin
|
11
|
+
# @return [EacGit::Local]
|
12
|
+
def git_repo
|
13
|
+
@git_repo ||= ::EacGit::Local.new(path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/launcher/publish_base'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module LauncherStereotypes
|
8
|
+
class Git
|
9
|
+
class Publish < ::Avm::Git::Launcher::PublishBase
|
10
|
+
PUBLISH_GIT_REMOTE_NAME = 'publish'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/launcher/warp_base'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module LauncherStereotypes
|
8
|
+
class Git
|
9
|
+
class Warp < ::Avm::Git::Launcher::WarpBase
|
10
|
+
private
|
11
|
+
|
12
|
+
def current_ref
|
13
|
+
'HEAD'
|
14
|
+
end
|
15
|
+
|
16
|
+
def source_instance
|
17
|
+
instance
|
18
|
+
end
|
19
|
+
|
20
|
+
def source_remote_name
|
21
|
+
::Avm::Git::LauncherStereotypes::Git::Publish::PUBLISH_GIT_REMOTE_NAME
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/launcher/stereotype'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Git
|
8
|
+
module LauncherStereotypes
|
9
|
+
class Git
|
10
|
+
require_sub __FILE__
|
11
|
+
include Avm::Launcher::Stereotype
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def match?(path)
|
15
|
+
File.directory?(path.real.subpath('.git'))
|
16
|
+
end
|
17
|
+
|
18
|
+
def color
|
19
|
+
:white
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/simple_cache'
|
4
|
+
require 'avm/git/launcher/sub_warp_base'
|
5
|
+
require 'avm/launcher/errors/base'
|
6
|
+
require 'avm/launcher/paths/real'
|
7
|
+
require 'avm/git/vendor/github'
|
8
|
+
|
9
|
+
module Avm
|
10
|
+
module Git
|
11
|
+
module LauncherStereotypes
|
12
|
+
class GitSubrepo
|
13
|
+
class Warp < ::Avm::Launcher::Paths::Real
|
14
|
+
include ::Avm::Git::Launcher::SubWarpBase
|
15
|
+
include ::EacRubyUtils::SimpleCache
|
16
|
+
|
17
|
+
attr_reader :instance
|
18
|
+
|
19
|
+
def initialize(instance)
|
20
|
+
@instance = instance
|
21
|
+
check_parent
|
22
|
+
init_aux
|
23
|
+
push_to_aux
|
24
|
+
reset
|
25
|
+
assert_target_remote
|
26
|
+
super(warped_git)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def check_parent
|
32
|
+
return if parent_git_warped.rev_parse(subrepo_parent_hash) &&
|
33
|
+
parent_git_warped.descendant?('HEAD', subrepo_parent_hash)
|
34
|
+
|
35
|
+
raise Avm::Launcher::Errors::Base,
|
36
|
+
"Subrepo parent hash \"#{subrepo_parent_hash}\"" \
|
37
|
+
" not found in \"#{parent_git_warped}\""
|
38
|
+
end
|
39
|
+
|
40
|
+
def subrepo_parent_hash
|
41
|
+
data = parent_git_warped.subrepo_status(to_parent_git_path)
|
42
|
+
h = data['Pull Parent']
|
43
|
+
return h if h.present?
|
44
|
+
|
45
|
+
raise Avm::Launcher::Errors::Base, "Subrepo parent hash is blank: #{data}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def init_aux
|
49
|
+
::Avm::Git::Launcher::Base.new(aux_path).init_bare
|
50
|
+
end
|
51
|
+
|
52
|
+
def parent_git_warped_uncached
|
53
|
+
::Avm::Git::Launcher::Base.new(parent_instance.warped)
|
54
|
+
end
|
55
|
+
|
56
|
+
def aux_path
|
57
|
+
instance.cache_path('subrepo_aux_git_repository')
|
58
|
+
end
|
59
|
+
|
60
|
+
def warped_git_uncached
|
61
|
+
::Avm::Git::Launcher::Base.new(instance.cache_path('git_repository'))
|
62
|
+
end
|
63
|
+
|
64
|
+
def push_to_aux
|
65
|
+
parent_git_warped.execute!('subrepo', 'branch', to_parent_git_path, '-fF')
|
66
|
+
h = parent_git_warped.rev_parse("subrepo/#{to_parent_git_path}", true)
|
67
|
+
parent_git_warped.execute!('push', aux_path, "#{h}:refs/heads/master", '--force')
|
68
|
+
end
|
69
|
+
|
70
|
+
def reset
|
71
|
+
::Avm::Git::Launcher::MirrorUpdate.new(warped_git, aux_path, 'master')
|
72
|
+
end
|
73
|
+
|
74
|
+
def assert_target_remote
|
75
|
+
warped_git.assert_remote_url(::Avm::Git::Launcher::WarpBase::TARGET_REMOTE,
|
76
|
+
target_remote_url)
|
77
|
+
end
|
78
|
+
|
79
|
+
def target_remote_url
|
80
|
+
::Avm::Git::Vendor::Github.to_ssh_url(
|
81
|
+
parent_git_warped.subrepo_remote_url(to_parent_git_path)
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/launcher/error'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'avm/launcher/stereotype'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Git
|
9
|
+
module LauncherStereotypes
|
10
|
+
class GitSubrepo
|
11
|
+
require_sub __FILE__
|
12
|
+
include Avm::Launcher::Stereotype
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def match?(path)
|
16
|
+
File.exist?(path.real.subpath('.gitrepo')) && subrepo_url(path.real) != 'none'
|
17
|
+
end
|
18
|
+
|
19
|
+
def color
|
20
|
+
:light_cyan
|
21
|
+
end
|
22
|
+
|
23
|
+
def subrepo_url(path)
|
24
|
+
File.read(path.subpath('.gitrepo')).each_line do |l|
|
25
|
+
m = /remote\s*=\s(.+)/.match(l)
|
26
|
+
return m[1] if m
|
27
|
+
end
|
28
|
+
raise ::Avm::Git::Launcher::Error.new(path, '"remote = ... " not found')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/launcher/warp_base'
|
4
|
+
require 'avm/git/launcher/sub_warp_base'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Git
|
8
|
+
module LauncherStereotypes
|
9
|
+
class GitSubtree
|
10
|
+
class Warp < ::Avm::Git::Launcher::WarpBase
|
11
|
+
include ::Avm::Git::Launcher::SubWarpBase
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def current_ref
|
16
|
+
instance.cache_key("git_subtree.parent.#{cache_git.git.object('HEAD').sha}") do
|
17
|
+
cache_git.subtree_split(to_parent_git_path)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def source_instance
|
22
|
+
parent_instance
|
23
|
+
end
|
24
|
+
|
25
|
+
def source_remote_name
|
26
|
+
instance.project_name
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/launcher/stereotype'
|
4
|
+
require 'avm/git/launcher_stereotypes/git'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Git
|
9
|
+
module LauncherStereotypes
|
10
|
+
class GitSubtree
|
11
|
+
require_sub __FILE__
|
12
|
+
include Avm::Launcher::Stereotype
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def match?(path)
|
16
|
+
return false if other_git_stereotype?(path)
|
17
|
+
return false unless other_nogit_stereotype?(path)
|
18
|
+
|
19
|
+
parent = parent_git(path.parent_path)
|
20
|
+
return false unless parent
|
21
|
+
|
22
|
+
::Git.open(parent.real).remote(path.real.basename).url ? true : false
|
23
|
+
end
|
24
|
+
|
25
|
+
def color
|
26
|
+
:green
|
27
|
+
end
|
28
|
+
|
29
|
+
def parent_git(parent_path)
|
30
|
+
return nil unless parent_path
|
31
|
+
|
32
|
+
if ::Avm::Git::LauncherStereotypes::Git.match?(parent_path)
|
33
|
+
parent_path
|
34
|
+
else
|
35
|
+
parent_git(parent_path.parent_path)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def other_git_stereotype?(path)
|
40
|
+
::Avm::Git::LauncherStereotypes::Git.match?(path) ||
|
41
|
+
::Avm::Git::LauncherStereotypes::GitSubrepo.match?(path)
|
42
|
+
end
|
43
|
+
|
44
|
+
def other_nogit_stereotype?(path)
|
45
|
+
Avm::Launcher::Stereotype.nogit_stereotypes.any? { |s| s.match?(path) }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/launcher_stereotypes/git'
|
4
|
+
require 'avm/git/launcher_stereotypes/git_subrepo'
|
5
|
+
require 'avm/git/launcher_stereotypes/git_subtree'
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Git
|
10
|
+
module LauncherStereotypes
|
11
|
+
class Provider
|
12
|
+
STEREOTYPES = [::Avm::Git::LauncherStereotypes::Git,
|
13
|
+
::Avm::Git::LauncherStereotypes::GitSubrepo,
|
14
|
+
::Avm::Git::LauncherStereotypes::GitSubtree].freeze
|
15
|
+
|
16
|
+
def all
|
17
|
+
STEREOTYPES
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/avm/git/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.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: 2022-10-
|
11
|
+
date: 2022-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.50'
|
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.
|
26
|
+
version: '0.50'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: avm-files
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,34 +50,42 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 0.12.3
|
53
|
+
version: '0.13'
|
57
54
|
type: :runtime
|
58
55
|
prerelease: false
|
59
56
|
version_requirements: !ruby/object:Gem::Requirement
|
60
57
|
requirements:
|
61
58
|
- - "~>"
|
62
59
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0.
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 0.12.3
|
60
|
+
version: '0.13'
|
67
61
|
- !ruby/object:Gem::Dependency
|
68
62
|
name: eac_ruby_utils
|
69
63
|
requirement: !ruby/object:Gem::Requirement
|
70
64
|
requirements:
|
71
65
|
- - "~>"
|
72
66
|
- !ruby/object:Gem::Version
|
73
|
-
version: '0.
|
67
|
+
version: '0.105'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.105'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: git
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.12'
|
74
82
|
type: :runtime
|
75
83
|
prerelease: false
|
76
84
|
version_requirements: !ruby/object:Gem::Requirement
|
77
85
|
requirements:
|
78
86
|
- - "~>"
|
79
87
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
88
|
+
version: '1.12'
|
81
89
|
- !ruby/object:Gem::Dependency
|
82
90
|
name: aranha-parsers
|
83
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,6 +171,18 @@ files:
|
|
163
171
|
- lib/avm/git/launcher/remote.rb
|
164
172
|
- lib/avm/git/launcher/sub_warp_base.rb
|
165
173
|
- lib/avm/git/launcher/warp_base.rb
|
174
|
+
- lib/avm/git/launcher_stereotypes.rb
|
175
|
+
- lib/avm/git/launcher_stereotypes/git.rb
|
176
|
+
- lib/avm/git/launcher_stereotypes/git/local_project_mixin.rb
|
177
|
+
- lib/avm/git/launcher_stereotypes/git/publish.rb
|
178
|
+
- lib/avm/git/launcher_stereotypes/git/warp.rb
|
179
|
+
- lib/avm/git/launcher_stereotypes/git_subrepo.rb
|
180
|
+
- lib/avm/git/launcher_stereotypes/git_subrepo/publish.rb
|
181
|
+
- lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb
|
182
|
+
- lib/avm/git/launcher_stereotypes/git_subtree.rb
|
183
|
+
- lib/avm/git/launcher_stereotypes/git_subtree/publish.rb
|
184
|
+
- lib/avm/git/launcher_stereotypes/git_subtree/warp.rb
|
185
|
+
- lib/avm/git/launcher_stereotypes/provider.rb
|
166
186
|
- lib/avm/git/organize.rb
|
167
187
|
- lib/avm/git/organize/reference_update.rb
|
168
188
|
- lib/avm/git/organize/repository.rb
|