avm-tools 0.69.2 → 0.71.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/data/instance/files_unit.rb +2 -1
  3. data/lib/avm/eac_rails_base0/apache_host.rb +1 -1
  4. data/lib/avm/eac_rails_base0/apache_path.rb +50 -0
  5. data/lib/avm/eac_rails_base0/deploy.rb +2 -1
  6. data/lib/avm/eac_rails_base0/instance.rb +2 -2
  7. data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
  8. data/lib/avm/eac_redmine_base0/instance.rb +6 -5
  9. data/lib/avm/eac_ubuntu_base0/apache.rb +26 -0
  10. data/lib/avm/eac_ubuntu_base0/apache/resource.rb +59 -0
  11. data/lib/avm/eac_ubuntu_base0/docker_image.rb +14 -0
  12. data/lib/avm/eac_webapp_base0/apache_host.rb +2 -2
  13. data/lib/avm/eac_webapp_base0/deploy.rb +2 -2
  14. data/lib/avm/eac_webapp_base0/deploy/file_unit.rb +2 -1
  15. data/lib/avm/git/auto_commit_path.rb +4 -2
  16. data/lib/avm/instances/base/auto_values/filesystem.rb +3 -1
  17. data/lib/avm/instances/entries.rb +5 -8
  18. data/lib/avm/instances/entry.rb +47 -0
  19. data/lib/avm/instances/entry_keys.rb +2 -0
  20. data/lib/avm/patches/i18n.rb +1 -1
  21. data/lib/avm/patches/object/template.rb +1 -1
  22. data/lib/avm/rails/instance.rb +19 -0
  23. data/lib/avm/self.rb +0 -4
  24. data/lib/avm/self/instance.rb +1 -1
  25. data/lib/avm/self/root.rb +13 -0
  26. data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +1 -1
  27. data/lib/avm/tools/runner/eac_rails_base0.rb +7 -12
  28. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +38 -0
  29. data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +41 -0
  30. data/lib/avm/tools/runner/git/deploy.rb +3 -1
  31. data/lib/avm/tools/version.rb +1 -1
  32. data/template/avm/eac_rails_base0/apache_path/default.conf +13 -0
  33. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +4 -0
  34. data/vendor/eac_cli/lib/eac_cli/patches.rb +4 -0
  35. data/vendor/eac_cli/lib/eac_cli/patches/object.rb +5 -0
  36. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +24 -0
  37. data/vendor/eac_cli/lib/eac_cli/runner.rb +1 -1
  38. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +19 -2
  39. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  40. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  41. data/vendor/eac_git/vendor/git-subrepo/lib/git-subrepo +9 -7
  42. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +2 -1
  43. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +1 -1
  44. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +10 -6
  45. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  46. data/vendor/eac_ruby_gems_utils/spec/{rubocop_check_spec.rb → code/rubocop_check_spec.rb} +0 -0
  47. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +2 -1
  48. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  49. metadata +17 -8
  50. data/lib/avm/instances/entries/entry_reader.rb +0 -45
  51. data/lib/avm/stereotypes/eac_ubuntu_base0/apache.rb +0 -27
  52. data/lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb +0 -61
  53. data/lib/avm/stereotypes/eac_ubuntu_base0/docker_image.rb +0 -16
  54. data/lib/avm/stereotypes/rails/instance.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfc5d456e6af7146005267a2cde8312b31b99dab08864cff3641607feabfca8a
4
- data.tar.gz: 49a01ba7df2fdbd651cd89185ffc8b0dc3de1754bf590dfd3872cfaaaf210c6c
3
+ metadata.gz: 7f1459b957df5b13191a6411437651630d19ef6db3b12f62441d59238ede4679
4
+ data.tar.gz: 816d7f150ca0aa5e5cc573a77395b92c36fcba8fb41429f93dadc94f506233d8
5
5
  SHA512:
