avm-eac_webapp_base0 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7d88917618e58dd86f0575b8fa70c8fbda2e04b6e9ceb54bfe350a05e767e0a9
4
+ data.tar.gz: c279ea8f789b6e0881afa267ec4fd0392805e10d7912d1555dd1b8ef1b5af633
5
+ SHA512:
6
+ metadata.gz: 7145567f004c11063a6404a22c8e23766d08c48669f5cbf7e3eaf479ba34c10751127fef92d88fbda0e19a58a1e01f6802fa1b45dfd65ff6679cb61bf0eee3b6
7
+ data.tar.gz: 3d07444d1e1e5431c36a6aa1a877631be8b1fcf223c4782ea2f11d85fa73c006dcaf1ed1411398badb57aed62d91f2ba8d7764d98048eafeecd04b2a9305414a
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/apps/jobs/base'
5
+ require 'avm/patches/object/template'
6
+ require 'avm/eac_ubuntu_base0/apache'
7
+ require 'avm/patches/object/template'
8
+
9
+ module Avm
10
+ module EacWebappBase0
11
+ class ApacheHost
12
+ JOBS = %w[write_available_no_ssl_site enable_no_ssl_site remove_ssl_site reload_apache
13
+ run_certbot enable_ssl_site reload_apache].freeze
14
+ include ::Avm::Apps::Jobs::Base
15
+
16
+ def no_ssl_site_content
17
+ ::Avm::EacWebappBase0::ApacheHost
18
+ .template.child('no_ssl.conf')
19
+ .apply(variables_source)
20
+ end
21
+
22
+ def ssl?
23
+ options[:certbot]
24
+ end
25
+
26
+ private
27
+
28
+ def apache_uncached
29
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
30
+ end
31
+
32
+ def enable_no_ssl_site
33
+ infom 'Enabling no SSL site...'
34
+ no_ssl_site.enable
35
+ end
36
+
37
+ def enable_ssl_site
38
+ return unless ssl?
39
+
40
+ infom 'Enabling SSL site...'
41
+ ssl_site.enable
42
+ end
43
+
44
+ def no_ssl_site_uncached
45
+ apache.site(instance.id)
46
+ end
47
+
48
+ def reload_apache
49
+ infom 'Reloading Apache...'
50
+ apache.service('reload')
51
+ end
52
+
53
+ def remove_ssl_site
54
+ infom 'Removing SSL site...'
55
+ ssl_site.remove
56
+ end
57
+
58
+ def run_certbot
59
+ return unless ssl?
60
+
61
+ infom 'Running Certbot...'
62
+ instance.host_env.command(
63
+ 'sudo', 'certbot', '--apache', '--domain', instance.read_entry('web.hostname'),
64
+ '--redirect', '--non-interactive', '--agree-tos',
65
+ '--email', instance.read_entry('admin.email')
66
+ ).system!
67
+ end
68
+
69
+ def ssl_site_uncached
70
+ apache.site(no_ssl_site.name + '-le-ssl')
71
+ end
72
+
73
+ def write_available_no_ssl_site
74
+ infom 'Writing no SSL site conf...'
75
+ no_ssl_site.write(no_ssl_site_content)
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/apps/jobs/base'
4
+ require 'avm/eac_ubuntu_base0/apache'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacWebappBase0
9
+ class ApachePath
10
+ JOBS = %w[write_available_conf enable_conf reload_apache].freeze
11
+ include ::Avm::Apps::Jobs::Base
12
+
13
+ def content
14
+ ::Avm::EacWebappBase0::ApachePath.template.child('default.conf').apply(variables_source)
15
+ end
16
+
17
+ def document_root
18
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
19
+ end
20
+
21
+ def extra_content
22
+ ''
23
+ end
24
+
25
+ private
26
+
27
+ def apache_uncached
28
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
29
+ end
30
+
31
+ def enable_conf
32
+ infom 'Enabling configuration...'
33
+ conf.enable
34
+ end
35
+
36
+ def reload_apache
37
+ infom 'Reloading Apache...'
38
+ apache.service('reload')
39
+ end
40
+
41
+ def conf_uncached
42
+ apache.conf(instance.id)
43
+ end
44
+
45
+ def write_available_conf
46
+ infom 'Writing available configuration...'
47
+ conf.write(content)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/callbacks'
4
+ require 'avm/apps/jobs/base'
5
+ require 'avm/git'
6
+ require 'avm/patches/object/template'
7
+ require 'eac_ruby_utils/core_ext'
8
+ require 'avm/launcher/git/base'
9
+ require 'net/http'
10
+
11
+ module Avm
12
+ module EacWebappBase0
13
+ class Deploy
14
+ require_sub __FILE__, include_modules: true
15
+
16
+ DEFAULT_REFERENCE = 'HEAD'
17
+
18
+ REQUEST_TEST_JOB = 'request_test'
19
+ JOBS = (%w[create_build_dir build_content append_instance_content write_on_target
20
+ setup_files_units assert_instance_branch] + [REQUEST_TEST_JOB]).freeze
21
+
22
+ include ::Avm::Apps::Jobs::Base
23
+
24
+ lists.add_symbol :option, :appended_directories, :no_request_test, :reference
25
+
26
+ def option_list
27
+ ::Avm::EacWebappBase0::Deploy.lists.option
28
+ end
29
+
30
+ def run
31
+ super
32
+ ensure
33
+ remove_build_dir
34
+ end
35
+
36
+ def start_banner
37
+ infov 'Instance', instance
38
+ infov 'Git reference (User)', git_reference.if_present('- BLANK -')
39
+ infov 'Git remote name', git_remote_name
40
+ infov 'Git reference (Found)', git_reference_found
41
+ infov 'Git commit SHA1', commit_sha1
42
+ infov 'Appended directories', appended_directories
43
+ end
44
+
45
+ def setup_files_units
46
+ instance.class.const_get('FILES_UNITS').each do |data_key, fs_path_subpath|
47
+ FileUnit.new(self, data_key, fs_path_subpath).run
48
+ end
49
+ end
50
+
51
+ def assert_instance_branch
52
+ infom 'Setting instance branch...'
53
+ git.execute!('push', git_remote_name, "#{commit_sha1}:refs/heads/#{instance.id}", '-f')
54
+ end
55
+
56
+ def request_test
57
+ infom 'Requesting web interface...'
58
+ uri = URI(instance.read_entry('web.url'))
59
+ response = ::Net::HTTP.get_response(uri)
60
+ infov 'Response status', response.code
61
+ fatal_error "Request to #{uri} failed" unless response.code.to_i == 200
62
+ end
63
+
64
+ protected
65
+
66
+ def jobs
67
+ r = super
68
+ r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
69
+ r
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/path_string'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ class Deploy
8
+ module AppendedDirectories
9
+ APPENDED_DIRECTORIES_ENTRY_KEY = 'deploy.appended_directories'
10
+
11
+ def appended_directories
12
+ appended_directories_from_instance_entry + appended_directories_from_options
13
+ end
14
+
15
+ def appended_directories_from_instance_entry
16
+ ::Avm::PathString.paths(instance.read_entry_optional(APPENDED_DIRECTORIES_ENTRY_KEY))
17
+ end
18
+
19
+ def appended_directories_from_options
20
+ options[OPTION_APPENDED_DIRECTORIES] || []
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/files/appender'
4
+ require 'avm/files/deploy'
5
+ require 'eac_ruby_utils/envs'
6
+ require 'eac_ruby_utils/fs/temp'
7
+
8
+ module Avm
9
+ module EacWebappBase0
10
+ class Deploy
11
+ module Build
12
+ private
13
+
14
+ attr_accessor :build_dir
15
+
16
+ def append_instance_content
17
+ ::Avm::Files::Appender
18
+ .new
19
+ .variables_source_set(variables_source)
20
+ .append_templatized_directory(template.path)
21
+ .append_templatized_directories(appended_directories)
22
+ .append_file_content(version_target_path, version)
23
+ .write_appended_on(build_dir)
24
+ end
25
+
26
+ def build_dir_env
27
+ ::EacRubyUtils::Envs.local
28
+ end
29
+
30
+ def create_build_dir
31
+ self.build_dir = ::EacRubyUtils::Fs::Temp.directory
32
+ end
33
+
34
+ def remove_build_dir
35
+ build_dir&.remove
36
+ end
37
+
38
+ def build_content
39
+ infom 'Writing Git source code...'
40
+ ::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
41
+ build_dir_env,
42
+ build_dir
43
+ ).variables_source_set(variables_source).run
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWebappBase0
5
+ class Deploy
6
+ class FileUnit < ::SimpleDelegator
7
+ attr_reader :data_key, :fs_path_subpath
8
+
9
+ def initialize(deploy, data_key, fs_path_subpath)
10
+ super(deploy)
11
+ @data_key = data_key
12
+ @fs_path_subpath = fs_path_subpath
13
+ end
14
+
15
+ def run
16
+ assert_source_directory
17
+ link_source_target
18
+ end
19
+
20
+ def assert_source_directory
21
+ infom "Asserting \"#{data_key}\" source directory..."
22
+ instance.host_env.command('mkdir', '-p', source_path).execute!
23
+ end
24
+
25
+ def source_path
26
+ ::File.join(instance.read_entry(:data_fs_path), data_key.to_s)
27
+ end
28
+
29
+ def target_path
30
+ ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH),
31
+ fs_path_subpath.to_s)
32
+ end
33
+
34
+ def link_source_target
35
+ infom "Linking \"#{data_key}\" directory..."
36
+ instance.host_env.command('rm', '-rf', target_path).execute!
37
+ instance.host_env.command('ln', '-s', source_path, target_path).execute!
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWebappBase0
5
+ class Deploy
6
+ module GitInfo
7
+ def commit_sha1_uncached
8
+ git_fetch
9
+ r = git.rev_parse(git_reference_found)
10
+ return r if r
11
+
12
+ raise ::Avm::Result::Error, "No commit SHA1 found for \"#{git_reference_found}\""
13
+ end
14
+
15
+ def git_fetch_uncached
16
+ infom "Fetching remote \"#{git_remote_name}\" from \"#{git_repository_path}\"..."
17
+ git.fetch(git_remote_name)
18
+ end
19
+
20
+ def git_reference
21
+ options[OPTION_REFERENCE] || DEFAULT_REFERENCE
22
+ end
23
+
24
+ def git_reference_found_uncached
25
+ %w[git_reference instance_branch master_branch].map { |b| send(b) }.find(&:present?) ||
26
+ raise(
27
+ ::Avm::Result::Error,
28
+ 'No git reference found (Searched for option, instance and master)'
29
+ )
30
+ end
31
+
32
+ def git_remote_hashs_uncached
33
+ git.remote_hashs(git_remote_name)
34
+ end
35
+
36
+ def git_remote_name
37
+ ::Avm::Git::DEFAULT_REMOTE_NAME
38
+ end
39
+
40
+ def git_repository_path
41
+ instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
42
+ end
43
+
44
+ def git_uncached
45
+ ::Avm::Launcher::Git::Base.new(git_repository_path)
46
+ end
47
+
48
+ def instance_branch
49
+ remote_branch(instance.id)
50
+ end
51
+
52
+ def remote_branch(name)
53
+ git_remote_hashs.key?("refs/heads/#{name}") ? "#{git_remote_name}/#{name}" : nil
54
+ end
55
+
56
+ def master_branch
57
+ remote_branch('master')
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWebappBase0
5
+ class Deploy
6
+ module Version
7
+ VERSION_TARGET_PATH = 'VERSION'
8
+
9
+ def version
10
+ ([::Time.now, commit_sha1] + version_git_refs).join('|')
11
+ end
12
+
13
+ def version_git_refs
14
+ git_remote_hashs.select { |_name, sha1| sha1 == commit_sha1 }.keys
15
+ .map { |ref| ref.gsub(%r{\Arefs/}, '') }.reject { |ref| ref == 'HEAD' }
16
+ end
17
+
18
+ def version_target_path
19
+ VERSION_TARGET_PATH
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ class Deploy
8
+ module WriteOnTarget
9
+ def write_on_target
10
+ ::Avm::Files::Deploy.new(
11
+ instance.host_env,
12
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
13
+ ).append_plain_directory(build_dir).run
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/postgresql/instance_with'
5
+ require 'avm/data/instance/files_unit'
6
+ require 'avm/data/instance/package'
7
+ require 'avm/eac_webapp_base0/deploy/file_unit'
8
+
9
+ module Avm
10
+ module EacWebappBase0
11
+ class Instance < ::Avm::Instances::Base
12
+ require_sub __FILE__
13
+ include ::Avm::Postgresql::InstanceWith
14
+
15
+ FILES_UNITS = [].freeze
16
+
17
+ def stereotype_name
18
+ self.class.name.desconstantize.demodulize
19
+ end
20
+
21
+ def data_dump(argv = [])
22
+ run_subcommand(::Avm::Tools::Runner::EacWordpressBase0::Data::Dump, argv)
23
+ end
24
+
25
+ def data_dump_runner_class
26
+ "::Avm::Tools::Runner::#{stereotype_name}::Data::Dump".constantize
27
+ end
28
+
29
+ def run_subcommand(subcommand_class, argv)
30
+ subcommand_class.create(
31
+ argv: argv,
32
+ parent: ::Avm::EacWebappBase0::Instance::SubcommandParent.new(self)
33
+ ).run
34
+ end
35
+
36
+ def data_package
37
+ @data_package ||= ::Avm::Data::Instance::Package.new(
38
+ self, units: { database: database_unit }.merge(files_units)
39
+ )
40
+ end
41
+
42
+ def database_unit
43
+ pg.data_unit
44
+ end
45
+
46
+ private
47
+
48
+ def files_units
49
+ self.class.const_get('FILES_UNITS').transform_values do |fs_path_subpath|
50
+ ::Avm::Data::Instance::FilesUnit.new(self, fs_path_subpath)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ class Instance < ::Avm::Instances::Base
8
+ class SubcommandParent
9
+ enable_simple_cache
10
+ common_constructor :instance
11
+
12
+ private
13
+
14
+ def runner_context_uncached
15
+ ::EacCli::Runner::Context.new(self, argv: runner_argv)
16
+ end
17
+
18
+ def runner_argv
19
+ [instance.class.name.split('::')[-2].dasherize, instance.id]
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/runner'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ class Runner < ::Avm::Instances::Runner
9
+ require_sub __FILE__
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/runner'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ class Runner < ::Avm::Instances::Runner
9
+ class ApacheHost
10
+ runner_with :help do
11
+ desc 'Configure Apache virtual host for instance.'
12
+ bool_opt '-c', '--certbot', 'Install certbot.'
13
+ end
14
+
15
+ def run
16
+ result = stereotype_apache_host_class.new(runner_context.call(:instance),
17
+ stereotype_apache_host_options).run
18
+ if result.error?
19
+ fatal_error result.to_s
20
+ else
21
+ infov 'Result', result.label
22
+ end
23
+ end
24
+
25
+ def stereotype_apache_host_class
26
+ "#{runner_context.call(:instance).class.name.deconstantize}::ApacheHost".constantize
27
+ end
28
+
29
+ def stereotype_apache_host_options
30
+ { certbot: parsed.certbot? }
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'avm/instances/runner'
5
+ require 'avm/eac_webapp_base0/runner/apache_host'
6
+ require 'avm/eac_rails_base0/apache_path'
7
+
8
+ module Avm
9
+ module EacWebappBase0
10
+ class Runner < ::Avm::Instances::Runner
11
+ class ApachePath
12
+ runner_with :help do
13
+ desc 'Configure Apache path configuration for instance.'
14
+ end
15
+
16
+ def run
17
+ if result.error?
18
+ fatal_error result.to_s
19
+ else
20
+ infov 'Result', result.label
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def apache_path_uncached
27
+ stereotype_apache_path_class.new(runner_context.call(:instance))
28
+ end
29
+
30
+ def result_uncached
31
+ apache_path.run
32
+ end
33
+
34
+ def stereotype_apache_path_class
35
+ "#{runner_context.call(:instance).class.name.deconstantize}::ApachePath".constantize
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ class Runner < ::Avm::Instances::Runner
8
+ class Data
9
+ require_sub __FILE__
10
+ runner_with :help, :subcommands do
11
+ desc 'Data utilities for EacRailsBase0 instances.'
12
+ subcommands
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/data/package/dump'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ class Runner < ::Avm::Instances::Runner
9
+ class Data
10
+ class Dump
11
+ DUMP_EXPIRE_TIME = 1.day
12
+ DEFAULT_DUMP_PATH_ENTRY_SUFFIX = 'data.default_dump_path'
13
+ NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
14
+ 'dump was expired.'
15
+
16
+ runner_with :help do
17
+ desc 'Dump utility for EacRailsBase instance.'
18
+ bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
19
+ arg_opt '-p', '--dump-path', 'Set DUMP_PATH variable.'
20
+ end
21
+
22
+ def run
23
+ infov 'Instance to dump', "#{instance} (#{instance.class})"
24
+ if package_dump.runnable?
25
+ package_dump.run
26
+ else
27
+ warn(package_dump.cannot_run_reason)
28
+ end
29
+ success("Dump path: \"#{dump_path}\"")
30
+ dump_path
31
+ end
32
+
33
+ private
34
+
35
+ def instance
36
+ runner_context.call(:instance)
37
+ end
38
+
39
+ def package_dump_uncached
40
+ instance
41
+ .data_package.dump(dump_path, existing: package_dump_existing)
42
+ end
43
+
44
+ def dump_path
45
+ parsed.dump_path || default_dump_path
46
+ end
47
+
48
+ def default_dump_path
49
+ instance.read_entry(DEFAULT_DUMP_PATH_ENTRY_SUFFIX)
50
+ end
51
+
52
+ def package_dump_existing
53
+ if parsed.rewrite?
54
+ ::Avm::Data::Package::Dump::EXISTING_ROTATE
55
+ else
56
+ ::Avm::Data::Package::Dump::EXISTING_ROTATE_EXPIRED
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/numeric/time'
4
+ require 'eac_cli/speaker'
5
+ require 'eac_ruby_utils/simple_cache'
6
+
7
+ module Avm
8
+ module EacWebappBase0
9
+ class Runner < ::Avm::Instances::Runner
10
+ class Data
11
+ class Load
12
+ runner_with :help do
13
+ desc 'Load utility for EacRailsBase instance.'
14
+ arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
15
+ pos_arg :dump_path, optional: true
16
+ end
17
+
18
+ def run
19
+ return ::Dev::Result.error("Dump \"#{dump_path}\" does not exist") unless
20
+ ::File.exist?(dump_path)
21
+
22
+ load_dump
23
+ success("Dump loaded from \"#{dump_path}\"")
24
+ end
25
+
26
+ def dump_path_uncached
27
+ return parsed.dump_path.to_s if parsed.dump_path.present?
28
+ return source_instance_dump_path if parsed.source_instance.present?
29
+
30
+ raise "Dump path unknown (Options: #{parsed})"
31
+ end
32
+
33
+ def source_instance_dump_path
34
+ runner_context.call(:instance).class.by_id(parsed.source_instance).data_dump
35
+ end
36
+
37
+ def load_dump
38
+ info "Loading dump \"#{dump_path}\"..."
39
+ package_load.run
40
+ end
41
+
42
+ def dump_instance_method
43
+ :dump_database
44
+ end
45
+
46
+ private
47
+
48
+ def package_load_uncached
49
+ runner_context.call(:instance).data_package.load(dump_path)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/runner'
4
+ require 'avm/path_string'
5
+ require 'eac_cli/core_ext'
6
+
7
+ module Avm
8
+ module EacWebappBase0
9
+ class Runner < ::Avm::Instances::Runner
10
+ class Deploy
11
+ runner_with :help do
12
+ desc 'Deploy for instance.'
13
+ arg_opt '-r', '--reference', 'Git reference to deploy.'
14
+ arg_opt '-a', '--append-dirs', 'Append directories to deploy (List separated by ":").'
15
+ bool_opt '-T', '--no-request-test', 'Do not test web interface after deploy.'
16
+ end
17
+
18
+ def deploy_class
19
+ runner_context.call(:stereotype_module).const_get('Deploy')
20
+ end
21
+
22
+ def run
23
+ result = deploy_class.new(runner_context.call(:instance), deploy_options).run
24
+ if result.error?
25
+ fatal_error result.to_s
26
+ else
27
+ infov 'Result', result.label
28
+ end
29
+ end
30
+
31
+ def deploy_options
32
+ { reference: parsed.reference,
33
+ appended_directories: ::Avm::PathString.paths(parsed.append_dirs),
34
+ no_request_test: parsed.no_request_test? }
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacWebappBase0
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: avm-eac_webapp_base0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Put here the authors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: avm
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: eac_ruby_utils
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.68'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.68'
41
+ - !ruby/object:Gem::Dependency
42
+ name: eac_ruby_gem_support
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
55
+ description:
56
+ email:
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - lib/avm/eac_webapp_base0.rb
62
+ - lib/avm/eac_webapp_base0/apache_host.rb
63
+ - lib/avm/eac_webapp_base0/apache_path.rb
64
+ - lib/avm/eac_webapp_base0/deploy.rb
65
+ - lib/avm/eac_webapp_base0/deploy/appended_directories.rb
66
+ - lib/avm/eac_webapp_base0/deploy/build.rb
67
+ - lib/avm/eac_webapp_base0/deploy/file_unit.rb
68
+ - lib/avm/eac_webapp_base0/deploy/git_info.rb
69
+ - lib/avm/eac_webapp_base0/deploy/version.rb
70
+ - lib/avm/eac_webapp_base0/deploy/write_on_target.rb
71
+ - lib/avm/eac_webapp_base0/instance.rb
72
+ - lib/avm/eac_webapp_base0/instance/subcommand_parent.rb
73
+ - lib/avm/eac_webapp_base0/runner.rb
74
+ - lib/avm/eac_webapp_base0/runner/apache_host.rb
75
+ - lib/avm/eac_webapp_base0/runner/apache_path.rb
76
+ - lib/avm/eac_webapp_base0/runner/data.rb
77
+ - lib/avm/eac_webapp_base0/runner/data/dump.rb
78
+ - lib/avm/eac_webapp_base0/runner/data/load.rb
79
+ - lib/avm/eac_webapp_base0/runner/deploy.rb
80
+ - lib/avm/eac_webapp_base0/version.rb
81
+ homepage:
82
+ licenses: []
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubygems_version: 3.0.9
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Put here de description.
103
+ test_files: []