avm-tools 0.58.1 → 0.59.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/local_projects.rb +9 -0
- data/lib/avm/local_projects/instance.rb +28 -0
- data/lib/avm/projects.rb +9 -0
- data/lib/avm/projects/stereotype.rb +55 -0
- data/lib/avm/projects/stereotypes.rb +20 -0
- data/lib/avm/projects/stereotypes/git.rb +25 -0
- data/lib/avm/projects/stereotypes/git/publish.rb +15 -0
- data/lib/avm/projects/stereotypes/git/warp.rb +27 -0
- data/lib/avm/projects/stereotypes/git_subrepo.rb +34 -0
- data/lib/avm/projects/stereotypes/git_subrepo/publish.rb +14 -0
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +87 -0
- data/lib/avm/projects/stereotypes/git_subtree.rb +51 -0
- data/lib/avm/projects/stereotypes/git_subtree/publish.rb +12 -0
- data/lib/avm/projects/stereotypes/git_subtree/warp.rb +29 -0
- data/lib/avm/projects/stereotypes/rails_application.rb +23 -0
- data/lib/avm/projects/stereotypes/redmine_plugin.rb +23 -0
- data/lib/avm/projects/stereotypes/ruby_gem.rb +30 -0
- data/lib/avm/projects/stereotypes/ruby_gem/publish.rb +129 -0
- data/lib/avm/tools/runner/launcher.rb +10 -2
- data/lib/avm/tools/runner/launcher/instances.rb +45 -0
- data/lib/avm/tools/runner/launcher/projects.rb +50 -0
- data/lib/avm/tools/runner/launcher/publish.rb +65 -0
- data/lib/avm/tools/runner/local_project.rb +32 -0
- data/lib/avm/tools/runner/local_project/info.rb +25 -0
- data/lib/avm/tools/version.rb +1 -1
- data/lib/eac_launcher.rb +1 -2
- data/lib/eac_launcher/git/publish_base.rb +1 -0
- data/lib/eac_launcher/git/sub_warp_base.rb +1 -1
- data/lib/eac_launcher/git/warp_base.rb +2 -2
- data/lib/eac_launcher/instances/base.rb +2 -2
- data/lib/eac_launcher/instances/runner_helper.rb +1 -1
- data/lib/eac_launcher/paths/logical.rb +2 -2
- metadata +25 -21
- data/lib/eac_launcher/runner.rb +0 -21
- data/lib/eac_launcher/runner/instances.rb +0 -41
- data/lib/eac_launcher/runner/projects.rb +0 -46
- data/lib/eac_launcher/runner/publish.rb +0 -59
- data/lib/eac_launcher/stereotype.rb +0 -52
- data/lib/eac_launcher/stereotypes.rb +0 -14
- data/lib/eac_launcher/stereotypes/git.rb +0 -21
- data/lib/eac_launcher/stereotypes/git/publish.rb +0 -13
- data/lib/eac_launcher/stereotypes/git/warp.rb +0 -25
- data/lib/eac_launcher/stereotypes/git_subrepo.rb +0 -30
- data/lib/eac_launcher/stereotypes/git_subrepo/publish.rb +0 -12
- data/lib/eac_launcher/stereotypes/git_subrepo/warp.rb +0 -85
- data/lib/eac_launcher/stereotypes/git_subtree.rb +0 -47
- data/lib/eac_launcher/stereotypes/git_subtree/publish.rb +0 -10
- data/lib/eac_launcher/stereotypes/git_subtree/warp.rb +0 -27
- data/lib/eac_launcher/stereotypes/rails.rb +0 -21
- data/lib/eac_launcher/stereotypes/redmine_plugin.rb +0 -21
- data/lib/eac_launcher/stereotypes/ruby_gem.rb +0 -27
- data/lib/eac_launcher/stereotypes/ruby_gem/publish.rb +0 -127
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_launcher/git/warp_base'
|
4
|
-
|
5
|
-
module EacLauncher
|
6
|
-
module Stereotypes
|
7
|
-
class Git
|
8
|
-
class Warp < ::EacLauncher::Git::WarpBase
|
9
|
-
private
|
10
|
-
|
11
|
-
def current_ref
|
12
|
-
'HEAD'
|
13
|
-
end
|
14
|
-
|
15
|
-
def source_instance
|
16
|
-
instance
|
17
|
-
end
|
18
|
-
|
19
|
-
def source_remote_name
|
20
|
-
::EacLauncher::Stereotypes::Git::Publish::PUBLISH_GIT_REMOTE_NAME
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_launcher/git/error'
|
4
|
-
require 'eac_launcher/stereotype'
|
5
|
-
|
6
|
-
module EacLauncher
|
7
|
-
module Stereotypes
|
8
|
-
class GitSubrepo
|
9
|
-
include EacLauncher::Stereotype
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def match?(path)
|
13
|
-
File.exist?(path.real.subpath('.gitrepo')) && subrepo_url(path.real) != 'none'
|
14
|
-
end
|
15
|
-
|
16
|
-
def color
|
17
|
-
:light_cyan
|
18
|
-
end
|
19
|
-
|
20
|
-
def subrepo_url(path)
|
21
|
-
File.read(path.subpath('.gitrepo')).each_line do |l|
|
22
|
-
m = /remote\s*=\s(.+)/.match(l)
|
23
|
-
return m[1] if m
|
24
|
-
end
|
25
|
-
raise ::EacLauncher::Git::Error.new(path, '"remote = ... " not found')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/simple_cache'
|
4
|
-
require 'eac_launcher/git/sub_warp_base'
|
5
|
-
require 'eac_launcher/instances/error'
|
6
|
-
require 'eac_launcher/paths/real'
|
7
|
-
require 'eac_launcher/vendor/github'
|
8
|
-
|
9
|
-
module EacLauncher
|
10
|
-
module Stereotypes
|
11
|
-
class GitSubrepo
|
12
|
-
class Warp < ::EacLauncher::Paths::Real
|
13
|
-
include ::EacLauncher::Git::SubWarpBase
|
14
|
-
include ::EacRubyUtils::SimpleCache
|
15
|
-
|
16
|
-
attr_reader :instance
|
17
|
-
|
18
|
-
def initialize(instance)
|
19
|
-
@instance = instance
|
20
|
-
check_parent
|
21
|
-
init_aux
|
22
|
-
push_to_aux
|
23
|
-
reset
|
24
|
-
assert_target_remote
|
25
|
-
super(warped_git)
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def check_parent
|
31
|
-
return if parent_git_warped.rev_parse(subrepo_parent_hash) &&
|
32
|
-
parent_git_warped.descendant?('HEAD', subrepo_parent_hash)
|
33
|
-
|
34
|
-
raise EacLauncher::Instances::Error, "Subrepo parent hash \"#{subrepo_parent_hash}\""\
|
35
|
-
" not found in \"#{parent_git_warped}\""
|
36
|
-
end
|
37
|
-
|
38
|
-
def subrepo_parent_hash
|
39
|
-
data = parent_git_warped.subrepo_status(to_parent_git_path)
|
40
|
-
h = data['Pull Parent']
|
41
|
-
return h if h.present?
|
42
|
-
|
43
|
-
raise EacLauncher::Instances::Error, "Subrepo parent hash is blank: #{data}"
|
44
|
-
end
|
45
|
-
|
46
|
-
def init_aux
|
47
|
-
::EacLauncher::Git::Base.new(aux_path).init_bare
|
48
|
-
end
|
49
|
-
|
50
|
-
def parent_git_warped_uncached
|
51
|
-
::EacLauncher::Git::Base.new(parent_instance.warped)
|
52
|
-
end
|
53
|
-
|
54
|
-
def aux_path
|
55
|
-
instance.cache_path('subrepo_aux_git_repository')
|
56
|
-
end
|
57
|
-
|
58
|
-
def warped_git_uncached
|
59
|
-
::EacLauncher::Git::Base.new(instance.cache_path('git_repository'))
|
60
|
-
end
|
61
|
-
|
62
|
-
def push_to_aux
|
63
|
-
parent_git_warped.execute!('subrepo', 'branch', to_parent_git_path, '-fF')
|
64
|
-
h = parent_git_warped.rev_parse("subrepo/#{to_parent_git_path}", true)
|
65
|
-
parent_git_warped.execute!('push', aux_path, "#{h}:refs/heads/master", '--force')
|
66
|
-
end
|
67
|
-
|
68
|
-
def reset
|
69
|
-
::EacLauncher::Git::MirrorUpdate.new(warped_git, aux_path, 'master')
|
70
|
-
end
|
71
|
-
|
72
|
-
def assert_target_remote
|
73
|
-
warped_git.assert_remote_url(::EacLauncher::Git::WarpBase::TARGET_REMOTE,
|
74
|
-
target_remote_url)
|
75
|
-
end
|
76
|
-
|
77
|
-
def target_remote_url
|
78
|
-
::EacLauncher::Vendor::Github.to_ssh_url(
|
79
|
-
parent_git_warped.subrepo_remote_url(to_parent_git_path)
|
80
|
-
)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_launcher/stereotype'
|
4
|
-
require 'eac_launcher/stereotypes/git'
|
5
|
-
|
6
|
-
module EacLauncher
|
7
|
-
module Stereotypes
|
8
|
-
class GitSubtree
|
9
|
-
include EacLauncher::Stereotype
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def match?(path)
|
13
|
-
return false if other_git_stereotype?(path)
|
14
|
-
return false unless other_nogit_stereotype?(path)
|
15
|
-
|
16
|
-
parent = parent_git(path.parent_path)
|
17
|
-
return false unless parent
|
18
|
-
|
19
|
-
::Git.open(parent.real).remote(path.real.basename).url ? true : false
|
20
|
-
end
|
21
|
-
|
22
|
-
def color
|
23
|
-
:green
|
24
|
-
end
|
25
|
-
|
26
|
-
def parent_git(parent_path)
|
27
|
-
return nil unless parent_path
|
28
|
-
|
29
|
-
if ::EacLauncher::Stereotypes::Git.match?(parent_path)
|
30
|
-
parent_path
|
31
|
-
else
|
32
|
-
parent_git(parent_path.parent_path)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def other_git_stereotype?(path)
|
37
|
-
::EacLauncher::Stereotypes::Git.match?(path) ||
|
38
|
-
::EacLauncher::Stereotypes::GitSubrepo.match?(path)
|
39
|
-
end
|
40
|
-
|
41
|
-
def other_nogit_stereotype?(path)
|
42
|
-
EacLauncher::Stereotype.nogit_stereotypes.any? { |s| s.match?(path) }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EacLauncher
|
4
|
-
module Stereotypes
|
5
|
-
class GitSubtree
|
6
|
-
class Warp < ::EacLauncher::Git::WarpBase
|
7
|
-
include ::EacLauncher::Git::SubWarpBase
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def current_ref
|
12
|
-
instance.cache_key("git_subtree.parent.#{cache_git.git.object('HEAD').sha}") do
|
13
|
-
cache_git.subtree_split(to_parent_git_path)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def source_instance
|
18
|
-
parent_instance
|
19
|
-
end
|
20
|
-
|
21
|
-
def source_remote_name
|
22
|
-
instance.project_name
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_launcher/stereotype'
|
4
|
-
|
5
|
-
module EacLauncher
|
6
|
-
module Stereotypes
|
7
|
-
class Rails
|
8
|
-
include EacLauncher::Stereotype
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def match?(path)
|
12
|
-
File.exist?(path.real.subpath('config.ru')) && path.real.basename != 'dummy'
|
13
|
-
end
|
14
|
-
|
15
|
-
def color
|
16
|
-
:magenta
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_launcher/stereotype'
|
4
|
-
|
5
|
-
module EacLauncher
|
6
|
-
module Stereotypes
|
7
|
-
class RedminePlugin
|
8
|
-
include EacLauncher::Stereotype
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def match?(path)
|
12
|
-
File.exist?(path.real.subpath('init.rb'))
|
13
|
-
end
|
14
|
-
|
15
|
-
def color
|
16
|
-
:light_magenta
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_launcher/ruby/gem/specification'
|
4
|
-
require 'eac_launcher/stereotype'
|
5
|
-
require 'eac_launcher/stereotypes/ruby_gem/publish'
|
6
|
-
|
7
|
-
module EacLauncher
|
8
|
-
module Stereotypes
|
9
|
-
class RubyGem
|
10
|
-
include EacLauncher::Stereotype
|
11
|
-
|
12
|
-
class << self
|
13
|
-
def match?(path)
|
14
|
-
Dir.glob(File.join(path.real, '*.gemspec')).any?
|
15
|
-
end
|
16
|
-
|
17
|
-
def color
|
18
|
-
:red
|
19
|
-
end
|
20
|
-
|
21
|
-
def load_gemspec(gemspec_file)
|
22
|
-
::EacLauncher::Ruby::Gem::Specification.new(gemspec_file)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,127 +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_ruby_utils/console/speaker'
|
8
|
-
require 'eac_launcher/publish/base'
|
9
|
-
require 'eac_launcher/publish/check_result'
|
10
|
-
require 'eac_launcher/ruby/gem'
|
11
|
-
|
12
|
-
module EacLauncher
|
13
|
-
module Stereotypes
|
14
|
-
class RubyGem
|
15
|
-
class Publish < ::EacLauncher::Publish::Base
|
16
|
-
include ::EacRubyUtils::SimpleCache
|
17
|
-
include ::EacRubyUtils::Console::Speaker
|
18
|
-
|
19
|
-
protected
|
20
|
-
|
21
|
-
def internal_check
|
22
|
-
gem_published? ? internal_check_gem_published : internal_check_gem_unpublished
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def internal_check_gem_published
|
28
|
-
if version_published?
|
29
|
-
outdated_version? ? outdated_version_check_result : version_published_check_result
|
30
|
-
else
|
31
|
-
version_unpublished_check_result
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def internal_check_gem_unpublished
|
36
|
-
if new_gem_allowed?
|
37
|
-
version_unpublished_check_result
|
38
|
-
else
|
39
|
-
new_gem_disallowed_check_result
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def new_gem_disallowed_check_result
|
44
|
-
::EacLauncher::Publish::CheckResult.blocked(
|
45
|
-
"#{gem_spec.full_name} does not exist in RubyGems"
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
def version_published_check_result
|
50
|
-
::EacLauncher::Publish::CheckResult.updated("#{gem_spec.full_name} already pushed")
|
51
|
-
end
|
52
|
-
|
53
|
-
def outdated_version_check_result
|
54
|
-
::EacLauncher::Publish::CheckResult.outdated(
|
55
|
-
"#{gem_spec.full_name} is outdated (Max: #{gem_version_max})"
|
56
|
-
)
|
57
|
-
end
|
58
|
-
|
59
|
-
def version_unpublished_check_result
|
60
|
-
::EacLauncher::Publish::CheckResult.pending("#{gem_spec.full_name} not found " \
|
61
|
-
'in RubyGems')
|
62
|
-
end
|
63
|
-
|
64
|
-
def source_uncached
|
65
|
-
instance.warped
|
66
|
-
end
|
67
|
-
|
68
|
-
def gem_spec_uncached
|
69
|
-
::EacLauncher::Stereotypes::RubyGem.load_gemspec(gemspec)
|
70
|
-
end
|
71
|
-
|
72
|
-
def gem_build_uncached
|
73
|
-
::EacLauncher::Ruby::Gem::Build.new(source)
|
74
|
-
end
|
75
|
-
|
76
|
-
def publish
|
77
|
-
gem_build.build
|
78
|
-
push_gem
|
79
|
-
ensure
|
80
|
-
gem_build.close
|
81
|
-
end
|
82
|
-
|
83
|
-
def new_gem_allowed?
|
84
|
-
::EacLauncher::Context.current.publish_options[:new]
|
85
|
-
end
|
86
|
-
|
87
|
-
def gem_published?
|
88
|
-
gem_versions.any?
|
89
|
-
end
|
90
|
-
|
91
|
-
def version_published?
|
92
|
-
gem_versions.any? { |v| v['number'] == gem_spec.version }
|
93
|
-
end
|
94
|
-
|
95
|
-
def outdated_version?
|
96
|
-
gem_version_max.present? && ::Gem::Version.new(gem_spec.version) < gem_version_max
|
97
|
-
end
|
98
|
-
|
99
|
-
def gem_versions_uncached
|
100
|
-
http = Curl.get("https://rubygems.org/api/v1/versions/#{gem_spec.name}.json")
|
101
|
-
return JSON.parse!(http.body_str) if /\A2/ =~ http.status
|
102
|
-
return [] if /\A4/ =~ http.status
|
103
|
-
|
104
|
-
raise "#{http} code error: #{http.status}"
|
105
|
-
end
|
106
|
-
|
107
|
-
def gem_version_max_uncached
|
108
|
-
gem_versions.map { |v| ::Gem::Version.new(v['number']) }.max
|
109
|
-
end
|
110
|
-
|
111
|
-
def push_gem
|
112
|
-
info("Pushing gem #{gem_spec}...")
|
113
|
-
command = ['gem', 'push', gem_build.output_file]
|
114
|
-
unless ::EacLauncher::Context.current.publish_options[:confirm]
|
115
|
-
command = %w[echo] + command + %w[(Dry-run)]
|
116
|
-
end
|
117
|
-
EacRubyUtils::Envs.local.command(command).system
|
118
|
-
info('Pushed!')
|
119
|
-
end
|
120
|
-
|
121
|
-
def gemspec_uncached
|
122
|
-
source.find_file_with_extension('.gemspec')
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|