6
- metadata.gz: 923ca13f3beda2ffc8c36ef97b13be6d503e92f8a7075a20f4ac692b6542d7a1c470492909ccfc39ef8888581e607ee7f5c086b1ccd07ad04e945a901f678e76
7
- data.tar.gz: 98cc6fbb347ee06e2c0df2f490bff6898606ccd604aec40014ab75f2e633163c4087c1926e2cba9dba319bd6df7bc3ea7597aeea53536ceca4ccf437e205f178
6
+ metadata.gz: 422c93704e878d5894ac17e38f4df881d98a70ebd90696fa98fa9968b583710e2c2f7ff2f31cefb1df3fd9b01f2536d7ae6ee26ea35f6a98d5ae113415cec610
7
+ data.tar.gz: 3720efd94cdeb9dc295f53f7ac22e3460bf67f6e8c5ee1ef654ee4f3320de65138dfc70538d6bc2e2ae4f1b589c81960ca685af5685a4778f42158a59ce9118c
@@ -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(:fs_path), fs_path_subpath)
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
@@ -6,7 +6,7 @@ module Avm
6
6
  module EacRailsBase0
7
7
  class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
8
8
  def document_root
9
- "#{instance.read_entry(:fs_path)}/public"
9
+ "#{instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)}/public"
10
10
  end
11
11
 
12
12
  def extra_content
@@ -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(:fs_path), 'tmp', 'restart.txt')
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
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_webapp_base0/instance'
4
- require 'avm/stereotypes/rails/instance'
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::Stereotypes::Rails::Instance
9
+ include ::Avm::Rails::Instance
10
10
 
11
11
  FILES_UNITS = { uploads: 'public/uploads' }.freeze
12
12
  end
@@ -20,8 +20,8 @@ module Avm
20
20
  end
21
21
 
22
22
  def installer_path
23
- ::File.join(instance.read_entry(:fs_path), 'plugins', 'redmine_installer', 'installer',
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,24 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_redmine_base0/data_unit'
4
- require 'avm/stereotypes/eac_ubuntu_base0/docker_image'
4
+ require 'avm/eac_ubuntu_base0/docker_image'
5
5
  require 'avm/eac_webapp_base0/instance'
6
- require 'avm/stereotypes/rails/instance'
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::Stereotypes::Rails::Instance
11
+ include ::Avm::Rails::Instance
12
12
 
13
13
  FILES_UNITS = { files: 'files' }.freeze
14
14
 
15
15
  def docker_image_class
16
- ::Avm::Stereotypes::EacUbuntuBase0::DockerImage
16
+ ::Avm::EacUbuntuBase0::DockerImage
17
17
  end
18
18
 
19
19
  def docker_run_arguments
20
20
  [
21
- '--volume', "#{read_entry(:fs_path)}:/home/myuser/eac_redmine_base0",
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
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/docker/image'
5
+
6
+ module Avm
7
+ module EacUbuntuBase0
8
+ class DockerImage < ::Avm::Docker::Image
9
+ def stereotype_tag
10
+ 'eac_ubuntu_base0'
11
+ end
12
+ end
13
+ end
14
+ 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/stereotypes/eac_ubuntu_base0/apache'
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::Stereotypes::EacUbuntuBase0::Apache.new(instance.host_env)
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(:fs_path)
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(:fs_path)
98
+ instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
99
99
  end
100
100
  end
101
101
  end
@@ -27,7 +27,8 @@ module Avm
27
27
  end
28
28
 
29
29
  def target_path
30
- ::File.join(instance.read_entry(:fs_path), fs_path_subpath.to_s)
30
+ ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH),
31
+ fs_path_subpath.to_s)
31
32
  end
32
33
 
33
34
  def link_source_target
