avm-tools 0.70.0 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/avm/data/instance/files_unit.rb +1 -0
- data/lib/avm/eac_rails_base0/instance.rb +2 -2
- data/lib/avm/eac_redmine_base0/instance.rb +2 -2
- data/lib/avm/git/auto_commit_path.rb +4 -2
- data/lib/avm/instances/application.rb +4 -0
- data/lib/avm/instances/base.rb +2 -1
- data/lib/avm/instances/base/auto_values.rb +2 -1
- data/lib/avm/instances/base/auto_values/access.rb +5 -4
- data/lib/avm/instances/base/auto_values/admin.rb +2 -2
- data/lib/avm/instances/base/auto_values/database.rb +1 -1
- data/lib/avm/instances/base/auto_values/filesystem.rb +6 -2
- data/lib/avm/instances/base/auto_values/mailer.rb +34 -0
- data/lib/avm/instances/base/auto_values/ruby.rb +1 -1
- data/lib/avm/instances/base/auto_values/system.rb +2 -2
- data/lib/avm/instances/entry.rb +7 -1
- data/lib/avm/instances/entry_keys.rb +42 -7
- data/lib/avm/patches/i18n.rb +1 -1
- data/lib/avm/patches/object/template.rb +1 -1
- data/lib/avm/rails/instance.rb +19 -0
- data/lib/avm/self.rb +0 -4
- data/lib/avm/self/root.rb +13 -0
- data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +41 -0
- data/lib/avm/tools/runner/instance.rb +28 -0
- data/lib/avm/tools/runner/instance/info.rb +44 -0
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/deploy/config/envvars.d/email.yml.template +11 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +19 -2
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +12 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +2 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +10 -6
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/spec/{rubocop_check_spec.rb → code/rubocop_check_spec.rb} +0 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb +43 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +12 -31
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +21 -58
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb +8 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb +67 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb +39 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +2 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb +16 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +15 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +52 -13
- metadata +16 -4
- data/lib/avm/stereotypes/rails/instance.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af0f11c7a0f00c23780d97a299a822c01a7466d5f229d4c0cbe137d11dbce8c5
|
4
|
+
data.tar.gz: 06d5dfc23be320ea36ccdf30af582effae03309c29377912760a23c832f7fac3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4b9ac7532a83c97b55c32d5655c6ae86d83d8b182eabbd9bc1dff629ca297c36c4190dea0c444b3b51dfb3a436368757b47feaa13e16ca40c8421b83966a25e
|
7
|
+
data.tar.gz: f97b797046e7e73c40b15b6c789982c2fcc095d2a01a0cbd37e4db3f483433319e36b3fc40da872625f4de4c0a636983c31ca1e6dfc95c965324b433be2d3c07
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_webapp_base0/instance'
|
4
|
-
require 'avm/
|
4
|
+
require 'avm/rails/instance'
|
5
5
|
|
6
6
|
module Avm
|
7
7
|
module EacRailsBase0
|
8
8
|
class Instance < ::Avm::EacWebappBase0::Instance
|
9
|
-
include ::Avm::
|
9
|
+
include ::Avm::Rails::Instance
|
10
10
|
|
11
11
|
FILES_UNITS = { uploads: 'public/uploads' }.freeze
|
12
12
|
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
require 'avm/eac_redmine_base0/data_unit'
|
4
4
|
require 'avm/eac_ubuntu_base0/docker_image'
|
5
5
|
require 'avm/eac_webapp_base0/instance'
|
6
|
-
require 'avm/
|
6
|
+
require 'avm/rails/instance'
|
7
7
|
|
8
8
|
module Avm
|
9
9
|
module EacRedmineBase0
|
10
10
|
class Instance < ::Avm::EacWebappBase0::Instance
|
11
|
-
include ::Avm::
|
11
|
+
include ::Avm::Rails::Instance
|
12
12
|
|
13
13
|
FILES_UNITS = { files: 'files' }.freeze
|
14
14
|
|
@@ -6,9 +6,11 @@ module Avm
|
|
6
6
|
module Git
|
7
7
|
class AutoCommitPath
|
8
8
|
enable_console_speaker
|
9
|
-
common_constructor :git, :path
|
9
|
+
common_constructor :git, :path do
|
10
|
+
self.path = path.to_pathname
|
11
|
+
end
|
10
12
|
|
11
|
-
CLASS_NAME_PATTERNS = [%r{lib/(.+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
|
13
|
+
CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
|
12
14
|
|
13
15
|
def run
|
14
16
|
banner
|
data/lib/avm/instances/base.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'eac_ruby_utils/require_sub'
|
4
4
|
require 'eac_ruby_utils/simple_cache'
|
5
5
|
require 'avm/instances/entries'
|
6
|
+
require 'avm/instances/entry_keys'
|
6
7
|
::EacRubyUtils.require_sub(__FILE__)
|
7
8
|
|
8
9
|
module Avm
|
@@ -62,7 +63,7 @@ module Avm
|
|
62
63
|
private
|
63
64
|
|
64
65
|
def source_instance_uncached
|
65
|
-
::Avm::Instances::Base.by_id(read_entry(
|
66
|
+
::Avm::Instances::Base.by_id(read_entry(::Avm::Instances::EntryKeys::SOURCE_INSTANCE_ID))
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
@@ -10,7 +10,8 @@ module Avm
|
|
10
10
|
extend ::ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
%w[Access Admin Data Database Filesystem Ruby Source System Web]
|
13
|
+
%w[Access Admin Data Database Filesystem Mailer Ruby Source System Web]
|
14
|
+
.each do |class_name|
|
14
15
|
include const_get(class_name)
|
15
16
|
end
|
16
17
|
end
|
@@ -10,19 +10,20 @@ module Avm
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def auto_ssh_hostname
|
13
|
-
inherited_entry_value(
|
13
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.hostname')
|
14
14
|
end
|
15
15
|
|
16
16
|
def auto_ssh_port
|
17
|
-
inherited_entry_value(
|
17
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.port') || 22
|
18
18
|
end
|
19
19
|
|
20
20
|
def auto_ssh_username
|
21
|
-
inherited_entry_value(
|
21
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.username')
|
22
22
|
end
|
23
23
|
|
24
24
|
def auto_ssh_url
|
25
|
-
inherited_entry_value(
|
25
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.url') ||
|
26
|
+
auto_ssh_url_by_parts
|
26
27
|
end
|
27
28
|
|
28
29
|
def auto_ssh_url_by_parts
|
@@ -6,11 +6,11 @@ module Avm
|
|
6
6
|
module AutoValues
|
7
7
|
module Admin
|
8
8
|
def auto_admin_email
|
9
|
-
inherited_entry_value(
|
9
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.email')
|
10
10
|
end
|
11
11
|
|
12
12
|
def auto_admin_name
|
13
|
-
inherited_entry_value(
|
13
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.name')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -46,7 +46,7 @@ module Avm
|
|
46
46
|
def database_auto_common(suffix)
|
47
47
|
database_key = ::Avm::Instances::EntryKeys.const_get("database_#{suffix}".upcase)
|
48
48
|
inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID, database_key) ||
|
49
|
-
inherited_entry_value(
|
49
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, database_key)
|
50
50
|
end
|
51
51
|
|
52
52
|
def database_port_by_system
|
@@ -8,11 +8,15 @@ module Avm
|
|
8
8
|
FS_PATH_KEY = :fs_path
|
9
9
|
|
10
10
|
def auto_fs_path
|
11
|
-
inherited_entry_value(
|
11
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, FS_PATH_KEY) do |v|
|
12
|
+
v + '/' + id
|
13
|
+
end
|
12
14
|
end
|
13
15
|
|
14
16
|
def auto_data_fs_path
|
15
|
-
inherited_entry_value(
|
17
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, :data_fs_path) do |v|
|
18
|
+
v + '/' + id
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def auto_fs_url
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/entry'
|
4
|
+
require 'avm/instances/entry_keys'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Instances
|
8
|
+
class Base
|
9
|
+
module AutoValues
|
10
|
+
module Mailer
|
11
|
+
::Avm::Instances::EntryKeys.all.select { |c| c.to_s.start_with?('mailer.') }
|
12
|
+
.reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
|
13
|
+
.each do |mailer_key|
|
14
|
+
define_method ::Avm::Instances::Entry.auto_value_method_name(mailer_key) do
|
15
|
+
mailer_auto_common(mailer_key)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def auto_mailer_id
|
20
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
|
21
|
+
::Avm::Instances::EntryKeys::MAILER_ID) ||
|
22
|
+
read_entry_optional(::Avm::Instances::EntryKeys::HOST_ID)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def mailer_auto_common(mailer_key)
|
28
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::MAILER_ID, mailer_key)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -8,12 +8,12 @@ module Avm
|
|
8
8
|
module AutoValues
|
9
9
|
module System
|
10
10
|
def auto_system_username
|
11
|
-
inherited_entry_value(
|
11
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.username') ||
|
12
12
|
read_entry_optional('ssh.username')
|
13
13
|
end
|
14
14
|
|
15
15
|
def auto_system_groupname
|
16
|
-
inherited_entry_value(
|
16
|
+
inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.groupname') ||
|
17
17
|
read_entry_optional('system.username')
|
18
18
|
end
|
19
19
|
end
|
data/lib/avm/instances/entry.rb
CHANGED
@@ -5,6 +5,12 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
module Avm
|
6
6
|
module Instances
|
7
7
|
class Entry
|
8
|
+
class << self
|
9
|
+
def auto_value_method_name(suffix)
|
10
|
+
"auto_#{suffix.to_s.gsub('.', '_')}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
8
14
|
common_constructor :parent, :suffix, :options
|
9
15
|
|
10
16
|
def auto_value
|
@@ -12,7 +18,7 @@ module Avm
|
|
12
18
|
end
|
13
19
|
|
14
20
|
def auto_value_method
|
15
|
-
|
21
|
+
self.class.auto_value_method_name(suffix)
|
16
22
|
end
|
17
23
|
|
18
24
|
def full_path
|
@@ -3,17 +3,52 @@
|
|
3
3
|
module Avm
|
4
4
|
module Instances
|
5
5
|
module EntryKeys
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
class << self
|
7
|
+
def all
|
8
|
+
all_keys.to_a
|
9
|
+
end
|
10
|
+
|
11
|
+
def keys_consts_set(prefix, suffixes)
|
12
|
+
if suffixes.is_a?(::Hash)
|
13
|
+
keys_consts_set_from_hash(prefix, suffixes)
|
14
|
+
elsif suffixes.is_a?(::Enumerable)
|
15
|
+
keys_consts_set_from_enum(prefix, suffixes)
|
16
|
+
else
|
17
|
+
raise "Unmapped suffixes class: #{suffixes.class}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def key_const_set(prefix, suffix)
|
22
|
+
key = [prefix, suffix].reject(&:blank?).join('.')
|
12
23
|
const_set(key.gsub('.', '_').upcase, key)
|
24
|
+
all_keys << key
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def all_keys
|
30
|
+
@all_keys ||= ::Set.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def keys_consts_set_from_enum(prefix, suffixes)
|
34
|
+
suffixes.each { |suffix| key_const_set(prefix, suffix) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def keys_consts_set_from_hash(prefix, suffixes)
|
38
|
+
suffixes.each { |k, v| keys_consts_set(prefix.to_s + (k.blank? ? '' : ".#{k}"), v) }
|
13
39
|
end
|
14
40
|
end
|
15
41
|
|
16
|
-
|
42
|
+
{
|
43
|
+
'' => %w[fs_path host_id source_instance_id],
|
44
|
+
database: %w[id hostname name password port system username],
|
45
|
+
mailer: {
|
46
|
+
'' => %w[id from reply_to],
|
47
|
+
smtp: %w[address port domain username password authentication starttls_auto]
|
48
|
+
},
|
49
|
+
ssh: %w[hostname port url username],
|
50
|
+
web: %w[authority hostname path port scheme url userinfo]
|
51
|
+
}.each { |prefix, suffixes| keys_consts_set(prefix, suffixes) }
|
17
52
|
end
|
18
53
|
end
|
19
54
|
end
|
data/lib/avm/patches/i18n.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module Rails
|
5
|
+
module Instance
|
6
|
+
def bundle(*args)
|
7
|
+
the_gem.bundle(*args).chdir_root.envvar('RAILS_ENV', 'production')
|
8
|
+
end
|
9
|
+
|
10
|
+
def rake(*args)
|
11
|
+
bundle('exec', 'rake', *args)
|
12
|
+
end
|
13
|
+
|
14
|
+
def the_gem
|
15
|
+
@the_gem ||= ::EacRubyGemsUtils::Gem.new(::File.join(read_entry('fs_path')), host_env)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/avm/self.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/entry_keys'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
require 'shellwords'
|
7
|
+
|
8
|
+
module Avm
|
9
|
+
module Tools
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
|
12
|
+
class RailsServer
|
13
|
+
runner_with
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
desc 'Run the embbeded Rails web server.'
|
17
|
+
arg_opt '-e', '--environment', 'Specifies the environment to run this server under' \
|
18
|
+
' (development/test/production).'
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
infov 'Bundle args', ::Shellwords.join(bundle_args)
|
23
|
+
infov 'Result', command.system
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def bundle_args
|
29
|
+
['exec', 'rails', 'server', '--port',
|
30
|
+
runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)] +
|
31
|
+
parsed.environment.if_present([]) { |v| ['--environment', v] }
|
32
|
+
end
|
33
|
+
|
34
|
+
def command
|
35
|
+
runner_context.call(:instance).bundle(*bundle_args).chdir_root
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/base'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Tools
|
9
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
10
|
+
class Instance < ::EacRubyUtils::Console::DocoptRunner
|
11
|
+
require_sub __FILE__
|
12
|
+
runner_with
|
13
|
+
|
14
|
+
runner_definition do
|
15
|
+
desc 'Utilities for generic instances.'
|
16
|
+
pos_arg :instance_id
|
17
|
+
subcommands
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def instance_uncached
|
23
|
+
::Avm::Instances::Base.by_id(options['<instance_id>'])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|