avm-tools 0.141.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/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 -21
- 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
|
@@ -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
|
@@ -254,19 +254,6 @@ files:
|
|
254
254
|
- lib/avm.rb
|
255
255
|
- lib/avm/projects.rb
|
256
256
|
- lib/avm/projects/stereotypes.rb
|
257
|
-
- lib/avm/projects/stereotypes/git.rb
|
258
|
-
- lib/avm/projects/stereotypes/git/local_project_mixin.rb
|
259
|
-
- lib/avm/projects/stereotypes/git/publish.rb
|
260
|
-
- lib/avm/projects/stereotypes/git/warp.rb
|
261
|
-
- lib/avm/projects/stereotypes/git_subrepo.rb
|
262
|
-
- lib/avm/projects/stereotypes/git_subrepo/publish.rb
|
263
|
-
- lib/avm/projects/stereotypes/git_subrepo/warp.rb
|
264
|
-
- lib/avm/projects/stereotypes/git_subtree.rb
|
265
|
-
- lib/avm/projects/stereotypes/git_subtree/publish.rb
|
266
|
-
- lib/avm/projects/stereotypes/git_subtree/warp.rb
|
267
|
-
- lib/avm/projects/stereotypes/ruby_gem.rb
|
268
|
-
- lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
|
269
|
-
- lib/avm/projects/stereotypes/ruby_gem/publish.rb
|
270
257
|
- lib/avm/tools.rb
|
271
258
|
- lib/avm/tools/core_ext.rb
|
272
259
|
- lib/avm/tools/runner.rb
|
@@ -294,6 +281,8 @@ files:
|
|
294
281
|
- lib/avm/tools/runner/launcher/instances.rb
|
295
282
|
- lib/avm/tools/runner/launcher/projects.rb
|
296
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
|
297
286
|
- lib/avm/tools/runner/self.rb
|
298
287
|
- lib/avm/tools/runner/self/docker.rb
|
299
288
|
- lib/avm/tools/runner/self/registry.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_git/local'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotypes
|
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
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/git/launcher/publish_base'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Projects
|
7
|
-
module Stereotypes
|
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
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/git/launcher/warp_base'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Projects
|
7
|
-
module Stereotypes
|
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::Projects::Stereotypes::Git::Publish::PUBLISH_GIT_REMOTE_NAME
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/launcher/stereotype'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotypes
|
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
|
@@ -1,88 +0,0 @@
|
|
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 Projects
|
11
|
-
module Stereotypes
|
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
|
@@ -1,34 +0,0 @@
|
|
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 Projects
|
9
|
-
module Stereotypes
|
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
|
@@ -1,32 +0,0 @@
|
|
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 Projects
|
8
|
-
module Stereotypes
|
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
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/launcher/stereotype'
|
4
|
-
require 'avm/projects/stereotypes/git'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Projects
|
9
|
-
module Stereotypes
|
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::Projects::Stereotypes::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::Projects::Stereotypes::Git.match?(path) ||
|
41
|
-
::Avm::Projects::Stereotypes::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
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/eac_ruby_base1/sources/base'
|
4
|
-
require 'avm/version_number'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Projects
|
9
|
-
module Stereotypes
|
10
|
-
class RubyGem
|
11
|
-
module LocalProjectMixin
|
12
|
-
# @return [Avm::EacRubyBase1::Sources::Base]
|
13
|
-
def ruby_gem
|
14
|
-
@ruby_gem ||= ::Avm::EacRubyBase1::Sources::Base.new(path)
|
15
|
-
end
|
16
|
-
|
17
|
-
def version
|
18
|
-
ruby_gem.version.if_present { |v| ::Avm::VersionNumber.new(v) }
|
19
|
-
end
|
20
|
-
|
21
|
-
def version=(value)
|
22
|
-
ruby_gem.version_file.value = value
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'curb'
|
4
|
-
require 'json'
|
5
|
-
require 'eac_ruby_utils/simple_cache'
|
6
|
-
require 'rubygems'
|
7
|
-
require 'eac_cli/speaker'
|
8
|
-
require 'avm/launcher/publish/base'
|
9
|
-
require 'avm/launcher/publish/check_result'
|
10
|
-
require 'avm/eac_ruby_base1/launcher/gem'
|
11
|
-
|
12
|
-
module Avm
|
13
|
-
module Projects
|
14
|
-
module Stereotypes
|
15
|
-
class RubyGem
|
16
|
-
class Publish < ::Avm::Launcher::Publish::Base
|
17
|
-
include ::EacRubyUtils::SimpleCache
|
18
|
-
enable_speaker
|
19
|
-
|
20
|
-
protected
|
21
|
-
|
22
|
-
def internal_check
|
23
|
-
gem_published? ? internal_check_gem_published : internal_check_gem_unpublished
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def internal_check_gem_published
|
29
|
-
if version_published?
|
30
|
-
outdated_version? ? outdated_version_check_result : version_published_check_result
|
31
|
-
else
|
32
|
-
version_unpublished_check_result
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def internal_check_gem_unpublished
|
37
|
-
if new_gem_allowed?
|
38
|
-
version_unpublished_check_result
|
39
|
-
else
|
40
|
-
new_gem_disallowed_check_result
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def new_gem_disallowed_check_result
|
45
|
-
::Avm::Launcher::Publish::CheckResult.blocked(
|
46
|
-
"#{gem_spec.full_name} does not exist in RubyGems"
|
47
|
-
)
|
48
|
-
end
|
49
|
-
|
50
|
-
def version_published_check_result
|
51
|
-
::Avm::Launcher::Publish::CheckResult.updated("#{gem_spec.full_name} already pushed")
|
52
|
-
end
|
53
|
-
|
54
|
-
def outdated_version_check_result
|
55
|
-
::Avm::Launcher::Publish::CheckResult.outdated(
|
56
|
-
"#{gem_spec.full_name} is outdated (Max: #{gem_version_max})"
|
57
|
-
)
|
58
|
-
end
|
59
|
-
|
60
|
-
def version_unpublished_check_result
|
61
|
-
::Avm::Launcher::Publish::CheckResult.pending("#{gem_spec.full_name} not found " \
|
62
|
-
'in RubyGems')
|
63
|
-
end
|
64
|
-
|
65
|
-
def source_uncached
|
66
|
-
instance.warped
|
67
|
-
end
|
68
|
-
|
69
|
-
def gem_spec_uncached
|
70
|
-
::Avm::Projects::Stereotypes::RubyGem.load_gemspec(gemspec)
|
71
|
-
end
|
72
|
-
|
73
|
-
def gem_build_uncached
|
74
|
-
::Avm::EacRubyBase1::Launcher::Gem::Build.new(source)
|
75
|
-
end
|
76
|
-
|
77
|
-
def publish
|
78
|
-
gem_build.build
|
79
|
-
push_gem
|
80
|
-
ensure
|
81
|
-
gem_build.close
|
82
|
-
end
|
83
|
-
|
84
|
-
def new_gem_allowed?
|
85
|
-
::Avm::Launcher::Context.current.publish_options[:new]
|
86
|
-
end
|
87
|
-
|
88
|
-
def gem_published?
|
89
|
-
gem_versions.any?
|
90
|
-
end
|
91
|
-
|
92
|
-
def version_published?
|
93
|
-
gem_versions.any? { |v| v['number'] == gem_spec.version }
|
94
|
-
end
|
95
|
-
|
96
|
-
def outdated_version?
|
97
|
-
gem_version_max.present? && ::Gem::Version.new(gem_spec.version) < gem_version_max
|
98
|
-
end
|
99
|
-
|
100
|
-
def gem_versions_uncached
|
101
|
-
http = Curl.get("https://rubygems.org/api/v1/versions/#{gem_spec.name}.json")
|
102
|
-
return JSON.parse!(http.body_str) if /\A2/ =~ http.status
|
103
|
-
return [] if /\A4/ =~ http.status
|
104
|
-
|
105
|
-
raise "#{http} code error: #{http.status}"
|
106
|
-
end
|
107
|
-
|
108
|
-
def gem_version_max_uncached
|
109
|
-
gem_versions.map { |v| ::Gem::Version.new(v['number']) }.max
|
110
|
-
end
|
111
|
-
|
112
|
-
def push_gem
|
113
|
-
info("Pushing gem #{gem_spec}...")
|
114
|
-
command = ['gem', 'push', gem_build.output_file]
|
115
|
-
unless ::Avm::Launcher::Context.current.publish_options[:confirm]
|
116
|
-
command = %w[echo] + command + %w[(Dry-run)]
|
117
|
-
end
|
118
|
-
EacRubyUtils::Envs.local.command(command).system
|
119
|
-
info('Pushed!')
|
120
|
-
end
|
121
|
-
|
122
|
-
def gemspec_uncached
|
123
|
-
source.find_file_with_extension('.gemspec')
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/eac_ruby_base1/launcher/gem/specification'
|
4
|
-
require 'avm/launcher/stereotype'
|
5
|
-
require 'eac_ruby_utils/core_ext'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Projects
|
9
|
-
module Stereotypes
|
10
|
-
class RubyGem
|
11
|
-
require_sub __FILE__
|
12
|
-
include Avm::Launcher::Stereotype
|
13
|
-
|
14
|
-
class << self
|
15
|
-
def match?(path)
|
16
|
-
Dir.glob(File.join(path.real, '*.gemspec')).any?
|
17
|
-
end
|
18
|
-
|
19
|
-
def color
|
20
|
-
:red
|
21
|
-
end
|
22
|
-
|
23
|
-
def load_gemspec(gemspec_file)
|
24
|
-
::Avm::EacRubyBase1::Launcher::Gem::Specification.new(gemspec_file)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|