@@ -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
@@ -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, :fs_path) { |v| v + '/' + 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
- ::EacRubyUtils.require_sub(__FILE__)
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
@@ -12,6 +12,8 @@ module Avm
12
12
  const_set(key.gsub('.', '_').upcase, key)
13
13
  end
14
14
  end
15
+
16
+ FS_PATH = 'fs_path'
15
17
  end
16
18
  end
17
19
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/self'
3
+ require 'avm/self/root'
4
4
  require 'i18n'
5
5
 
6
6
  module Avm
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/self'
3
+ require 'avm/self/root'
4
4
  require 'eac_ruby_utils/patches/object/template'
5
5
 
6
6
  ::EacRubyUtils::Templates::Searcher.default.included_paths <<
@@ -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
@@ -16,10 +16,6 @@ module Avm
16
16
  def instance
17
17
  @instance ||= ::Avm::Self::Instance.by_id('avm-tools_self')
18
18
  end
19
-
20
- def root
21
- ::Pathname.new('../..').expand_path(__dir__)
22
- end
23
19
  end
24
20
  end
25
21
  end
@@ -3,7 +3,7 @@
3
3
  require 'avm/instances/base'
4
4
  require 'avm/self/docker_image'
5
5
  require 'avm/self/instance/entry_keys'
6
- require 'avm/stereotypes/eac_ubuntu_base0/docker_image'
6
+ require 'avm/eac_ubuntu_base0/docker_image'
7
7
 
8
8
  module Avm
9
9
  module Self
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ module Avm
6
+ module Self
7
+ class << self
8
+ def root
9
+ ::Pathname.new('../../..').expand_path(__dir__)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -7,7 +7,7 @@ module Avm
7
7
  module EacWordpressBase0
8
8
  class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
9
9
  def document_root
10
- instance.read_entry(:fs_path)
10
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
11
11
  end
12
12
 
13
13
  def extra_content
@@ -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
- include ::EacRubyUtils::SimpleCache
13
+ runner_with
14
14
 
15
- DOC = <<~DOCOPT
16
- Utilities for EacRailsBase0 instances.
17
-
18
- Usage:
19
- __PROGRAM__ [options] <instance_id> __SUBCOMMANDS__
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
@@ -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
@@ -79,7 +79,9 @@ module Avm
79
79
 
80
80
  def dev_instance_fs_path
81
81
  instance.if_present do |v|
82
- v.application.instance('dev').read_entry_optional(:fs_path)
82
+ v.application.instance('dev').read_entry_optional(
83
+ ::Avm::Instances::EntryKeys::FS_PATH
84
+ )
83
85
  end
84
86
  end
85
87
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.69.2'
5
+ VERSION = '0.71.0'
6
6
  end
7
7
  end
@@ -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>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_cli/patches'
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir["#{File.dirname(__FILE__)}/#{::File.basename(__FILE__, '.*')}/*.rb"].sort.each do |path|
4
+ require path
5
+ 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
@@ -45,7 +45,7 @@ module EacCli
45
45
  module AfterClassMethods
46
46
  def create(*runner_context_args)
47
47
  r = new
48
- r.runner_context = ::EacCli::Runner::Context.new(*runner_context_args)
48
+ r.runner_context = ::EacCli::Runner::Context.new(r, *runner_context_args)
49
49
  r
50
50
  end
51
51
 
@@ -5,13 +5,30 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EacCli
6
6
  module Runner
7
7
  class Context
8
- attr_reader :argv, :parent, :program_name
8
+ attr_reader :argv, :parent, :program_name, :runner
9
9
 
10
- def initialize(*context_args)
10
+ def initialize(runner, *context_args)
11
11
  options = context_args.extract_options!
12
12
  @argv = (context_args[0] || options.delete(:argv) || ARGV).dup.freeze
13
13
  @parent = context_args[1] || options.delete(:parent)
14
14
  @program_name = options.delete(:program_name)
15
+ @runner = runner
16
+ end
17
+
18
+ # Call a method in the runner or in one of it ancestors.
19
+ def call(method_name, *args)
20
+ return runner.send(method_name, *args) if runner.respond_to?(method_name)
21
+ return parent_call(method_name, *args) if parent.present?
22
+
23
+ raise ::NameError, "No method \"#{method_name}\" found in #{runner} or in its ancestors"
24
+ end
25
+
26
+ protected
27
+
28
+ def parent_call(method_name, *args)
29
+ return parent.context(method_name, *args) if parent.respond_to?(:context)
30
+
31
+ parent.runner_context.call(method_name, *args)
15
32
  end
16
33
  end
17
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.7.0'
4
+ VERSION = '0.9.0'
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacGit
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  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 OUT=true RUN git merge "$refs_subrepo_fetch"
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 [[ -e .git/$ref ]]; then
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")
@@ -11,8 +11,9 @@ module EacRubyGemsUtils
11
11
 
12
12
  GEMSPEC_EXTNAME = '.gemspec'
13
13
 
14
- common_constructor :root do
14
+ common_constructor :root, :host_env, default: [nil] do
15
15
  @root = ::Pathname.new(root).expand_path
16
+ self.host_env ||= ::EacRubyUtils::Envs.local
16
17
  end
17
18
 
18
19
  def to_s
@@ -11,7 +11,7 @@ module EacRubyGemsUtils
11
11
 
12
12
  def initialize(gem, command_args, extra_options = {})
13
13
  @gem = gem
14
- super(command_args, extra_options)
14
+ super(command_args, extra_options.merge(host_env: gem.host_env))
15
15
  end
16
16
 
17
17
  # Changes current directory to the gem's directory.
@@ -12,14 +12,12 @@ module EacRubyGemsUtils
12
12
  log('running "bundle install"...')
13
13
  return if bundle('install').execute.fetch(:exit_code).zero?
14
14
 
15
- if can_remove_gemfile_lock?
16
- log('"bundle install" failed, removing Gemfile.lock and trying again...')
17
- gemfile_lock_path.unlink if gemfile_lock_path.exist?
18
- bundle('install').execute!
19
- else
15
+ unless can_remove_gemfile_lock?
20
16
  raise '"bundle install" failed and the Gemfile.lock is part of gem' \
21
- '(Should be changed by developer)'
17
+ '(Should be changed by developer)'
22
18
  end
19
+
20
+ prepare_with_removable_gemfile_lock
23
21
  end
24
22
 
25
23
  def tests
@@ -33,6 +31,12 @@ module EacRubyGemsUtils
33
31
  infov self, message
34
32
  end
35
33
 
34
+ def prepare_with_removable_gemfile_lock
35
+ log('"bundle install" failed, removing Gemfile.lock and trying again...')
36
+ gemfile_lock_path.unlink if gemfile_lock_path.exist?
37
+ bundle('install').execute!
38
+ end
39
+
36
40
  def can_remove_gemfile_lock?
37
41
  !files.include?(gemfile_lock_path.relative_path_from(root))
38
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.7.2'
4
+ VERSION = '0.8.0'
5
5
  end
@@ -8,7 +8,8 @@ module EacRubyUtils
8
8
  # A [EacRubyUtils::Envs::Command] which runs in a clean Ruby environment.
9
9
  class Command < ::EacRubyUtils::Envs::Command
10
10
  def initialize(bundle_args, extra_options = {})
11
- super(::EacRubyUtils::Envs.local, bundle_args, extra_options)
11
+ host_env = extra_options.delete(:host_env)
12
+ super(host_env || ::EacRubyUtils::Envs.local, bundle_args, extra_options)
12
13
  end
13
14
 
14
15
  %w[system execute].each do |method_prefix|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.46.0'
4
+ VERSION = '0.47.0'
5
5
  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.69.2
4
+ version: 0.71.0
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-09-27 00:00:00.000000000 Z
11
+ date: 2020-10-14 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/entries/entry_reader.rb
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
@@ -421,6 +425,7 @@ files:
421
425
  - lib/avm/projects/stereotypes/ruby_gem/update.rb
422
426
  - lib/avm/projects/stereotypes/ruby_gem/version_bump.rb
423
427
  - lib/avm/rails.rb
428
+ - lib/avm/rails/instance.rb
424
429
  - lib/avm/rails/runners.rb
425
430
  - lib/avm/rails/runners/bundle.rb
426
431
  - lib/avm/rails/runners/runner.rb
@@ -436,13 +441,11 @@ files:
436
441
  - lib/avm/self/docker_image.rb
437
442
  - lib/avm/self/instance.rb
438
443
  - lib/avm/self/instance/entry_keys.rb
444
+ - lib/avm/self/root.rb
439
445
  - lib/avm/stereotypes.rb
440
446
  - lib/avm/stereotypes/eac_rails_base0.rb
441
447
  - lib/avm/stereotypes/eac_redmine_base0.rb
442
448
  - 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
449
  - lib/avm/stereotypes/eac_webapp_base0.rb
447
450
  - lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb
448
451
  - lib/avm/stereotypes/eac_wordpress_base0/deploy.rb
@@ -452,15 +455,16 @@ files:
452
455
  - lib/avm/stereotypes/postgresql/instance/data_unit.rb
453
456
  - lib/avm/stereotypes/postgresql/instance_with.rb
454
457
  - lib/avm/stereotypes/rails.rb
455
- - lib/avm/stereotypes/rails/instance.rb
456
458
  - lib/avm/sync.rb
457
459
  - lib/avm/tools.rb
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
467
+ - lib/avm/tools/runner/eac_rails_base0/rails_server.rb
464
468
  - lib/avm/tools/runner/eac_rails_base0/runner.rb
465
469
  - lib/avm/tools/runner/eac_redmine_base0.rb
466
470
  - lib/avm/tools/runner/eac_redmine_base0/bundle.rb
@@ -543,6 +547,7 @@ files:
543
547
  - lib/eac_launcher/vendor.rb
544
548
  - lib/eac_launcher/vendor/github.rb
545
549
  - lib/eac_launcher/version.rb
550
+ - template/avm/eac_rails_base0/apache_path/default.conf
546
551
  - template/avm/eac_rails_base0/deploy/config/database.yml.template
547
552
  - template/avm/eac_redmine_base0/deploy/config/install.sh.template
548
553
  - template/avm/eac_redmine_base0/deploy/config/secrets.yml
@@ -560,6 +565,7 @@ files:
560
565
  - vendor/eac_cli/Gemfile
561
566
  - vendor/eac_cli/eac_cli.gemspec
562
567
  - vendor/eac_cli/lib/eac_cli.rb
568
+ - vendor/eac_cli/lib/eac_cli/core_ext.rb
563
569
  - vendor/eac_cli/lib/eac_cli/default_runner.rb
564
570
  - vendor/eac_cli/lib/eac_cli/definition.rb
565
571
  - vendor/eac_cli/lib/eac_cli/definition/argument_option.rb
@@ -574,6 +580,9 @@ files:
574
580
  - vendor/eac_cli/lib/eac_cli/parser/options_collection.rb
575
581
  - vendor/eac_cli/lib/eac_cli/parser/parse_result.rb
576
582
  - vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb
583
+ - vendor/eac_cli/lib/eac_cli/patches.rb
584
+ - vendor/eac_cli/lib/eac_cli/patches/object.rb
585
+ - vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb
577
586
  - vendor/eac_cli/lib/eac_cli/runner.rb
578
587
  - vendor/eac_cli/lib/eac_cli/runner/context.rb
579
588
  - vendor/eac_cli/lib/eac_cli/runner_with.rb
@@ -828,10 +837,10 @@ files:
828
837
  - vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb
829
838
  - vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb
830
839
  - vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb
840
+ - vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb
831
841
  - vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
832
842
  - vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
833
843
  - vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb
834
- - vendor/eac_ruby_gems_utils/spec/rubocop_check_spec.rb
835
844
  - vendor/eac_ruby_gems_utils/spec/spec_helper.rb
836
845
  - vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile
837
846
  - vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock
@@ -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
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Stereotypes
5
- module Rails
6
- module Instance
7
- def bundle(*args)
8
- host_env.command('bundle', *args)
9
- .envvar('BUNDLE_GEMFILE', ::File.join(read_entry('fs_path'), 'Gemfile'))
10
- .envvar('RAILS_ENV', 'production')
11
- .chdir(read_entry('fs_path'))
12
- end
13
-
14
- def rake(*args)
15
- bundle('exec', 'rake', *args)
16
- end
17
- end
18
- end
19
- end
20
- end