avm-tools 0.69.1 → 0.70.2
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 +2 -1
- data/lib/avm/eac_rails_base0/apache_host.rb +1 -1
- data/lib/avm/eac_rails_base0/apache_path.rb +50 -0
- data/lib/avm/eac_rails_base0/deploy.rb +2 -1
- data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/eac_redmine_base0/instance.rb +4 -3
- data/lib/avm/eac_ubuntu_base0/apache.rb +26 -0
- data/lib/avm/eac_ubuntu_base0/apache/resource.rb +59 -0
- data/lib/avm/eac_ubuntu_base0/docker_image.rb +14 -0
- data/lib/avm/eac_webapp_base0/apache_host.rb +2 -2
- data/lib/avm/eac_webapp_base0/deploy.rb +2 -2
- data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +2 -1
- data/lib/avm/git/auto_commit_path.rb +4 -2
- data/lib/avm/git/issue/complete/_git_subrepos.rb +1 -0
- data/lib/avm/instances/base/auto_values/filesystem.rb +3 -1
- data/lib/avm/instances/entries.rb +5 -8
- data/lib/avm/instances/entry.rb +47 -0
- data/lib/avm/instances/entry_keys.rb +2 -0
- data/lib/avm/patches/i18n.rb +1 -1
- data/lib/avm/patches/object/template.rb +1 -1
- data/lib/avm/self.rb +0 -4
- data/lib/avm/self/instance.rb +1 -1
- data/lib/avm/self/root.rb +13 -0
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +1 -1
- data/lib/avm/tools/runner/eac_rails_base0.rb +7 -12
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +38 -0
- data/lib/avm/tools/runner/git/deploy.rb +3 -1
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/default.conf +13 -0
- data/vendor/eac_cli/lib/eac_cli/core_ext.rb +4 -0
- data/vendor/eac_cli/lib/eac_cli/default_runner.rb +6 -14
- data/vendor/eac_cli/lib/eac_cli/patches.rb +4 -0
- data/vendor/eac_cli/lib/eac_cli/patches/object.rb +5 -0
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +24 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with.rb +9 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +19 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +26 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_git/vendor/git-subrepo/lib/git-subrepo +9 -7
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +3 -3
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +5 -1
- 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/version_file.rb +6 -5
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +14 -0
- data/vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +7 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +6 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +6 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +19 -6
- data/lib/avm/instances/entries/entry_reader.rb +0 -45
- data/lib/avm/stereotypes/eac_ubuntu_base0/apache.rb +0 -27
- data/lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb +0 -61
- data/lib/avm/stereotypes/eac_ubuntu_base0/docker_image.rb +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc0ca6899907a27aa6b201493d4333c63fd975ad79c0f705171af4cbb7d12254
|
|
4
|
+
data.tar.gz: f520c92fc4a738cb27a5b14cff784b4321a9bed091993571b1aa096484f1dc01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e5335434368d606d4d6bd23736fdec437ee2511748612fa2fa1b1f4c991038b50e740ede71149affa736c8314e662568bbeef92cb7c60ff25b1b8e993de57f5
|
|
7
|
+
data.tar.gz: 2f675b8c6e57cb0f4eba761fdc227ec1f1f0a5dacea96ab5600733474a1c2d9258a5d8a8ae59c3566f3a2c492072bd8ff455dd36b076f97dd8e21e4763358814
|
|
@@ -18,7 +18,7 @@ module Avm
|
|
|
18
18
|
before_load :clear_files
|
|
19
19
|
|
|
20
20
|
def files_path
|
|
21
|
-
::File.join(instance.read_entry(
|
|
21
|
+
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), fs_path_subpath)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def dump_command
|
|
@@ -31,6 +31,7 @@ module Avm
|
|
|
31
31
|
|
|
32
32
|
def clear_files
|
|
33
33
|
infom "Removing all files under #{files_path}..."
|
|
34
|
+
instance.host_env.command('mkdir', '-p', files_path).execute!
|
|
34
35
|
instance.host_env.command('find', files_path, '-mindepth', 1, '-delete').execute!
|
|
35
36
|
end
|
|
36
37
|
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'avm/eac_ubuntu_base0/apache'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
|
|
6
|
+
module Avm
|
|
7
|
+
module EacRailsBase0
|
|
8
|
+
class ApachePath
|
|
9
|
+
enable_console_speaker
|
|
10
|
+
enable_simple_cache
|
|
11
|
+
common_constructor :instance, :options, default: [{}]
|
|
12
|
+
|
|
13
|
+
def run
|
|
14
|
+
write_available_conf
|
|
15
|
+
enable_conf
|
|
16
|
+
reload_apache
|
|
17
|
+
::Avm::Result.success('Done')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def content
|
|
21
|
+
template.child('default.conf').apply(instance)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def apache_uncached
|
|
27
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def enable_conf
|
|
31
|
+
infom 'Enabling configuration...'
|
|
32
|
+
conf.enable
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def reload_apache
|
|
36
|
+
infom 'Reloading Apache...'
|
|
37
|
+
apache.service('reload')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def conf_uncached
|
|
41
|
+
apache.conf(instance.id)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def write_available_conf
|
|
45
|
+
infom 'Writing available configuration...'
|
|
46
|
+
conf.write(content)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -42,7 +42,8 @@ module Avm
|
|
|
42
42
|
def touch_restart_file
|
|
43
43
|
infom 'Touching restart file...'
|
|
44
44
|
instance.host_env.command(
|
|
45
|
-
'touch', ::File.join(instance.read_entry(
|
|
45
|
+
'touch', ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH),
|
|
46
|
+
'tmp', 'restart.txt')
|
|
46
47
|
).system!
|
|
47
48
|
end
|
|
48
49
|
end
|
|
@@ -20,8 +20,8 @@ module Avm
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def installer_path
|
|
23
|
-
::File.join(instance.read_entry(
|
|
24
|
-
'run.sh')
|
|
23
|
+
::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH), 'plugins',
|
|
24
|
+
'redmine_installer', 'installer', 'run.sh')
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def install_task
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'avm/eac_redmine_base0/data_unit'
|
|
4
|
-
require 'avm/
|
|
4
|
+
require 'avm/eac_ubuntu_base0/docker_image'
|
|
5
5
|
require 'avm/eac_webapp_base0/instance'
|
|
6
6
|
require 'avm/stereotypes/rails/instance'
|
|
7
7
|
|
|
@@ -13,12 +13,13 @@ module Avm
|
|
|
13
13
|
FILES_UNITS = { files: 'files' }.freeze
|
|
14
14
|
|
|
15
15
|
def docker_image_class
|
|
16
|
-
::Avm::
|
|
16
|
+
::Avm::EacUbuntuBase0::DockerImage
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def docker_run_arguments
|
|
20
20
|
[
|
|
21
|
-
'--volume',
|
|
21
|
+
'--volume',
|
|
22
|
+
"#{read_entry(::Avm::Instances::EntryKeys::FS_PATH)}:/home/myuser/eac_redmine_base0",
|
|
22
23
|
'--publish', "#{read_entry(:ssh_port)}:22",
|
|
23
24
|
'--publish', "#{read_entry(:http_port)}:80",
|
|
24
25
|
'--publish', "#{read_entry(:https_port)}:443"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module EacUbuntuBase0
|
|
7
|
+
class Apache
|
|
8
|
+
require_sub __FILE__
|
|
9
|
+
common_constructor :host_env
|
|
10
|
+
|
|
11
|
+
def etc_root
|
|
12
|
+
'/etc/apache2'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def service(command)
|
|
16
|
+
host_env.command('sudo', 'service', 'apache2', command)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
{ conf: :conf, site: :sites }.each do |type, directory_prefix|
|
|
20
|
+
define_method type do |name|
|
|
21
|
+
::Avm::EacUbuntuBase0::Apache::Resource.new(self, type, directory_prefix, name)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module EacUbuntuBase0
|
|
7
|
+
class Apache
|
|
8
|
+
class Resource
|
|
9
|
+
common_constructor :apache, :type, :directory_prefix, :name
|
|
10
|
+
|
|
11
|
+
def available_path
|
|
12
|
+
::File.join(apache.etc_root, "#{directory_prefix}-available", "#{name}.conf")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def available?
|
|
16
|
+
apache.host_env.file(available_path).exist?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def disable
|
|
20
|
+
apache.host_env.command('sudo', "a2dis#{type}", name).execute!
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def enable
|
|
24
|
+
apache.host_env.command('sudo', "a2en#{type}", name).execute!
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def enabled_path
|
|
28
|
+
::File.join(apache.etc_root, "#{directory_prefix}-enabled", "#{name}.conf")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def enabled?
|
|
32
|
+
apache.host_env.file(enabled_path).exist?
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def remove
|
|
36
|
+
remove_disabled
|
|
37
|
+
remove_available
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def remove_available
|
|
41
|
+
raise 'Remove enabled before' if enabled?
|
|
42
|
+
|
|
43
|
+
apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def remove_disabled
|
|
47
|
+
disable if enabled?
|
|
48
|
+
apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def write(content)
|
|
52
|
+
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
|
53
|
+
apache.host_env.command('sudo', 'tee', available_path)
|
|
54
|
+
).execute!
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
|
4
4
|
require 'avm/patches/object/template'
|
|
5
|
-
require 'avm/
|
|
5
|
+
require 'avm/eac_ubuntu_base0/apache'
|
|
6
6
|
require 'avm/patches/object/template'
|
|
7
7
|
|
|
8
8
|
module Avm
|
|
@@ -35,7 +35,7 @@ module Avm
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
37
|
def apache_uncached
|
|
38
|
-
::Avm::
|
|
38
|
+
::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def enable_no_ssl_site
|
|
@@ -32,7 +32,7 @@ module Avm
|
|
|
32
32
|
def build_git_commit
|
|
33
33
|
::Avm::Git::Commit.new(git, commit_sha1).deploy_to_env_path(
|
|
34
34
|
instance.host_env,
|
|
35
|
-
instance.read_entry(
|
|
35
|
+
instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
|
36
36
|
).variables_source_set(instance)
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -95,7 +95,7 @@ module Avm
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def git_repository_path
|
|
98
|
-
instance.source_instance.read_entry(
|
|
98
|
+
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
end
|
|
@@ -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
|
|
@@ -10,6 +10,7 @@ module Avm
|
|
|
10
10
|
def git_subrepos_result
|
|
11
11
|
return ::Avm::Result.error('Unclean workspace') unless clean_workspace?
|
|
12
12
|
|
|
13
|
+
infom 'Checking Git subrepos...'
|
|
13
14
|
r = ::Avm::Git::SubrepoChecks.new(::EacGit::Local.new(@git)).add_all_subrepos
|
|
14
15
|
r.check_remote = true
|
|
15
16
|
r.result
|
|
@@ -5,8 +5,10 @@ module Avm
|
|
|
5
5
|
class Base
|
|
6
6
|
module AutoValues
|
|
7
7
|
module Filesystem
|
|
8
|
+
FS_PATH_KEY = :fs_path
|
|
9
|
+
|
|
8
10
|
def auto_fs_path
|
|
9
|
-
inherited_entry_value(:host_id,
|
|
11
|
+
inherited_entry_value(:host_id, FS_PATH_KEY) { |v| v + '/' + id }
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
def auto_data_fs_path
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
|
5
4
|
require 'avm/configs'
|
|
6
|
-
|
|
5
|
+
require 'avm/instances/entry'
|
|
7
6
|
|
|
8
7
|
module Avm
|
|
9
8
|
module Instances
|
|
10
9
|
module Entries
|
|
10
|
+
def entry(suffix, options = {})
|
|
11
|
+
::Avm::Instances::Entry.new(self, suffix, options)
|
|
12
|
+
end
|
|
13
|
+
|
|
11
14
|
def path_prefix
|
|
12
15
|
@path_prefix ||= [id].freeze
|
|
13
16
|
end
|
|
@@ -36,12 +39,6 @@ module Avm
|
|
|
36
39
|
def other_entry_value(instance_id, entry_suffix)
|
|
37
40
|
::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix)
|
|
38
41
|
end
|
|
39
|
-
|
|
40
|
-
private
|
|
41
|
-
|
|
42
|
-
def entry(suffix, options)
|
|
43
|
-
::Avm::Instances::Entries::EntryReader.new(self, suffix, options)
|
|
44
|
-
end
|
|
45
42
|
end
|
|
46
43
|
end
|
|
47
44
|
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module Instances
|
|
7
|
+
class Entry
|
|
8
|
+
common_constructor :parent, :suffix, :options
|
|
9
|
+
|
|
10
|
+
def auto_value
|
|
11
|
+
parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def auto_value_method
|
|
15
|
+
"auto_#{suffix.to_s.gsub('.', '_')}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def full_path
|
|
19
|
+
(parent.path_prefix + suffix_as_array).join('.')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def optional_value
|
|
23
|
+
read(required: false, noinput: true) || auto_value
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def read(extra_options = {})
|
|
27
|
+
::Avm.configs.read_entry(full_path, options.merge(extra_options))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def suffix_as_array
|
|
31
|
+
if suffix.is_a?(::Array)
|
|
32
|
+
suffix.dup
|
|
33
|
+
else
|
|
34
|
+
::EacRubyUtils::PathsHash.parse_entry_key(suffix.to_s)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def value
|
|
39
|
+
optional_value || read
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def write(value)
|
|
43
|
+
::Avm.configs.configs.write_entry(full_path, value)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
data/lib/avm/patches/i18n.rb
CHANGED
data/lib/avm/self.rb
CHANGED
data/lib/avm/self/instance.rb
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'eac_cli/core_ext'
|
|
3
4
|
require 'eac_ruby_utils/console/docopt_runner'
|
|
4
5
|
require 'eac_ruby_utils/simple_cache'
|
|
5
6
|
require 'avm/eac_rails_base0/instance'
|
|
6
|
-
require 'eac_ruby_utils/require_sub'
|
|
7
7
|
::EacRubyUtils.require_sub(__FILE__)
|
|
8
8
|
|
|
9
9
|
module Avm
|
|
10
10
|
module Tools
|
|
11
11
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
12
12
|
class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
|
|
13
|
-
|
|
13
|
+
runner_with
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
Utilities for EacRailsBase0 instances.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
__PROGRAM__ -h | --help
|
|
21
|
-
|
|
22
|
-
Options:
|
|
23
|
-
-h --help Show this screen.
|
|
24
|
-
DOCOPT
|
|
15
|
+
runner_definition do
|
|
16
|
+
desc 'Utilities for EacRailsBase0 instances.'
|
|
17
|
+
pos_arg :instance_id
|
|
18
|
+
subcommands
|
|
19
|
+
end
|
|
25
20
|
|
|
26
21
|
private
|
|
27
22
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/core_ext'
|
|
4
|
+
require 'avm/eac_webapp_base0/runner/apache_host'
|
|
5
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
|
6
|
+
require 'avm/eac_rails_base0/apache_path'
|
|
7
|
+
|
|
8
|
+
module Avm
|
|
9
|
+
module Tools
|
|
10
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
|
11
|
+
class EacRailsBase0 < ::EacRubyUtils::Console::DocoptRunner
|
|
12
|
+
class ApachePath < ::EacRubyUtils::Console::DocoptRunner
|
|
13
|
+
runner_with
|
|
14
|
+
|
|
15
|
+
runner_definition do
|
|
16
|
+
desc 'Configure Apache path configuration for instance.'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def run
|
|
20
|
+
if result.error?
|
|
21
|
+
fatal_error result.to_s
|
|
22
|
+
else
|
|
23
|
+
infov 'Result', result.label
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def apache_path_uncached
|
|
28
|
+
::Avm::EacRailsBase0::ApachePath.new(context(:instance))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def result_uncached
|
|
32
|
+
apache_path.run
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<IfModule mod_passenger.c>
|
|
2
|
+
Alias "%%WEB.PATH%%" "%%FS_PATH%%/public"
|
|
3
|
+
<Location "%%WEB.PATH%%">
|
|
4
|
+
PassengerBaseURI "%%WEB.PATH%%"
|
|
5
|
+
PassengerAppRoot "%%FS_PATH%%"
|
|
6
|
+
PassengerAppEnv production
|
|
7
|
+
</Location>
|
|
8
|
+
<Directory "%%FS_PATH%%/public">
|
|
9
|
+
Allow from all
|
|
10
|
+
Options -MultiViews
|
|
11
|
+
Require all granted
|
|
12
|
+
</Directory>
|
|
13
|
+
</IfModule>
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require '
|
|
4
|
-
require '
|
|
5
|
-
require 'eac_ruby_utils/console/speaker'
|
|
6
|
-
require 'eac_ruby_utils/simple_cache'
|
|
3
|
+
require 'eac_cli/runner_with/help'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
7
5
|
|
|
8
6
|
module EacCli
|
|
9
7
|
module DefaultRunner
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
include ::EacRubyUtils::Console::Speaker
|
|
15
|
-
include ::EacRubyUtils::SimpleCache
|
|
16
|
-
runner_definition.alt do
|
|
17
|
-
options_arg false
|
|
18
|
-
bool_opt '-h', '--help', 'Show help.', usage: true
|
|
19
|
-
end
|
|
8
|
+
common_concern do
|
|
9
|
+
include ::EacCli::RunnerWith::Help
|
|
10
|
+
enable_console_speaker
|
|
11
|
+
enable_simple_cache
|
|
20
12
|
end
|
|
21
13
|
end
|
|
22
14
|
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
|
4
|
+
require 'eac_cli/runner'
|
|
5
|
+
require 'eac_cli/runner_with'
|
|
6
|
+
|
|
7
|
+
class Object
|
|
8
|
+
def runner_with(*runners)
|
|
9
|
+
include ::EacCli::Runner
|
|
10
|
+
enable_simple_cache
|
|
11
|
+
enable_console_speaker
|
|
12
|
+
runners.each do |runner|
|
|
13
|
+
include runner_with_to_module(runner)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def runner_with_to_module(runner)
|
|
20
|
+
return runner if runner.is_a?(::Module)
|
|
21
|
+
|
|
22
|
+
"EacCli::RunnerWith::#{runner.to_s.camelize}".constantize
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
|
|
6
|
+
module EacCli
|
|
7
|
+
module RunnerWith
|
|
8
|
+
module Help
|
|
9
|
+
common_concern do
|
|
10
|
+
include ::EacCli::Runner
|
|
11
|
+
|
|
12
|
+
runner_definition.alt do
|
|
13
|
+
options_arg false
|
|
14
|
+
bool_opt '-h', '--help', 'Show help.', usage: true
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/runner'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
|
|
6
|
+
module EacCli
|
|
7
|
+
module RunnerWith
|
|
8
|
+
module OutputFile
|
|
9
|
+
common_concern do
|
|
10
|
+
include ::EacCli::Runner
|
|
11
|
+
|
|
12
|
+
runner_definition do
|
|
13
|
+
arg_opt '-o', '--output-file', 'Output to file.'
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def run_output
|
|
18
|
+
if parsed.output_file.present?
|
|
19
|
+
::File.write(parsed.output_file, output_content)
|
|
20
|
+
else
|
|
21
|
+
out output_content
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
# Exit on any errors:
|
|
9
9
|
set -e
|
|
10
10
|
|
|
11
|
+
export FILTER_BRANCH_SQUELCH_WARNING=1
|
|
12
|
+
|
|
11
13
|
# Import Bash+ helper functions:
|
|
12
14
|
SOURCE="$BASH_SOURCE"
|
|
13
15
|
while [[ -h $SOURCE ]]; do
|
|
@@ -549,7 +551,7 @@ subrepo:pull() {
|
|
|
549
551
|
fi
|
|
550
552
|
else
|
|
551
553
|
o "Merge in changes from $refs_subrepo_fetch"
|
|
552
|
-
FAIL=false
|
|
554
|
+
FAIL=false RUN git merge "$refs_subrepo_fetch"
|
|
553
555
|
if ! OK; then
|
|
554
556
|
say "The \"git merge\" command failed:"
|
|
555
557
|
say
|
|
@@ -765,8 +767,8 @@ subrepo:branch() {
|
|
|
765
767
|
o "Create with content"
|
|
766
768
|
local PREVIOUS_IFS=$IFS
|
|
767
769
|
IFS=$'\n'
|
|
768
|
-
local author_info=( $(git log -1 --format=%ad%n%ae%n%an "$commit") )
|
|
769
|
-
local commiter_info=( $(git log -1 --format=%cd%n%ce%n%cn "$commit") )
|
|
770
|
+
local author_info=( $(git log -1 --date=default --format=%ad%n%ae%n%an "$commit") )
|
|
771
|
+
local commiter_info=( $(git log -1 --date=default --format=%cd%n%ce%n%cn "$commit") )
|
|
770
772
|
IFS=$PREVIOUS_IFS
|
|
771
773
|
|
|
772
774
|
# When we create new commits we leave the author information unchanged
|
|
@@ -774,7 +776,7 @@ subrepo:branch() {
|
|
|
774
776
|
# This should be analog how cherrypicking is handled allowing git
|
|
775
777
|
# to store both the original author but also the responsible committer
|
|
776
778
|
# that created the local version of the commit and pushed it.
|
|
777
|
-
prev_commit=$(git log -n 1 --format=%B "$commit" |
|
|
779
|
+
prev_commit=$(git log -n 1 --date=default --format=%B "$commit" |
|
|
778
780
|
GIT_AUTHOR_DATE="${author_info[0]}" \
|
|
779
781
|
GIT_AUTHOR_EMAIL="${author_info[1]}" \
|
|
780
782
|
GIT_AUTHOR_NAME="${author_info[2]}" \
|
|
@@ -959,7 +961,7 @@ subrepo:clean() {
|
|
|
959
961
|
|
|
960
962
|
o "Clean $subdir"
|
|
961
963
|
git:remove-worktree
|
|
962
|
-
if
|
|
964
|
+
if git:branch-exists "$branch"; then
|
|
963
965
|
o "Remove branch '$branch'."
|
|
964
966
|
RUN git update-ref -d "$ref"
|
|
965
967
|
clean_list+=("branch '$branch'")
|
|
@@ -1505,7 +1507,7 @@ assert-subdir-ready-for-init() {
|
|
|
1505
1507
|
error "The subdir '$subdir' is already a subrepo."
|
|
1506
1508
|
fi
|
|
1507
1509
|
# Check that subdir is part of the repo
|
|
1508
|
-
if [[ -z $(git log -1 -- $subdir) ]]; then
|
|
1510
|
+
if [[ -z $(git log -1 --date=default -- $subdir) ]]; then
|
|
1509
1511
|
error "The subdir '$subdir' is not part of this repo."
|
|
1510
1512
|
fi
|
|
1511
1513
|
}
|
|
@@ -1535,7 +1537,7 @@ get-all-subrepos() {
|
|
|
1535
1537
|
add-subrepo() {
|
|
1536
1538
|
if ! $ALL_wanted; then
|
|
1537
1539
|
for path in "${subrepos[@]}"; do
|
|
1538
|
-
[[ $1 =~ ^$path ]] && return
|
|
1540
|
+
[[ $1/ =~ ^$path/ ]] && return
|
|
1539
1541
|
done
|
|
1540
1542
|
fi
|
|
1541
1543
|
subrepos+=("$1")
|
|
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
|
14
14
|
|
|
15
|
-
s.add_dependency 'eac_cli', '~> 0.
|
|
16
|
-
s.add_dependency 'eac_ruby_gems_utils', '~> 0.
|
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
|
15
|
+
s.add_dependency 'eac_cli', '~> 0.7'
|
|
16
|
+
s.add_dependency 'eac_ruby_gems_utils', '~> 0.7', '>= 0.7.2'
|
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.46'
|
|
18
18
|
|
|
19
19
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
|
|
20
20
|
end
|
|
@@ -10,11 +10,7 @@ module EacRubyGemsUtils
|
|
|
10
10
|
VERSION_LINE_PATTERN = /\A(\s*)VERSION\s*=\s*[\'\"]([^\'\"]+)[\'\"](\s*)\z/.freeze
|
|
11
11
|
|
|
12
12
|
def value
|
|
13
|
-
path.read.each_line
|
|
14
|
-
VERSION_LINE_PATTERN.if_match(line.rstrip, false) do |m|
|
|
15
|
-
::Gem::Version.new(m[2])
|
|
16
|
-
end
|
|
17
|
-
end
|
|
13
|
+
path.read.each_line.lazy.map { |line| line_value(line) }.find { |v| v }
|
|
18
14
|
end
|
|
19
15
|
|
|
20
16
|
def value=(new_value)
|
|
@@ -23,6 +19,11 @@ module EacRubyGemsUtils
|
|
|
23
19
|
|
|
24
20
|
private
|
|
25
21
|
|
|
22
|
+
# @return Version found in line, nil otherwise.
|
|
23
|
+
def line_value(line)
|
|
24
|
+
VERSION_LINE_PATTERN.if_match(line.rstrip, false) { |m| ::Gem::Version.new(m[2]) }
|
|
25
|
+
end
|
|
26
|
+
|
|
26
27
|
def new_value_content(new_value)
|
|
27
28
|
path.read.each_line
|
|
28
29
|
.map { |line| new_value_line(line, new_value) }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_ruby_gems_utils/gem'
|
|
4
|
+
|
|
5
|
+
::RSpec.describe ::EacRubyGemsUtils::Gem::VersionFile do
|
|
6
|
+
let(:stubs_dir) { ::Pathname.new(__dir__).join('version_file_spec_files') }
|
|
7
|
+
let(:stub_file) { stubs_dir.join('a_version_file.rb') }
|
|
8
|
+
let(:instance) { described_class.new(stub_file) }
|
|
9
|
+
let(:target_version) { ::Gem::Version.new('0.69.1') }
|
|
10
|
+
|
|
11
|
+
describe '#value' do
|
|
12
|
+
it { expect(instance.value).to eq(target_version) }
|
|
13
|
+
end
|
|
14
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avm-tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esquilo Azul Company
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aranha-parsers
|
|
@@ -291,12 +291,16 @@ files:
|
|
|
291
291
|
- lib/avm/docker/registry.rb
|
|
292
292
|
- lib/avm/docker/runner.rb
|
|
293
293
|
- lib/avm/eac_rails_base0/apache_host.rb
|
|
294
|
+
- lib/avm/eac_rails_base0/apache_path.rb
|
|
294
295
|
- lib/avm/eac_rails_base0/deploy.rb
|
|
295
296
|
- lib/avm/eac_rails_base0/instance.rb
|
|
296
297
|
- lib/avm/eac_redmine_base0/core_update.rb
|
|
297
298
|
- lib/avm/eac_redmine_base0/data_unit.rb
|
|
298
299
|
- lib/avm/eac_redmine_base0/deploy.rb
|
|
299
300
|
- lib/avm/eac_redmine_base0/instance.rb
|
|
301
|
+
- lib/avm/eac_ubuntu_base0/apache.rb
|
|
302
|
+
- lib/avm/eac_ubuntu_base0/apache/resource.rb
|
|
303
|
+
- lib/avm/eac_ubuntu_base0/docker_image.rb
|
|
300
304
|
- lib/avm/eac_webapp_base0/apache_host.rb
|
|
301
305
|
- lib/avm/eac_webapp_base0/deploy.rb
|
|
302
306
|
- lib/avm/eac_webapp_base0/deploy/appended_directories.rb
|
|
@@ -380,7 +384,7 @@ files:
|
|
|
380
384
|
- lib/avm/instances/configuration/_rubocop.rb
|
|
381
385
|
- lib/avm/instances/configuration/_tests.rb
|
|
382
386
|
- lib/avm/instances/entries.rb
|
|
383
|
-
- lib/avm/instances/
|
|
387
|
+
- lib/avm/instances/entry.rb
|
|
384
388
|
- lib/avm/instances/entry_keys.rb
|
|
385
389
|
- lib/avm/launcher/context/instance_manager.rb
|
|
386
390
|
- lib/avm/launcher/context/instance_manager/cached_instance.rb
|
|
@@ -436,13 +440,11 @@ files:
|
|
|
436
440
|
- lib/avm/self/docker_image.rb
|
|
437
441
|
- lib/avm/self/instance.rb
|
|
438
442
|
- lib/avm/self/instance/entry_keys.rb
|
|
443
|
+
- lib/avm/self/root.rb
|
|
439
444
|
- lib/avm/stereotypes.rb
|
|
440
445
|
- lib/avm/stereotypes/eac_rails_base0.rb
|
|
441
446
|
- lib/avm/stereotypes/eac_redmine_base0.rb
|
|
442
447
|
- lib/avm/stereotypes/eac_ubuntu_base0.rb
|
|
443
|
-
- lib/avm/stereotypes/eac_ubuntu_base0/apache.rb
|
|
444
|
-
- lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb
|
|
445
|
-
- lib/avm/stereotypes/eac_ubuntu_base0/docker_image.rb
|
|
446
448
|
- lib/avm/stereotypes/eac_webapp_base0.rb
|
|
447
449
|
- lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb
|
|
448
450
|
- lib/avm/stereotypes/eac_wordpress_base0/deploy.rb
|
|
@@ -458,6 +460,7 @@ files:
|
|
|
458
460
|
- lib/avm/tools/runner.rb
|
|
459
461
|
- lib/avm/tools/runner/eac_rails_base0.rb
|
|
460
462
|
- lib/avm/tools/runner/eac_rails_base0/apache_host.rb
|
|
463
|
+
- lib/avm/tools/runner/eac_rails_base0/apache_path.rb
|
|
461
464
|
- lib/avm/tools/runner/eac_rails_base0/bundle.rb
|
|
462
465
|
- lib/avm/tools/runner/eac_rails_base0/data.rb
|
|
463
466
|
- lib/avm/tools/runner/eac_rails_base0/deploy.rb
|
|
@@ -543,6 +546,7 @@ files:
|
|
|
543
546
|
- lib/eac_launcher/vendor.rb
|
|
544
547
|
- lib/eac_launcher/vendor/github.rb
|
|
545
548
|
- lib/eac_launcher/version.rb
|
|
549
|
+
- template/avm/eac_rails_base0/apache_path/default.conf
|
|
546
550
|
- template/avm/eac_rails_base0/deploy/config/database.yml.template
|
|
547
551
|
- template/avm/eac_redmine_base0/deploy/config/install.sh.template
|
|
548
552
|
- template/avm/eac_redmine_base0/deploy/config/secrets.yml
|
|
@@ -560,6 +564,7 @@ files:
|
|
|
560
564
|
- vendor/eac_cli/Gemfile
|
|
561
565
|
- vendor/eac_cli/eac_cli.gemspec
|
|
562
566
|
- vendor/eac_cli/lib/eac_cli.rb
|
|
567
|
+
- vendor/eac_cli/lib/eac_cli/core_ext.rb
|
|
563
568
|
- vendor/eac_cli/lib/eac_cli/default_runner.rb
|
|
564
569
|
- vendor/eac_cli/lib/eac_cli/definition.rb
|
|
565
570
|
- vendor/eac_cli/lib/eac_cli/definition/argument_option.rb
|
|
@@ -574,8 +579,14 @@ files:
|
|
|
574
579
|
- vendor/eac_cli/lib/eac_cli/parser/options_collection.rb
|
|
575
580
|
- vendor/eac_cli/lib/eac_cli/parser/parse_result.rb
|
|
576
581
|
- vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb
|
|
582
|
+
- vendor/eac_cli/lib/eac_cli/patches.rb
|
|
583
|
+
- vendor/eac_cli/lib/eac_cli/patches/object.rb
|
|
584
|
+
- vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb
|
|
577
585
|
- vendor/eac_cli/lib/eac_cli/runner.rb
|
|
578
586
|
- vendor/eac_cli/lib/eac_cli/runner/context.rb
|
|
587
|
+
- vendor/eac_cli/lib/eac_cli/runner_with.rb
|
|
588
|
+
- vendor/eac_cli/lib/eac_cli/runner_with/help.rb
|
|
589
|
+
- vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb
|
|
579
590
|
- vendor/eac_cli/lib/eac_cli/version.rb
|
|
580
591
|
- vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb
|
|
581
592
|
- vendor/eac_cli/spec/rubocop_spec.rb
|
|
@@ -825,6 +836,8 @@ files:
|
|
|
825
836
|
- vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb
|
|
826
837
|
- vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb
|
|
827
838
|
- vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb
|
|
839
|
+
- vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
|
840
|
+
- vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
|
828
841
|
- vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
|
829
842
|
- vendor/eac_ruby_gems_utils/spec/rubocop_check_spec.rb
|
|
830
843
|
- vendor/eac_ruby_gems_utils/spec/spec_helper.rb
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
|
|
5
|
-
module Avm
|
|
6
|
-
module Instances
|
|
7
|
-
module Entries
|
|
8
|
-
class EntryReader
|
|
9
|
-
common_constructor :parent, :suffix, :options
|
|
10
|
-
|
|
11
|
-
def auto_value
|
|
12
|
-
parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def auto_value_method
|
|
16
|
-
"auto_#{suffix.to_s.gsub('.', '_')}"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def full_path
|
|
20
|
-
(parent.path_prefix + suffix_as_array).join('.')
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def optional_value
|
|
24
|
-
read(required: false, noinput: true) || auto_value
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def read(extra_options = {})
|
|
28
|
-
::Avm.configs.read_entry(full_path, options.merge(extra_options))
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def suffix_as_array
|
|
32
|
-
if suffix.is_a?(::Array)
|
|
33
|
-
suffix.dup
|
|
34
|
-
else
|
|
35
|
-
::EacRubyUtils::PathsHash.parse_entry_key(suffix.to_s)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def value
|
|
40
|
-
optional_value || read
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
|
5
|
-
::EacRubyUtils.require_sub(__FILE__)
|
|
6
|
-
|
|
7
|
-
module Avm
|
|
8
|
-
module Stereotypes
|
|
9
|
-
module EacUbuntuBase0
|
|
10
|
-
class Apache
|
|
11
|
-
common_constructor :host_env
|
|
12
|
-
|
|
13
|
-
def etc_root
|
|
14
|
-
'/etc/apache2'
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def service(command)
|
|
18
|
-
host_env.command('sudo', 'service', 'apache2', command)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def site(name)
|
|
22
|
-
::Avm::Stereotypes::EacUbuntuBase0::Apache::Site.new(self, name)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
|
|
5
|
-
module Avm
|
|
6
|
-
module Stereotypes
|
|
7
|
-
module EacUbuntuBase0
|
|
8
|
-
class Apache
|
|
9
|
-
class Site
|
|
10
|
-
common_constructor :apache, :name
|
|
11
|
-
|
|
12
|
-
def available_path
|
|
13
|
-
::File.join(apache.etc_root, 'sites-available', "#{name}.conf")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def available?
|
|
17
|
-
apache.host_env.file(available_path).exist?
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def disable
|
|
21
|
-
apache.host_env.command('sudo', 'a2dissite', name).execute!
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def enable
|
|
25
|
-
apache.host_env.command('sudo', 'a2ensite', name).execute!
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def enabled_path
|
|
29
|
-
::File.join(apache.etc_root, 'sites-enabled', "#{name}.conf")
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def enabled?
|
|
33
|
-
apache.host_env.file(enabled_path).exist?
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def remove
|
|
37
|
-
remove_disabled
|
|
38
|
-
remove_available
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def remove_available
|
|
42
|
-
raise 'Remove enabled before' if enabled?
|
|
43
|
-
|
|
44
|
-
apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available?
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def remove_disabled
|
|
48
|
-
disable if enabled?
|
|
49
|
-
apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled?
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def write(content)
|
|
53
|
-
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
|
54
|
-
apache.host_env.command('sudo', 'tee', available_path)
|
|
55
|
-
).execute!
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
|
4
|
-
require 'avm/docker/image'
|
|
5
|
-
|
|
6
|
-
module Avm
|
|
7
|
-
module Stereotypes
|
|
8
|
-
module EacUbuntuBase0
|
|
9
|
-
class DockerImage < ::Avm::Docker::Image
|
|
10
|
-
def stereotype_tag
|
|
11
|
-
'eac_ubuntu_base0'
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|