avm-tools 0.69.3 → 0.72.0
Sign up to get free protection for your applications and to get access to all the features.
- 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_rails_base0/instance.rb +2 -2
- data/lib/avm/eac_redmine_base0/deploy.rb +2 -2
- data/lib/avm/eac_redmine_base0/instance.rb +6 -5
- 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/instances/application.rb +4 -0
- data/lib/avm/instances/base.rb +2 -1
- data/lib/avm/instances/base/auto_values/access.rb +5 -4
- data/lib/avm/instances/base/auto_values/admin.rb +2 -2
- data/lib/avm/instances/base/auto_values/database.rb +1 -1
- data/lib/avm/instances/base/auto_values/filesystem.rb +8 -2
- data/lib/avm/instances/base/auto_values/ruby.rb +1 -1
- data/lib/avm/instances/base/auto_values/system.rb +2 -2
- data/lib/avm/instances/entries.rb +5 -8
- data/lib/avm/instances/entry.rb +53 -0
- data/lib/avm/instances/entry_keys.rb +39 -6
- data/lib/avm/patches/i18n.rb +1 -1
- data/lib/avm/patches/object/template.rb +1 -1
- data/lib/avm/rails/instance.rb +19 -0
- data/lib/avm/self.rb +0 -4
- data/lib/avm/self/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/eac_rails_base0/rails_server.rb +41 -0
- data/lib/avm/tools/runner/git/deploy.rb +3 -1
- data/lib/avm/tools/runner/instance.rb +28 -0
- data/lib/avm/tools/runner/instance/info.rb +44 -0
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/default.conf +13 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +19 -2
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +2 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +1 -1
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +10 -6
- data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
- data/vendor/eac_ruby_gems_utils/spec/{rubocop_check_spec.rb → code/rubocop_check_spec.rb} +0 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +2 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +15 -8
- 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
- data/lib/avm/stereotypes/rails/instance.rb +0 -20
@@ -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
|
@@ -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
|
-
|
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
|
-
|
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
|
File without changes
|
@@ -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
|
-
|
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|
|
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.72.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-10-
|
11
|
+
date: 2020-10-18 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
|
@@ -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
|
@@ -489,6 +493,8 @@ files:
|
|
489
493
|
- lib/avm/tools/runner/git/revisions_test.rb
|
490
494
|
- lib/avm/tools/runner/git/subrepo.rb
|
491
495
|
- lib/avm/tools/runner/git/subrepo/check.rb
|
496
|
+
- lib/avm/tools/runner/instance.rb
|
497
|
+
- lib/avm/tools/runner/instance/info.rb
|
492
498
|
- lib/avm/tools/runner/launcher.rb
|
493
499
|
- lib/avm/tools/runner/launcher/instances.rb
|
494
500
|
- lib/avm/tools/runner/launcher/projects.rb
|
@@ -543,6 +549,7 @@ files:
|
|
543
549
|
- lib/eac_launcher/vendor.rb
|
544
550
|
- lib/eac_launcher/vendor/github.rb
|
545
551
|
- lib/eac_launcher/version.rb
|
552
|
+
- template/avm/eac_rails_base0/apache_path/default.conf
|
546
553
|
- template/avm/eac_rails_base0/deploy/config/database.yml.template
|
547
554
|
- template/avm/eac_redmine_base0/deploy/config/install.sh.template
|
548
555
|
- template/avm/eac_redmine_base0/deploy/config/secrets.yml
|
@@ -832,10 +839,10 @@ files:
|
|
832
839
|
- vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb
|
833
840
|
- vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb
|
834
841
|
- vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb
|
842
|
+
- vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb
|
835
843
|
- vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb
|
836
844
|
- vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb
|
837
845
|
- vendor/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb
|
838
|
-
- vendor/eac_ruby_gems_utils/spec/rubocop_check_spec.rb
|
839
846
|
- vendor/eac_ruby_gems_utils/spec/spec_helper.rb
|
840
847
|
- vendor/eac_ruby_gems_utils/spec/support/mygem/Gemfile
|
841
848
|
- 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
|