avm-tools 0.140.0 → 0.142.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/projects/stereotypes.rb +4 -0
- data/lib/avm/tools/runner/files/format.rb +2 -2
- data/lib/avm/tools/runner/git/commit.rb +2 -2
- data/lib/avm/tools/runner/git/deploy.rb +2 -2
- data/lib/avm/tools/runner/git.rb +2 -2
- data/lib/avm/tools/runner/launcher_stereotypes/list.rb +42 -0
- data/lib/avm/tools/runner/launcher_stereotypes.rb +16 -0
- data/lib/avm/tools/version.rb +1 -1
- metadata +10 -39
- data/lib/avm/launcher/git/base/class_methods.rb +0 -28
- data/lib/avm/launcher/git/base/dirty_files.rb +0 -23
- data/lib/avm/launcher/git/base/remotes.rb +0 -40
- data/lib/avm/launcher/git/base/subrepo.rb +0 -44
- data/lib/avm/launcher/git/base/underlying.rb +0 -63
- data/lib/avm/launcher/git/base.rb +0 -86
- data/lib/avm/launcher/git/error.rb +0 -13
- data/lib/avm/launcher/git/mirror_update.rb +0 -38
- data/lib/avm/launcher/git/publish_base.rb +0 -125
- data/lib/avm/launcher/git/remote.rb +0 -55
- data/lib/avm/launcher/git/sub_warp_base.rb +0 -33
- data/lib/avm/launcher/git/warp_base.rb +0 -67
- data/lib/avm/launcher/git.rb +0 -7
- data/lib/avm/launcher/ruby/gem/build.rb +0 -125
- data/lib/avm/launcher/ruby/gem/specification.rb +0 -63
- data/lib/avm/launcher/ruby/gem.rb +0 -4
- data/lib/avm/launcher/ruby.rb +0 -3
- data/lib/avm/projects/stereotype.rb +0 -63
- data/lib/avm/projects/stereotypes/git/local_project_mixin.rb +0 -19
- data/lib/avm/projects/stereotypes/git/publish.rb +0 -15
- data/lib/avm/projects/stereotypes/git/warp.rb +0 -27
- data/lib/avm/projects/stereotypes/git.rb +0 -25
- data/lib/avm/projects/stereotypes/git_subrepo/publish.rb +0 -14
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +0 -88
- data/lib/avm/projects/stereotypes/git_subrepo.rb +0 -34
- data/lib/avm/projects/stereotypes/git_subtree/publish.rb +0 -14
- data/lib/avm/projects/stereotypes/git_subtree/warp.rb +0 -32
- data/lib/avm/projects/stereotypes/git_subtree.rb +0 -51
- data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +0 -28
- data/lib/avm/projects/stereotypes/ruby_gem/publish.rb +0 -129
- data/lib/avm/projects/stereotypes/ruby_gem.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe25f338167f5636022fc92f0b877749a2570818f651aeac18a042a0021f8832
|
4
|
+
data.tar.gz: d87ded2806e33294657eec147b9127910217f8605b599146ff9df5cc60fb172c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ecf9e0b73723b00a7d151d27974864b65635b4999fd21b6cac25e2ea2648da5c38bc8efc664e06d0813ba0699e06922c074cb6dd45fcaf7beaa6704556b483c
|
7
|
+
data.tar.gz: 7ec47592d0538d5eb64457f4af96f4dbd5cf9881efd8001afe7432dd2a5194de3cdbba010a39cae72db74f4aa056d5d4750d56888b0573d4a3f86cbfd25d546f
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
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 'avm/eac_ruby_base1/launcher_stereotypes/base'
|
3
7
|
require 'eac_ruby_utils/core_ext'
|
4
8
|
|
5
9
|
module Avm
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'avm/files/formatter'
|
4
4
|
require 'eac_cli/core_ext'
|
5
|
-
require 'avm/launcher/
|
5
|
+
require 'avm/git/launcher/base'
|
6
6
|
|
7
7
|
module Avm
|
8
8
|
module Tools
|
@@ -29,7 +29,7 @@ module Avm
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def git
|
32
|
-
@git ||= ::Avm::Launcher::
|
32
|
+
@git ||= ::Avm::Git::Launcher::Base.new('.')
|
33
33
|
end
|
34
34
|
|
35
35
|
def git_dirty_files
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/speaker'
|
4
4
|
require 'eac_ruby_utils/simple_cache'
|
5
|
-
require 'avm/launcher/
|
5
|
+
require 'avm/git/launcher/base'
|
6
6
|
require 'filesize'
|
7
7
|
require 'avm/git/commit'
|
8
8
|
|
@@ -76,7 +76,7 @@ module Avm
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def git_uncached
|
79
|
-
::Avm::Launcher::
|
79
|
+
::Avm::Git::Launcher::Base.new(runner_context.call(:repository_path))
|
80
80
|
end
|
81
81
|
|
82
82
|
def commit_uncached
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/launcher/
|
3
|
+
require 'avm/git/launcher/base'
|
4
4
|
require 'avm/git/commit'
|
5
5
|
require 'eac_config/node'
|
6
6
|
|
@@ -57,7 +57,7 @@ module Avm
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def git_uncached
|
60
|
-
::Avm::Launcher::
|
60
|
+
::Avm::Git::Launcher::Base.new(git_repository_path)
|
61
61
|
end
|
62
62
|
|
63
63
|
def git_repository_path
|
data/lib/avm/tools/runner/git.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/tools/core_ext'
|
4
|
-
require 'avm/launcher/
|
4
|
+
require 'avm/git/launcher/base'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module Tools
|
@@ -23,7 +23,7 @@ module Avm
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def git
|
26
|
-
@git ||= ::Avm::Launcher::
|
26
|
+
@git ||= ::Avm::Git::Launcher::Base.by_root(repository_path)
|
27
27
|
end
|
28
28
|
|
29
29
|
# @return [[EacGit::Local]]
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/launcher/stereotype'
|
4
|
+
require 'avm/projects/stereotypes'
|
5
|
+
require 'avm/tools/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner
|
10
|
+
class LauncherStereotypes
|
11
|
+
class List
|
12
|
+
runner_with :help, :output do
|
13
|
+
bool_opt '-d', '--deprecated'
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
infov 'Found', stereotypes.count
|
18
|
+
run_output
|
19
|
+
end
|
20
|
+
|
21
|
+
def output_content
|
22
|
+
stereotypes.map { |s| "#{s}\n" }.join
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def stereotypes
|
28
|
+
(parsed.deprecated? ? deprecated_stereotypes : registry_stereotypes)
|
29
|
+
end
|
30
|
+
|
31
|
+
def registry_stereotypes
|
32
|
+
::Avm::Registry.launcher_stereotypes.available.sort_by { |s| [s.name] }
|
33
|
+
end
|
34
|
+
|
35
|
+
def deprecated_stereotypes
|
36
|
+
::Avm::Launcher::Stereotype.stereotypes.sort_by { |s| [s.stereotype_name] }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.142.0
|
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: 2022-10-
|
11
|
+
date: 2022-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -36,28 +36,28 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.49'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.49'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: avm-eac_ruby_base1
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.24'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
60
|
+
version: '0.24'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: avm-eac_ubuntu_base0
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,14 +98,14 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0.
|
101
|
+
version: '0.7'
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '0.
|
108
|
+
version: '0.7'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: clipboard
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,39 +252,8 @@ files:
|
|
252
252
|
- Gemfile
|
253
253
|
- exe/avm
|
254
254
|
- lib/avm.rb
|
255
|
-
- lib/avm/launcher/git.rb
|
256
|
-
- lib/avm/launcher/git/base.rb
|
257
|
-
- lib/avm/launcher/git/base/class_methods.rb
|
258
|
-
- lib/avm/launcher/git/base/dirty_files.rb
|
259
|
-
- lib/avm/launcher/git/base/remotes.rb
|
260
|
-
- lib/avm/launcher/git/base/subrepo.rb
|
261
|
-
- lib/avm/launcher/git/base/underlying.rb
|
262
|
-
- lib/avm/launcher/git/error.rb
|
263
|
-
- lib/avm/launcher/git/mirror_update.rb
|
264
|
-
- lib/avm/launcher/git/publish_base.rb
|
265
|
-
- lib/avm/launcher/git/remote.rb
|
266
|
-
- lib/avm/launcher/git/sub_warp_base.rb
|
267
|
-
- lib/avm/launcher/git/warp_base.rb
|
268
|
-
- lib/avm/launcher/ruby.rb
|
269
|
-
- lib/avm/launcher/ruby/gem.rb
|
270
|
-
- lib/avm/launcher/ruby/gem/build.rb
|
271
|
-
- lib/avm/launcher/ruby/gem/specification.rb
|
272
255
|
- lib/avm/projects.rb
|
273
|
-
- lib/avm/projects/stereotype.rb
|
274
256
|
- lib/avm/projects/stereotypes.rb
|
275
|
-
- lib/avm/projects/stereotypes/git.rb
|
276
|
-
- lib/avm/projects/stereotypes/git/local_project_mixin.rb
|
277
|
-
- lib/avm/projects/stereotypes/git/publish.rb
|
278
|
-
- lib/avm/projects/stereotypes/git/warp.rb
|
279
|
-
- lib/avm/projects/stereotypes/git_subrepo.rb
|
280
|
-
- lib/avm/projects/stereotypes/git_subrepo/publish.rb
|
281
|
-
- lib/avm/projects/stereotypes/git_subrepo/warp.rb
|
282
|
-
- lib/avm/projects/stereotypes/git_subtree.rb
|
283
|
-
- lib/avm/projects/stereotypes/git_subtree/publish.rb
|
284
|
-
- lib/avm/projects/stereotypes/git_subtree/warp.rb
|
285
|
-
- lib/avm/projects/stereotypes/ruby_gem.rb
|
286
|
-
- lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
|
287
|
-
- lib/avm/projects/stereotypes/ruby_gem/publish.rb
|
288
257
|
- lib/avm/tools.rb
|
289
258
|
- lib/avm/tools/core_ext.rb
|
290
259
|
- lib/avm/tools/runner.rb
|
@@ -312,6 +281,8 @@ files:
|
|
312
281
|
- lib/avm/tools/runner/launcher/instances.rb
|
313
282
|
- lib/avm/tools/runner/launcher/projects.rb
|
314
283
|
- lib/avm/tools/runner/launcher/publish.rb
|
284
|
+
- lib/avm/tools/runner/launcher_stereotypes.rb
|
285
|
+
- lib/avm/tools/runner/launcher_stereotypes/list.rb
|
315
286
|
- lib/avm/tools/runner/self.rb
|
316
287
|
- lib/avm/tools/runner/self/docker.rb
|
317
288
|
- lib/avm/tools/runner/self/registry.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module Launcher
|
5
|
-
module Git
|
6
|
-
class Base < ::Avm::Launcher::Paths::Real
|
7
|
-
module ClassMethods
|
8
|
-
# @return [Avm::Launcher::Git::Base]
|
9
|
-
def by_root(search_base_path)
|
10
|
-
new(find_root(search_base_path).to_path)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Searches the root path for the Git repository which includes +search_base_path+.
|
14
|
-
# @return [Pathname]
|
15
|
-
def find_root(search_base_path)
|
16
|
-
path = search_base_path.to_pathname.expand_path
|
17
|
-
loop do
|
18
|
-
return path if path.join('.git').exist?
|
19
|
-
raise "\".git\" not found for \"#{search_base_path}\"" if path.parent.root?
|
20
|
-
|
21
|
-
path = path.parent
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_support/core_ext/object'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Launcher
|
7
|
-
module Git
|
8
|
-
class Base < ::Avm::Launcher::Paths::Real
|
9
|
-
module DirtyFiles
|
10
|
-
delegate :dirty?, to: :eac_git
|
11
|
-
|
12
|
-
def dirty_files
|
13
|
-
eac_git.dirty_files.map do |df|
|
14
|
-
::OpenStruct.new(
|
15
|
-
df.to_h.merge(path: df.path.to_path, absolute_path: df.absolute_path.to_path)
|
16
|
-
)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'avm/launcher/git/remote'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Launcher
|
8
|
-
module Git
|
9
|
-
class Base < ::Avm::Launcher::Paths::Real
|
10
|
-
module Remotes
|
11
|
-
# @return [Avm::Launcher::Git::Remote]
|
12
|
-
def remote(name)
|
13
|
-
::Avm::Launcher::Git::Remote.new(self, name)
|
14
|
-
end
|
15
|
-
|
16
|
-
def remote_hashs(remote_name)
|
17
|
-
remote(remote_name).ls
|
18
|
-
end
|
19
|
-
|
20
|
-
def remote_exist?(remote_name)
|
21
|
-
remote(remote_name).exist?
|
22
|
-
end
|
23
|
-
|
24
|
-
def assert_remote_url(remote_name, url)
|
25
|
-
r = git.remote(remote_name)
|
26
|
-
if !r.url || r.url != url
|
27
|
-
r.remove if r.url
|
28
|
-
git.add_remote(remote_name, url)
|
29
|
-
end
|
30
|
-
r
|
31
|
-
end
|
32
|
-
|
33
|
-
def remote_branch_sha(remote_name, branch_name)
|
34
|
-
remote_hashs(remote_name)["refs/heads/#{branch_name}"]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_support/core_ext/object'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Launcher
|
7
|
-
module Git
|
8
|
-
class Base < ::Avm::Launcher::Paths::Real
|
9
|
-
module Subrepo
|
10
|
-
def subrepo_status(subrepo_path)
|
11
|
-
s = execute!('subrepo', 'status', subrepo_path.gsub(%r{\A/}, ''))
|
12
|
-
raise s.strip.to_s if s.include?('is not a subrepo')
|
13
|
-
|
14
|
-
r = subrepo_status_parse_output(s)
|
15
|
-
raise "Empty subrepo status for |#{s}|\n" unless r.any?
|
16
|
-
|
17
|
-
r
|
18
|
-
end
|
19
|
-
|
20
|
-
def subrepo_remote_url(subrepo_path)
|
21
|
-
h = subrepo_status(subrepo_path)
|
22
|
-
url = h['Remote URL']
|
23
|
-
return url if url.present?
|
24
|
-
|
25
|
-
raise "Remote URL is blank for subrepo \"#{subrepo_path}\" (Subrepo status: #{h})"
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def subrepo_status_parse_output(output)
|
31
|
-
r = {}.with_indifferent_access
|
32
|
-
output.each_line do |l|
|
33
|
-
m = /\A([^\:]+)\:(.*)\z/.match(l.strip)
|
34
|
-
next unless m && m[2].present?
|
35
|
-
|
36
|
-
r[m[1].strip] = m[2].strip
|
37
|
-
end
|
38
|
-
r
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_git/executables'
|
4
|
-
require 'eac_ruby_utils/envs'
|
5
|
-
require 'git'
|
6
|
-
require 'avm/launcher/paths/real'
|
7
|
-
|
8
|
-
module Avm
|
9
|
-
module Launcher
|
10
|
-
module Git
|
11
|
-
class Base < ::Avm::Launcher::Paths::Real
|
12
|
-
module Underlying
|
13
|
-
def command(*args)
|
14
|
-
args, options = build_args(args)
|
15
|
-
r = ::EacGit::Executables.git.command(*args)
|
16
|
-
(options[:exit_outputs] || {}).each do |status_code, result|
|
17
|
-
r = r.status_result(status_code, result)
|
18
|
-
end
|
19
|
-
r
|
20
|
-
end
|
21
|
-
|
22
|
-
def execute(*args)
|
23
|
-
command(*args).execute
|
24
|
-
end
|
25
|
-
|
26
|
-
def execute!(*args)
|
27
|
-
command(*args).execute!
|
28
|
-
end
|
29
|
-
|
30
|
-
def system!(*args)
|
31
|
-
command(*args).system!
|
32
|
-
end
|
33
|
-
|
34
|
-
def init
|
35
|
-
git
|
36
|
-
self
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def build_args(args)
|
42
|
-
options = {}
|
43
|
-
if args.last.is_a?(Hash)
|
44
|
-
options = args.last
|
45
|
-
args.pop
|
46
|
-
end
|
47
|
-
args = args.first if args.first.is_a?(Array)
|
48
|
-
[['-C', self, '--no-pager'] + args, options]
|
49
|
-
end
|
50
|
-
|
51
|
-
def git_uncached
|
52
|
-
FileUtils.mkdir_p(self)
|
53
|
-
if File.exist?(subpath('.git'))
|
54
|
-
::Git.open(self)
|
55
|
-
else
|
56
|
-
::Git.init(self)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_git/local'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
require 'eac_ruby_utils/envs'
|
6
|
-
require 'avm/launcher/paths/real'
|
7
|
-
require 'avm/launcher/git/error'
|
8
|
-
|
9
|
-
module Avm
|
10
|
-
module Launcher
|
11
|
-
module Git
|
12
|
-
class Base < ::Avm::Launcher::Paths::Real
|
13
|
-
require_sub __FILE__
|
14
|
-
enable_simple_cache
|
15
|
-
extend ::Avm::Launcher::Git::Base::ClassMethods
|
16
|
-
include ::Avm::Launcher::Git::Base::DirtyFiles
|
17
|
-
include ::Avm::Launcher::Git::Base::Remotes
|
18
|
-
include ::Avm::Launcher::Git::Base::Subrepo
|
19
|
-
include ::Avm::Launcher::Git::Base::Underlying
|
20
|
-
|
21
|
-
attr_reader :eac_git
|
22
|
-
delegate :descendant?, :merge_base, :rev_parse, to: :eac_git
|
23
|
-
|
24
|
-
def initialize(path)
|
25
|
-
super(path)
|
26
|
-
|
27
|
-
@eac_git = ::EacGit::Local.new(path)
|
28
|
-
end
|
29
|
-
|
30
|
-
def init_bare
|
31
|
-
FileUtils.mkdir_p(self)
|
32
|
-
::EacRubyUtils::Envs.local.command('git', 'init', '--bare', self).execute! unless
|
33
|
-
File.exist?(subpath('.git'))
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [Pathname]
|
37
|
-
def root_path
|
38
|
-
@root_path ||= self.class.find_root(to_s)
|
39
|
-
end
|
40
|
-
|
41
|
-
def descendant?(descendant, ancestor)
|
42
|
-
base = merge_base(descendant, ancestor)
|
43
|
-
return false if base.blank?
|
44
|
-
|
45
|
-
revparse = execute!('rev-parse', '--verify', ancestor).strip
|
46
|
-
base == revparse
|
47
|
-
end
|
48
|
-
|
49
|
-
def subtree_split(prefix)
|
50
|
-
execute!('subtree', '-q', 'split', '-P', prefix).strip
|
51
|
-
end
|
52
|
-
|
53
|
-
def push(remote_name, refspecs, options = {})
|
54
|
-
refspecs = [refspecs] unless refspecs.is_a?(Array)
|
55
|
-
args = ['push']
|
56
|
-
args << '--dry-run' if options[:dryrun]
|
57
|
-
args << '--force' if options[:force]
|
58
|
-
system!(args + [remote_name] + refspecs)
|
59
|
-
end
|
60
|
-
|
61
|
-
def push_all(remote_name)
|
62
|
-
system!('push', '--all', remote_name)
|
63
|
-
system!('push', '--tags', remote_name)
|
64
|
-
end
|
65
|
-
|
66
|
-
def fetch(remote_name, options = {})
|
67
|
-
args = ['fetch', '-p', remote_name]
|
68
|
-
args += %w[--tags --prune-tags --force] if options[:tags]
|
69
|
-
execute!(*args)
|
70
|
-
end
|
71
|
-
|
72
|
-
def current_branch
|
73
|
-
execute!(%w[symbolic-ref -q HEAD]).gsub(%r{\Arefs/heads/}, '').strip
|
74
|
-
end
|
75
|
-
|
76
|
-
def reset_hard(ref)
|
77
|
-
execute!('reset', '--hard', ref)
|
78
|
-
end
|
79
|
-
|
80
|
-
def raise(message)
|
81
|
-
::Kernel.raise Avm::Launcher::Git::Error.new(self, message)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/launcher/git/base'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Launcher
|
7
|
-
module Git
|
8
|
-
class MirrorUpdate < ::Avm::Launcher::Paths::Real
|
9
|
-
include ::EacRubyUtils::SimpleCache
|
10
|
-
|
11
|
-
def initialize(target_path, source_path, source_rev)
|
12
|
-
super(target_path)
|
13
|
-
@target_git = ::Avm::Launcher::Git::Base.new(self)
|
14
|
-
@source_git = ::Avm::Launcher::Git::Base.new(source_path)
|
15
|
-
@source_rev = source_rev
|
16
|
-
run
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def run
|
22
|
-
fetch_remote_source
|
23
|
-
reset_source_rev
|
24
|
-
end
|
25
|
-
|
26
|
-
def fetch_remote_source
|
27
|
-
@target_git.git
|
28
|
-
@target_git.assert_remote_url('origin', @source_git)
|
29
|
-
@target_git.fetch('origin', tags: true)
|
30
|
-
end
|
31
|
-
|
32
|
-
def reset_source_rev
|
33
|
-
@target_git.reset_hard(@source_git.rev_parse(@source_rev, true))
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|