avm-tools 0.59.0 → 0.62.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/cached_download.rb +39 -0
- data/lib/avm/eac_redmine_base0/core_update.rb +110 -0
- data/lib/avm/eac_redmine_base0/data_unit.rb +27 -0
- data/lib/avm/eac_redmine_base0/deploy.rb +36 -0
- data/lib/avm/eac_redmine_base0/instance.rb +38 -0
- data/lib/avm/launcher/context/instance_manager.rb +76 -0
- data/lib/avm/launcher/context/instance_manager/cached_instance.rb +37 -0
- data/lib/avm/launcher/context/instance_manager/cached_instances.rb +35 -0
- data/lib/avm/launcher/errors/base.rb +10 -0
- data/lib/avm/launcher/errors/non_project.rb +15 -0
- data/lib/avm/launcher/instances/base.rb +94 -0
- data/lib/avm/launcher/instances/base/cache.rb +43 -0
- data/lib/avm/local_projects/instance.rb +8 -1
- data/lib/avm/local_projects/jobs/update.rb +29 -0
- data/lib/avm/projects/stereotype.rb +17 -10
- data/lib/avm/projects/stereotypes/git/local_project_mixin.rb +19 -0
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +5 -4
- data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +19 -0
- data/lib/avm/projects/stereotypes/ruby_gem/update.rb +59 -0
- data/lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb +3 -1
- data/lib/avm/sync.rb +94 -0
- data/lib/avm/tools/runner/eac_redmine_base0.rb +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +67 -0
- data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +1 -1
- data/lib/avm/tools/runner/git/issue.rb +43 -4
- data/lib/avm/tools/runner/local_project.rb +1 -1
- data/lib/avm/tools/runner/local_project/update.rb +26 -0
- data/lib/avm/tools/version.rb +1 -1
- data/lib/eac_launcher/context.rb +2 -2
- data/lib/eac_launcher/context/instance_discovery.rb +2 -2
- data/lib/eac_launcher/git/base/dirty_files.rb +5 -14
- data/lib/eac_launcher/git/sub_warp_base.rb +3 -2
- data/lib/eac_launcher/instances.rb +2 -2
- data/lib/eac_launcher/instances/error.rb +7 -3
- data/lib/eac_launcher/paths/logical.rb +2 -2
- data/lib/eac_launcher/publish/base.rb +2 -2
- data/template/avm/{stereotypes/eac_redmine_base0 → eac_redmine_base0}/deploy/config/install.sh.template +0 -0
- data/template/avm/{stereotypes/eac_redmine_base0 → eac_redmine_base0}/deploy/config/secrets.yml +0 -0
- data/vendor/eac_git/lib/eac_git/local.rb +1 -1
- data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +38 -0
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/identity_file.rb +2 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/quiet.rb +2 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb +2 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +8 -8
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +25 -11
- data/lib/avm/stereotypes/eac_redmine_base0/data_unit.rb +0 -29
- data/lib/avm/stereotypes/eac_redmine_base0/deploy.rb +0 -38
- data/lib/avm/stereotypes/eac_redmine_base0/instance.rb +0 -40
- data/lib/eac_launcher/context/instance_manager.rb +0 -94
- data/lib/eac_launcher/instances/base.rb +0 -91
- data/lib/eac_launcher/instances/base/cache.rb +0 -41
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/console/docopt_runner'
|
4
4
|
require 'eac_ruby_utils/simple_cache'
|
5
|
-
require 'avm/
|
5
|
+
require 'avm/eac_redmine_base0/instance'
|
6
6
|
require 'eac_ruby_utils/require_sub'
|
7
7
|
::EacRubyUtils.require_sub(__FILE__)
|
8
8
|
|
@@ -26,7 +26,7 @@ module Avm
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def instance_uncached
|
29
|
-
::Avm::
|
29
|
+
::Avm::EacRedmineBase0::Instance.by_id(options['<instance_id>'])
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_redmine_base0/core_update'
|
4
|
+
require 'eac_cli/default_runner'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class EacRedmineBase0 < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class CoreUpdate < ::EacRubyUtils::Console::DocoptRunner
|
13
|
+
include ::EacCli::DefaultRunner
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
arg_opt '-u', '--url', 'Core\'s package URL.'
|
17
|
+
arg_opt '-v', '--version', 'Core\'s version.'
|
18
|
+
desc 'Update instance\' core.'
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
start_banner
|
23
|
+
validate
|
24
|
+
update
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def start_banner
|
30
|
+
infov 'URL', url
|
31
|
+
infov 'Version', version
|
32
|
+
end
|
33
|
+
|
34
|
+
def update
|
35
|
+
::Avm::EacRedmineBase0::CoreUpdate.new(context(:instance), version, url).run
|
36
|
+
end
|
37
|
+
|
38
|
+
def url
|
39
|
+
options.fetch('--url') || url_by_version
|
40
|
+
end
|
41
|
+
|
42
|
+
def url_by_version
|
43
|
+
options.fetch('--version').if_present do |v|
|
44
|
+
"https://www.redmine.org/releases/redmine-#{v}.tar.gz"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def validate
|
49
|
+
%w[url version].each do |attr|
|
50
|
+
fatal_error "\"#{attr}\" is blank. See avaiable options." if send(attr).blank?
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def version
|
55
|
+
options.fetch('--version') || version_by_url
|
56
|
+
end
|
57
|
+
|
58
|
+
def version_by_url
|
59
|
+
options.fetch('--url').if_present do |v|
|
60
|
+
/(\d+.\d+.\d+)/.if_match(v, false) { |m| m[1] }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -9,6 +9,7 @@ module Avm
|
|
9
9
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
10
|
class Git < ::EacRubyUtils::Console::DocoptRunner
|
11
11
|
class Issue < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
enable_simple_cache
|
12
13
|
include ::EacRubyUtils::Console::Speaker
|
13
14
|
|
14
15
|
DOC = <<~DOCOPT
|
@@ -20,6 +21,8 @@ module Avm
|
|
20
21
|
|
21
22
|
Options:
|
22
23
|
-h --help Show this screen.
|
24
|
+
-f --uncomplete-unfail Do not exit with error if issue is not completed
|
25
|
+
or is invalid.
|
23
26
|
-s --skip-validations=<validations> Does not validate conditions on <validations>
|
24
27
|
(Comma separated value).
|
25
28
|
-y --yes Does not ask for user confirmation.
|
@@ -28,11 +31,30 @@ module Avm
|
|
28
31
|
%%VALIDATIONS%%
|
29
32
|
DOCOPT
|
30
33
|
|
31
|
-
|
32
|
-
|
34
|
+
UNCOMPLETE_MESSAGE =
|
35
|
+
|
36
|
+
def run
|
37
|
+
banner
|
38
|
+
return unless validate
|
39
|
+
|
40
|
+
run_complete if options.fetch('complete')
|
41
|
+
success('Done!')
|
42
|
+
end
|
43
|
+
|
44
|
+
def banner
|
33
45
|
complete.start_banner
|
34
|
-
|
35
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
def validate
|
49
|
+
return true if complete.valid?
|
50
|
+
|
51
|
+
uncomplete_message('Some validation did not pass')
|
52
|
+
end
|
53
|
+
|
54
|
+
def run_complete
|
55
|
+
return complete.run if confirm?
|
56
|
+
|
57
|
+
uncomplete_message('Issue was not completed')
|
36
58
|
end
|
37
59
|
|
38
60
|
def doc
|
@@ -41,6 +63,10 @@ module Avm
|
|
41
63
|
|
42
64
|
private
|
43
65
|
|
66
|
+
def complete_uncached
|
67
|
+
::Avm::Git::Issue::Complete.new(git_complete_issue_options)
|
68
|
+
end
|
69
|
+
|
44
70
|
def confirm?
|
45
71
|
options.fetch('--yes') || request_input('Confirm issue completion?', bool: true)
|
46
72
|
end
|
@@ -56,6 +82,19 @@ module Avm
|
|
56
82
|
def doc_validations_list
|
57
83
|
::Avm::Git::Issue::Complete::VALIDATIONS.keys.map { |k| " * #{k}" }.join("\n")
|
58
84
|
end
|
85
|
+
|
86
|
+
def uncomplete_unfail?
|
87
|
+
options.fetch('--uncomplete-unfail')
|
88
|
+
end
|
89
|
+
|
90
|
+
def uncomplete_message(message)
|
91
|
+
if uncomplete_unfail?
|
92
|
+
warn(message)
|
93
|
+
else
|
94
|
+
fatal_error(message)
|
95
|
+
end
|
96
|
+
false
|
97
|
+
end
|
59
98
|
end
|
60
99
|
end
|
61
100
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/local_projects/jobs/update'
|
4
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class LocalProject < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class Update < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
include ::EacCli::DefaultRunner
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Update local project.'
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
infov 'Path', context(:instance).path
|
20
|
+
::Avm::LocalProjects::Jobs::Update.new(context(:instance)).run
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
data/lib/eac_launcher/context.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/core_ext/hash/indifferent_access'
|
4
|
+
require 'avm/launcher/context/instance_manager'
|
4
5
|
require 'eac_ruby_utils/simple_cache'
|
5
6
|
require 'eac_ruby_utils/console/speaker'
|
6
7
|
require 'eac_launcher/context/instance_discovery'
|
7
|
-
require 'eac_launcher/context/instance_manager'
|
8
8
|
require 'eac_launcher/context/settings'
|
9
9
|
require 'eac_launcher/paths/logical'
|
10
10
|
require 'eac_launcher/project'
|
@@ -39,7 +39,7 @@ module EacLauncher
|
|
39
39
|
@settings = ::EacLauncher::Context::Settings.new(build_option(:settings_file))
|
40
40
|
@cache_root = build_option(:cache_root)
|
41
41
|
@publish_options = { new: false, confirm: false, stereotype: nil }
|
42
|
-
@instance_manager = ::
|
42
|
+
@instance_manager = ::Avm::Launcher::Context::InstanceManager.new(self)
|
43
43
|
@recache = false
|
44
44
|
end
|
45
45
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ruby-progressbar'
|
4
|
-
require '
|
4
|
+
require 'avm/launcher/instances/base'
|
5
5
|
|
6
6
|
module EacLauncher
|
7
7
|
class Context
|
@@ -22,7 +22,7 @@ module EacLauncher
|
|
22
22
|
update_progress_format(path)
|
23
23
|
on_rescued_path_instances(path) do |r|
|
24
24
|
if path.project?
|
25
|
-
parent_instance = ::
|
25
|
+
parent_instance = ::Avm::Launcher::Instances::Base.instanciate(path, parent_instance)
|
26
26
|
r << path
|
27
27
|
end
|
28
28
|
children = path.children
|
@@ -6,24 +6,15 @@ module EacLauncher
|
|
6
6
|
module Git
|
7
7
|
class Base < ::EacLauncher::Paths::Real
|
8
8
|
module DirtyFiles
|
9
|
-
|
10
|
-
dirty_files.any?
|
11
|
-
end
|
9
|
+
delegate :dirty, to: :eac_git
|
12
10
|
|
13
11
|
def dirty_files
|
14
|
-
|
15
|
-
|
12
|
+
eac_git.dirty_files.map do |df|
|
13
|
+
::OpenStruct.new(
|
14
|
+
df.to_h.merge(path: df.path.to_path, absolute_path: df.absolute_path.to_path)
|
15
|
+
)
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def parse_status_line(line)
|
22
|
-
m = /\A(.)(.)\s(.+)\z/.match(line)
|
23
|
-
::Kernel.raise "Status pattern does not match \"#{line}\"" unless m
|
24
|
-
::OpenStruct.new(index: m[1], worktree: m[2], path: m[3],
|
25
|
-
absolute_path: ::File.expand_path(m[3], self))
|
26
|
-
end
|
27
18
|
end
|
28
19
|
end
|
29
20
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'avm/projects/stereotype'
|
4
|
+
require 'avm/launcher/errors/base'
|
4
5
|
|
5
6
|
module EacLauncher
|
6
7
|
module Git
|
@@ -11,7 +12,7 @@ module EacLauncher
|
|
11
12
|
r = find_parent_instance(instance.parent)
|
12
13
|
return r if r
|
13
14
|
|
14
|
-
::EacLauncher::Instances::
|
15
|
+
::EacLauncher::Instances::Errors::Base.new('Git parent not found')
|
15
16
|
end
|
16
17
|
|
17
18
|
def find_parent_instance(current)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
3
|
+
require 'avm/launcher/errors/base'
|
4
|
+
require 'avm/launcher/instances/base'
|
5
5
|
require 'eac_launcher/instances/runner_helper'
|
6
6
|
require 'eac_launcher/instances/settings'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/stereotypes'
|
3
|
+
require 'avm/projects/stereotypes'
|
4
4
|
require 'eac_launcher/paths/real'
|
5
5
|
|
6
6
|
module EacLauncher
|
@@ -68,7 +68,7 @@ module EacLauncher
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def warped_uncached
|
71
|
-
if is_a?(::
|
71
|
+
if is_a?(::Avm::Launcher::Instances::Base)
|
72
72
|
stereotypes.each do |s|
|
73
73
|
return s.warp_class.new(self) if s.warp_class
|
74
74
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'avm/launcher/errors/base'
|
4
4
|
|
5
5
|
module EacLauncher
|
6
6
|
module Publish
|
@@ -35,7 +35,7 @@ module EacLauncher
|
|
35
35
|
|
36
36
|
def check_with_rescue
|
37
37
|
internal_check
|
38
|
-
rescue ::EacLauncher::Instances::
|
38
|
+
rescue ::EacLauncher::Instances::Errors::Base => e
|
39
39
|
::EacLauncher::Publish::CheckResult.blocked("Error: #{e}")
|
40
40
|
rescue ::EacLauncher::Git::Error => e
|
41
41
|
::EacLauncher::Publish::CheckResult.blocked("Git error: #{e}")
|
File without changes
|
data/template/avm/{stereotypes/eac_redmine_base0 → eac_redmine_base0}/deploy/config/secrets.yml
RENAMED
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
module EacGit
|
7
|
+
class Local
|
8
|
+
module DirtyFiles
|
9
|
+
STATUS_LINE_PATTERN = /\A(.)(.)\s(.+)\z/.freeze
|
10
|
+
|
11
|
+
def dirty?
|
12
|
+
dirty_files.any?
|
13
|
+
end
|
14
|
+
|
15
|
+
def dirty_file?(path)
|
16
|
+
absolute_path = path.to_pathname.expand_path(root_path)
|
17
|
+
dirty_files.any? do |df|
|
18
|
+
df.absolute_path == absolute_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def dirty_files
|
23
|
+
command('status', '--porcelain', '--untracked-files').execute!.each_line.map do |line|
|
24
|
+
parse_status_line(line.gsub(/\n\z/, ''))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def parse_status_line(line)
|
31
|
+
STATUS_LINE_PATTERN.if_match(line) do |m|
|
32
|
+
::OpenStruct.new(index: m[1], worktree: m[2], path: m[3].to_pathname,
|
33
|
+
absolute_path: m[3].to_pathname.expand_path(root_path))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
+
require 'eac_ruby_utils/envs/ssh_env/dasho_options'
|
4
5
|
require 'eac_ruby_utils/listable'
|
5
6
|
require 'eac_ruby_utils/patches/object/if_present'
|
6
7
|
|
@@ -11,6 +12,7 @@ module EacRubyUtils
|
|
11
12
|
extend ::ActiveSupport::Concern
|
12
13
|
|
13
14
|
included do
|
15
|
+
include ::EacRubyUtils::Envs::SshEnv::DashoOptions
|
14
16
|
add_nodasho_option('IdentityFile')
|
15
17
|
end
|
16
18
|
|