avm-tools 0.58.0 → 0.62.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/cached_download.rb +39 -0
  3. data/lib/avm/eac_redmine_base0/core_update.rb +110 -0
  4. data/lib/avm/eac_redmine_base0/data_unit.rb +27 -0
  5. data/lib/avm/eac_redmine_base0/deploy.rb +36 -0
  6. data/lib/avm/eac_redmine_base0/instance.rb +38 -0
  7. data/lib/avm/local_projects.rb +9 -0
  8. data/lib/avm/local_projects/instance.rb +35 -0
  9. data/lib/avm/local_projects/jobs/update.rb +29 -0
  10. data/lib/avm/projects.rb +9 -0
  11. data/lib/avm/projects/stereotype.rb +62 -0
  12. data/lib/avm/projects/stereotypes.rb +20 -0
  13. data/lib/avm/projects/stereotypes/git.rb +25 -0
  14. data/lib/avm/projects/stereotypes/git/local_project_mixin.rb +19 -0
  15. data/lib/avm/projects/stereotypes/git/publish.rb +15 -0
  16. data/lib/avm/projects/stereotypes/git/warp.rb +27 -0
  17. data/lib/avm/projects/stereotypes/git_subrepo.rb +34 -0
  18. data/lib/avm/projects/stereotypes/git_subrepo/publish.rb +14 -0
  19. data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +87 -0
  20. data/lib/avm/projects/stereotypes/git_subtree.rb +51 -0
  21. data/lib/avm/projects/stereotypes/git_subtree/publish.rb +12 -0
  22. data/lib/avm/projects/stereotypes/git_subtree/warp.rb +29 -0
  23. data/lib/avm/projects/stereotypes/rails_application.rb +23 -0
  24. data/lib/avm/projects/stereotypes/redmine_plugin.rb +23 -0
  25. data/lib/avm/projects/stereotypes/ruby_gem.rb +30 -0
  26. data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +19 -0
  27. data/lib/avm/projects/stereotypes/ruby_gem/publish.rb +129 -0
  28. data/lib/avm/projects/stereotypes/ruby_gem/update.rb +59 -0
  29. data/lib/avm/sync.rb +94 -0
  30. data/lib/avm/tools/runner/eac_redmine_base0.rb +2 -2
  31. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +67 -0
  32. data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +1 -1
  33. data/lib/avm/tools/runner/git/issue.rb +43 -4
  34. data/lib/avm/tools/runner/launcher.rb +10 -2
  35. data/lib/avm/tools/runner/launcher/instances.rb +45 -0
  36. data/lib/avm/tools/runner/launcher/projects.rb +50 -0
  37. data/lib/avm/tools/runner/launcher/publish.rb +65 -0
  38. data/lib/avm/tools/runner/local_project.rb +32 -0
  39. data/lib/avm/tools/runner/local_project/info.rb +25 -0
  40. data/lib/avm/tools/runner/local_project/update.rb +26 -0
  41. data/lib/avm/tools/version.rb +1 -1
  42. data/lib/eac_launcher.rb +1 -2
  43. data/lib/eac_launcher/context/instance_manager.rb +1 -0
  44. data/lib/eac_launcher/git/base/dirty_files.rb +5 -14
  45. data/lib/eac_launcher/git/publish_base.rb +1 -0
  46. data/lib/eac_launcher/git/sub_warp_base.rb +1 -1
  47. data/lib/eac_launcher/git/warp_base.rb +2 -2
  48. data/lib/eac_launcher/instances/base.rb +2 -2
  49. data/lib/eac_launcher/instances/runner_helper.rb +1 -1
  50. data/lib/eac_launcher/paths/logical.rb +2 -2
  51. data/vendor/eac_git/lib/eac_git/local.rb +1 -1
  52. data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +38 -0
  53. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  54. data/vendor/eac_git/vendor/git-subrepo/lib/git-subrepo.d/bash+.bash +1 -1
  55. data/vendor/eac_ruby_gems_utils/LICENCE +16 -674
  56. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +10 -2
  57. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +2 -1
  58. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  59. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb +31 -0
  60. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +1 -1
  61. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env.rb +10 -18
  62. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/dasho_options.rb +53 -0
  63. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/identity_file.rb +25 -0
  64. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/quiet.rb +24 -0
  65. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb +34 -0
  66. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +5 -0
  67. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +8 -8
  68. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  69. metadata +52 -28
  70. data/lib/avm/stereotypes/eac_redmine_base0/data_unit.rb +0 -29
  71. data/lib/avm/stereotypes/eac_redmine_base0/deploy.rb +0 -38
  72. data/lib/avm/stereotypes/eac_redmine_base0/instance.rb +0 -40
  73. data/lib/eac_launcher/runner.rb +0 -21
  74. data/lib/eac_launcher/runner/instances.rb +0 -41
  75. data/lib/eac_launcher/runner/projects.rb +0 -46
  76. data/lib/eac_launcher/runner/publish.rb +0 -59
  77. data/lib/eac_launcher/stereotype.rb +0 -52
  78. data/lib/eac_launcher/stereotypes.rb +0 -14
  79. data/lib/eac_launcher/stereotypes/git.rb +0 -21
  80. data/lib/eac_launcher/stereotypes/git/publish.rb +0 -13
  81. data/lib/eac_launcher/stereotypes/git/warp.rb +0 -25
  82. data/lib/eac_launcher/stereotypes/git_subrepo.rb +0 -30
  83. data/lib/eac_launcher/stereotypes/git_subrepo/publish.rb +0 -12
  84. data/lib/eac_launcher/stereotypes/git_subrepo/warp.rb +0 -85
  85. data/lib/eac_launcher/stereotypes/git_subtree.rb +0 -47
  86. data/lib/eac_launcher/stereotypes/git_subtree/publish.rb +0 -10
  87. data/lib/eac_launcher/stereotypes/git_subtree/warp.rb +0 -27
  88. data/lib/eac_launcher/stereotypes/rails.rb +0 -21
  89. data/lib/eac_launcher/stereotypes/redmine_plugin.rb +0 -21
  90. data/lib/eac_launcher/stereotypes/ruby_gem.rb +0 -27
  91. data/lib/eac_launcher/stereotypes/ruby_gem/publish.rb +0 -127
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/data/instance/unit'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'open-uri'
6
-
7
- module Avm
8
- module Stereotypes
9
- module EacRedmineBase0
10
- class DataUnit < ::Avm::Data::Instance::Unit
11
- common_constructor :instance
12
-
13
- EXTENSION = '.tar'
14
-
15
- def do_dump(data_path)
16
- ::File.open(data_path, 'wb') do |file|
17
- file << URI.parse(export_url).read
18
- end
19
- end
20
-
21
- def export_url
22
- uri = ::Addressable::URI.parse(instance.read_entry('web.url')) + '/backup/export'
23
- uri.query_values = { key: instance.read_entry('admin.api_key') }
24
- uri.to_s
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/stereotypes/eac_webapp_base0/deploy'
4
- require 'eac_ruby_utils/ruby'
5
-
6
- module Avm
7
- module Stereotypes
8
- module EacRedmineBase0
9
- class Deploy < ::Avm::Stereotypes::EacWebappBase0::Deploy
10
- set_callback :assert_instance_branch, :after, :run_installer
11
-
12
- def run_installer
13
- infom 'Running installer'
14
- ::EacRubyUtils::Ruby.on_clean_environment do
15
- installer_command.system!
16
- end
17
- end
18
-
19
- def installer_command
20
- instance.host_env.command(installer_path, install_task)
21
- end
22
-
23
- def installer_path
24
- ::File.join(instance.read_entry(:fs_path), 'plugins', 'redmine_installer', 'installer',
25
- 'run.sh')
26
- end
27
-
28
- def install_task
29
- if instance.read_entry_optional('web.path').present?
30
- 'redmine_as_apache_path'
31
- else
32
- 'redmine_as_apache_base'
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/stereotypes/eac_redmine_base0/data_unit'
4
- require 'avm/stereotypes/eac_ubuntu_base0/docker_image'
5
- require 'avm/stereotypes/eac_webapp_base0/instance'
6
- require 'avm/stereotypes/rails/instance'
7
-
8
- module Avm
9
- module Stereotypes
10
- module EacRedmineBase0
11
- class Instance < ::Avm::Stereotypes::EacWebappBase0::Instance
12
- include ::Avm::Stereotypes::Rails::Instance
13
-
14
- FILES_UNITS = { files: 'files' }.freeze
15
-
16
- def docker_image_class
17
- ::Avm::Stereotypes::EacUbuntuBase0::DockerImage
18
- end
19
-
20
- def docker_run_arguments
21
- [
22
- '--volume', "#{read_entry(:fs_path)}:/home/myuser/eac_redmine_base0",
23
- '--publish', "#{read_entry(:ssh_port)}:22",
24
- '--publish', "#{read_entry(:http_port)}:80",
25
- '--publish', "#{read_entry(:https_port)}:443"
26
- ]
27
- end
28
-
29
- def data_package
30
- @data_package ||= ::Avm::Data::Instance::Package.new(
31
- self,
32
- units: {
33
- all: ::Avm::Stereotypes::EacRedmineBase0::DataUnit.new(self)
34
- }
35
- )
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_launcher/runner/instances'
5
- require 'eac_launcher/runner/projects'
6
- require 'eac_launcher/runner/publish'
7
-
8
- module EacLauncher
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
10
- DOC = <<~DOCOPT
11
- Utilities to deploy applications and libraries.
12
-
13
- Usage:
14
- __PROGRAM__ [options] __SUBCOMMANDS__
15
- __PROGRAM__ -h | --help
16
-
17
- Options:
18
- -h --help Show this screen.
19
- DOCOPT
20
- end
21
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_launcher/instances/runner_helper'
4
-
5
- module EacLauncher
6
- class Runner < ::EacRubyUtils::Console::DocoptRunner
7
- class Instances < ::EacLauncher::Instances::RunnerHelper
8
- DOC = <<~DOCOPT
9
- Mostra informações sobre instâncias.
10
-
11
- Usage:
12
- __PROGRAM__ [options] [<instance_path>...]
13
- __PROGRAM__ -h | --help
14
-
15
- Options:
16
- -h --help Show this screen.
17
- --all Get all instances.
18
- --recache Rewrite instances cache.
19
-
20
- DOCOPT
21
-
22
- def run
23
- ::EacLauncher::Context.current.recache = options['--recache']
24
- instances.each { |i| show_instance(i) }
25
- end
26
-
27
- private
28
-
29
- def show_instance(instance)
30
- puts instance_label(instance)
31
- infov(' * Parent', (instance.parent ? instance_label(instance.parent) : '-'))
32
- infov(' * Git current revision', instance.options.git_current_revision)
33
- infov(' * Git publish remote', instance.options.git_publish_remote)
34
- end
35
-
36
- def instance_path
37
- options['<instance_path>']
38
- end
39
- end
40
- end
41
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_launcher/context'
4
- require 'eac_launcher/instances/runner_helper'
5
-
6
- module EacLauncher
7
- class Runner < ::EacRubyUtils::Console::DocoptRunner
8
- class Projects < ::EacLauncher::Instances::RunnerHelper
9
- DOC = <<~DOCOPT
10
- Shows available projects.
11
-
12
- Usage:
13
- __PROGRAM__ [options]
14
- __PROGRAM__ -h | --help
15
-
16
- Options:
17
- -h --help Show this screen.
18
- -i --instances Show instances.
19
- --recache Rewrite instances cache.
20
-
21
- DOCOPT
22
-
23
- def run
24
- ::EacLauncher::Context.current.recache = options['--recache']
25
- ::EacLauncher::Context.current.projects.each do |p|
26
- show_project(p)
27
- end
28
- end
29
-
30
- private
31
-
32
- def show_project(project)
33
- puts project_label(project)
34
- return unless options['--instances']
35
-
36
- project.instances.each do |i|
37
- puts " * #{instance_label(i)}"
38
- end
39
- end
40
-
41
- def project_label(project)
42
- project.to_s.cyan.to_s
43
- end
44
- end
45
- end
46
- end
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EacLauncher
4
- class Runner < ::EacRubyUtils::Console::DocoptRunner
5
- class Publish < ::EacLauncher::Instances::RunnerHelper
6
- DOC = <<~DOCOPT
7
- Publica projetos ou instâncias.
8
-
9
- Usage:
10
- __PROGRAM__ [options] [<instance_path>...]
11
- __PROGRAM__ -h | --help
12
-
13
- Options:
14
- -h --help Show this screen.
15
- --new Publish projects not published before.
16
- -s --stereotype=<st> Publish only for stereotype <stereotype>.
17
- --all Publish all instances.
18
- -d --dry-run "Dry run" publishing.
19
- --pending Publish only pending.
20
- --recache Rewrite instances cache.
21
- --run Confirm publishing.
22
-
23
- DOCOPT
24
-
25
- def run
26
- ::EacLauncher::Context.current.recache = options['--recache']
27
- build_publish_options
28
- instances.each do |i|
29
- next unless i.options.publishable?
30
-
31
- i.send(instance_method)
32
- end
33
- end
34
-
35
- private
36
-
37
- def dry_run?
38
- options.fetch('--dry-run')
39
- end
40
-
41
- def instance_method
42
- run? || dry_run? ? 'publish_run' : 'publish_check'
43
- end
44
-
45
- def build_publish_options
46
- ::EacLauncher::Context.current.publish_options = publish_options
47
- end
48
-
49
- def publish_options
50
- { new: options.fetch('--new'), stereotype: options.fetch('--stereotype'),
51
- confirm: run? }
52
- end
53
-
54
- def run?
55
- options.fetch('--run') && !dry_run?
56
- end
57
- end
58
- end
59
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/core_ext/string/inflections'
4
-
5
- module EacLauncher
6
- module Stereotype
7
- class << self
8
- attr_reader :stereotypes
9
-
10
- def included(base)
11
- @stereotypes ||= []
12
- @stereotypes << base
13
- base.extend(ClassMethods)
14
- end
15
-
16
- def git_stereotypes
17
- stereotypes.select { |c| c.name.demodulize.downcase.match('git') }
18
- end
19
-
20
- def nogit_stereotypes
21
- stereotypes - git_stereotypes
22
- end
23
- end
24
-
25
- module ClassMethods
26
- def stereotype_name
27
- name.gsub(/^.*::/, '')
28
- end
29
-
30
- def stereotype_name_in_color
31
- stereotype_name.send(color)
32
- end
33
-
34
- def publish_class
35
- sub_class('Publish')
36
- end
37
-
38
- def warp_class
39
- sub_class('Warp')
40
- end
41
-
42
- private
43
-
44
- def sub_class(sub_class_name)
45
- klass = const_get(sub_class_name)
46
- klass.is_a?(Class) ? klass : nil
47
- rescue NameError
48
- nil
49
- end
50
- end
51
- end
52
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_launcher/stereotypes/git'
4
- require 'eac_launcher/stereotypes/git_subrepo'
5
- require 'eac_launcher/stereotypes/git_subtree'
6
- require 'eac_launcher/stereotypes/rails'
7
- require 'eac_launcher/stereotypes/redmine_plugin'
8
- require 'eac_launcher/stereotypes/ruby_gem'
9
- require 'eac_launcher/stereotypes/git/publish'
10
- require 'eac_launcher/stereotypes/git/warp'
11
- require 'eac_launcher/stereotypes/git_subrepo/publish'
12
- require 'eac_launcher/stereotypes/git_subrepo/warp'
13
- require 'eac_launcher/stereotypes/git_subtree/publish'
14
- require 'eac_launcher/stereotypes/git_subtree/warp'
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_launcher/stereotype'
4
-
5
- module EacLauncher
6
- module Stereotypes
7
- class Git
8
- include EacLauncher::Stereotype
9
-
10
- class << self
11
- def match?(path)
12
- File.directory?(path.real.subpath('.git'))
13
- end
14
-
15
- def color
16
- :white
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_launcher/git/publish_base'
4
-
5
- module EacLauncher
6
- module Stereotypes
7
- class Git
8
- class Publish < ::EacLauncher::Git::PublishBase
9
- PUBLISH_GIT_REMOTE_NAME = 'publish'
10
- end
11
- end
12
- end
13
- end
@@ -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