avm-tools 0.73.0 → 0.76.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/{stereotypes/eac_rails_base0.rb → eac_rails_base0.rb} +1 -3
- data/lib/avm/eac_rails_base0/instance.rb +2 -5
- data/lib/avm/{rails/runners.rb → eac_rails_base1.rb} +2 -4
- data/lib/avm/{rails → eac_rails_base1}/instance.rb +8 -3
- data/lib/avm/eac_rails_base1/runner.rb +12 -0
- data/lib/avm/eac_rails_base1/runner/bundle.rb +28 -0
- data/lib/avm/eac_rails_base1/runner/code_runner.rb +28 -0
- data/lib/avm/eac_rails_base1/runner_with/bundle.rb +57 -0
- data/lib/avm/{stereotypes/rails.rb → eac_redmine_base0.rb} +2 -4
- data/lib/avm/eac_redmine_base0/instance.rb +2 -4
- data/lib/avm/{stereotypes/eac_ubuntu_base0.rb → eac_ubuntu_base0.rb} +1 -3
- data/lib/avm/{stereotypes/eac_webapp_base0.rb → eac_webapp_base0.rb} +1 -3
- data/lib/avm/eac_webapp_base0/deploy.rb +17 -40
- data/lib/avm/eac_webapp_base0/deploy/build.rb +48 -0
- data/lib/avm/eac_webapp_base0/deploy/git_info.rb +13 -0
- data/lib/avm/eac_webapp_base0/deploy/version.rb +4 -0
- data/lib/avm/eac_webapp_base0/deploy/write_on_target.rb +18 -0
- data/lib/avm/eac_webapp_base0/instance.rb +2 -2
- data/lib/avm/eac_webapp_base0/runner.rb +12 -0
- data/lib/avm/eac_webapp_base0/runner/apache_host.rb +2 -3
- data/lib/avm/eac_webapp_base0/runner/data.rb +1 -1
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
- data/lib/avm/eac_webapp_base0/runner/deploy.rb +4 -16
- data/lib/avm/eac_wordpress_base0.rb +9 -0
- data/lib/avm/eac_wordpress_base0/apache_host.rb +25 -0
- data/lib/avm/eac_wordpress_base0/deploy.rb +10 -0
- data/lib/avm/eac_wordpress_base0/instance.rb +24 -0
- data/lib/avm/eac_writings_base0.rb +9 -0
- data/lib/avm/eac_writings_base0/apache_host.rb +17 -0
- data/lib/avm/eac_writings_base0/commons.rb +12 -0
- data/lib/avm/eac_writings_base0/deploy.rb +36 -0
- data/lib/avm/eac_writings_base0/file_build.rb +45 -0
- data/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +19 -0
- data/lib/avm/eac_writings_base0/file_build/chapter_index.rb +23 -0
- data/lib/avm/eac_writings_base0/file_build/tex_source.rb +33 -0
- data/lib/avm/eac_writings_base0/instance.rb +11 -0
- data/lib/avm/eac_writings_base0/project.rb +33 -0
- data/lib/avm/eac_writings_base0/project_build.rb +117 -0
- data/lib/avm/eac_writings_base0/project_build/chapters_content.rb +47 -0
- data/lib/avm/eac_writings_base0/project_build/copy_files.rb +42 -0
- data/lib/avm/executables.rb +1 -1
- data/lib/avm/files/appendable.rb +55 -0
- data/lib/avm/files/appendable/file_content.rb +24 -0
- data/lib/avm/files/appendable/plain_directory.rb +25 -0
- data/lib/avm/files/appendable/resource_base.rb +13 -0
- data/lib/avm/files/appendable/tar_output_command.rb +26 -0
- data/lib/avm/files/appendable/templatized_directory.rb +28 -0
- data/lib/avm/files/appender.rb +11 -0
- data/lib/avm/files/deploy.rb +72 -0
- data/lib/avm/files/formatter.rb +8 -4
- data/lib/avm/git/auto_commit_path.rb +2 -4
- data/lib/avm/git/auto_commit_path/ruby.rb +20 -0
- data/lib/avm/git/commit/deploy.rb +8 -61
- data/lib/avm/instances/runner.rb +40 -0
- data/lib/avm/{stereotypes/postgresql.rb → postgresql.rb} +1 -3
- data/lib/avm/postgresql/instance.rb +63 -0
- data/lib/avm/postgresql/instance/data_unit.rb +39 -0
- data/lib/avm/postgresql/instance_with.rb +18 -0
- data/lib/avm/projects/stereotypes/git_subtree/publish.rb +2 -0
- data/lib/avm/projects/stereotypes/git_subtree/warp.rb +3 -0
- data/lib/avm/tools/runner.rb +3 -3
- data/lib/avm/tools/runner/eac_rails_base0.rb +5 -18
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +1 -1
- data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +7 -12
- data/lib/avm/tools/runner/eac_rails_base0/runner.rb +3 -3
- data/lib/avm/tools/runner/eac_redmine_base0.rb +5 -23
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +1 -1
- data/lib/avm/tools/runner/eac_redmine_base0/docker.rb +1 -1
- data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +3 -3
- data/lib/avm/tools/runner/eac_wordpress_base0.rb +5 -24
- data/lib/avm/tools/runner/{eac_rails_base0/data.rb → eac_writings_base0.rb} +4 -4
- data/lib/avm/tools/runner/files/format.rb +3 -2
- data/lib/avm/tools/runner/git/auto_commit.rb +11 -0
- data/lib/avm/tools/runner/git/deploy.rb +1 -1
- data/lib/avm/tools/runner/local_project/eac_writings_base0.rb +35 -0
- data/lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb +48 -0
- data/lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb +37 -0
- data/lib/avm/tools/runner/local_project/eac_writings_base0/info.rb +36 -0
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/{stereotypes/eac_ubuntu_base0 → eac_ubuntu_base0}/docker_image/Dockerfile +0 -0
- data/template/avm/{stereotypes/eac_wordpress_base0 → eac_wordpress_base0}/deploy/wp-config.php.template +0 -0
- data/template/avm/eac_writings_base0/commons/all.tex +5 -0
- data/template/avm/eac_writings_base0/commons/ebook.tex +11 -0
- data/template/avm/eac_writings_base0/commons/images.tex +11 -0
- data/template/avm/eac_writings_base0/commons/links.tex +2 -0
- data/template/avm/eac_writings_base0/commons/portuguese.tex +8 -0
- data/template/avm/eac_writings_base0/commons/source_code.tex +21 -0
- data/template/avm/eac_writings_base0/commons/source_code/java.tex +15 -0
- data/template/avm/eac_writings_base0/commons/utils.tex +6 -0
- data/template/avm/eac_writings_base0/deploy/index.html.template +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -39
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +41 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +64 -36
- data/lib/avm/git/commit/deploy/appended.rb +0 -37
- data/lib/avm/git/commit/deploy/appended/base.rb +0 -17
- data/lib/avm/git/commit/deploy/appended/directory.rb +0 -32
- data/lib/avm/git/commit/deploy/appended/file_content.rb +0 -28
- data/lib/avm/rails/runners/bundle.rb +0 -35
- data/lib/avm/rails/runners/runner.rb +0 -48
- data/lib/avm/stereotypes/eac_redmine_base0.rb +0 -11
- data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +0 -27
- data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +0 -12
- data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +0 -26
- data/lib/avm/stereotypes/postgresql/instance.rb +0 -65
- data/lib/avm/stereotypes/postgresql/instance/data_unit.rb +0 -41
- data/lib/avm/stereotypes/postgresql/instance_with.rb +0 -20
- data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +0 -16
- data/lib/avm/tools/runner/eac_rails_base0/bundle.rb +0 -14
- data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +0 -15
- data/lib/avm/tools/runner/eac_redmine_base0/bundle.rb +0 -14
- data/lib/avm/tools/runner/eac_redmine_base0/data.rb +0 -27
- data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +0 -16
- data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +0 -15
- data/lib/avm/tools/runner/eac_redmine_base0/runner.rb +0 -14
- data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +0 -17
- data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +0 -15
- data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +0 -15
data/lib/avm/files/formatter.rb
CHANGED
@@ -10,7 +10,11 @@ module Avm
|
|
10
10
|
require_sub __FILE__
|
11
11
|
enable_simple_cache
|
12
12
|
enable_console_speaker
|
13
|
-
|
13
|
+
enable_listable
|
14
|
+
lists.add_symbol :option, :apply, :recursive, :verbose
|
15
|
+
common_constructor :source_paths, :options, default: [{}] do
|
16
|
+
options.assert_valid_keys(self.class.lists.option.values)
|
17
|
+
end
|
14
18
|
|
15
19
|
FORMATS = %w[ruby php html python xml json generic_plain].freeze
|
16
20
|
|
@@ -27,7 +31,7 @@ module Avm
|
|
27
31
|
infom "Applying #{@formats_files.count} format(s)... "
|
28
32
|
@formats_files.each do |format, files|
|
29
33
|
infom "Applying format #{format.name} (Files matched: #{files.count})..."
|
30
|
-
next unless options
|
34
|
+
next unless options[OPTION_APPLY]
|
31
35
|
|
32
36
|
@result += format.apply(files)
|
33
37
|
end
|
@@ -35,7 +39,7 @@ module Avm
|
|
35
39
|
|
36
40
|
def traverser_check_file(file)
|
37
41
|
format = find_format(file)
|
38
|
-
infov file, format ? format.class : '-' if options
|
42
|
+
infov file, format ? format.class : '-' if options[OPTION_VERBOSE]
|
39
43
|
return unless format
|
40
44
|
|
41
45
|
@formats_files[format] ||= []
|
@@ -79,7 +83,7 @@ module Avm
|
|
79
83
|
end
|
80
84
|
|
81
85
|
def traverser_recursive
|
82
|
-
options
|
86
|
+
options[OPTION_RECURSIVE]
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
@@ -5,6 +5,7 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
module Avm
|
6
6
|
module Git
|
7
7
|
class AutoCommitPath
|
8
|
+
require_sub __FILE__, include_modules: true
|
8
9
|
enable_console_speaker
|
9
10
|
common_constructor :git, :path do
|
10
11
|
self.path = path.to_pathname
|
@@ -31,10 +32,7 @@ module Avm
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def class_name
|
34
|
-
|
35
|
-
pattern.if_match(relative_path.to_path, false) { |m| return m[1].camelize }
|
36
|
-
end
|
37
|
-
raise "No pattern matched \"#{relative_path}\""
|
35
|
+
ruby_class_name || relative_path.to_path
|
38
36
|
end
|
39
37
|
|
40
38
|
def commit_message
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
class AutoCommitPath
|
8
|
+
module Ruby
|
9
|
+
RUBY_CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
|
10
|
+
|
11
|
+
def ruby_class_name
|
12
|
+
RUBY_CLASS_NAME_PATTERNS.each do |pattern|
|
13
|
+
pattern.if_match(relative_path.to_path, false) { |m| return m[1].camelize }
|
14
|
+
end
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -2,90 +2,37 @@
|
|
2
2
|
|
3
3
|
require 'addressable'
|
4
4
|
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'avm/files/appendable'
|
6
|
+
require 'avm/files/deploy'
|
5
7
|
require 'avm/patches/object/template'
|
6
8
|
|
7
9
|
module Avm
|
8
10
|
module Git
|
9
11
|
class Commit
|
10
12
|
class Deploy
|
11
|
-
|
13
|
+
include ::Avm::Files::Appendable
|
12
14
|
enable_simple_cache
|
13
15
|
|
14
|
-
attr_reader :build_dir, :commit, :target_env, :target_path
|
16
|
+
attr_reader :build_dir, :commit, :target_env, :target_path
|
15
17
|
|
16
18
|
def initialize(commit, target_env, target_path)
|
17
19
|
@commit = commit
|
18
20
|
@target_env = target_env
|
19
21
|
@target_path = target_path
|
20
|
-
@variables_source = nil
|
21
|
-
end
|
22
|
-
|
23
|
-
def variables_source_set(source)
|
24
|
-
@variables_source = source
|
25
|
-
self
|
26
22
|
end
|
27
23
|
|
28
24
|
def run
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
clear_content
|
34
|
-
send_untar_package
|
35
|
-
set_target_permission
|
36
|
-
end
|
25
|
+
fd = ::Avm::Files::Deploy.new(target_env, target_path)
|
26
|
+
fd.append_tar_output_command(git_archive_command)
|
27
|
+
fd.appended.push(*appended)
|
28
|
+
fd.run
|
37
29
|
end
|
38
30
|
|
39
31
|
private
|
40
32
|
|
41
|
-
def on_build_dir
|
42
|
-
@build_dir = ::Dir.mktmpdir
|
43
|
-
yield
|
44
|
-
ensure
|
45
|
-
::FileUtils.rm_rf(@build_dir)
|
46
|
-
end
|
47
|
-
|
48
|
-
def copy_git_content
|
49
|
-
git_archive_command.pipe(untar_git_archive_command).execute!
|
50
|
-
end
|
51
|
-
|
52
|
-
def mkdir_target
|
53
|
-
target_env.command('mkdir', '-p', target_path).execute!
|
54
|
-
end
|
55
|
-
|
56
|
-
def clear_content
|
57
|
-
target_env.command(
|
58
|
-
'find', target_path, '-mindepth', '1', '-maxdepth', '1', '-exec', 'rm', '-rf', '{}', ';'
|
59
|
-
).execute!
|
60
|
-
end
|
61
|
-
|
62
|
-
def send_untar_package
|
63
|
-
tar_build_command.pipe(untar_build_command).execute!
|
64
|
-
end
|
65
|
-
|
66
|
-
def set_target_permission
|
67
|
-
target_env.command('chmod', '755', target_path).execute!
|
68
|
-
end
|
69
|
-
|
70
33
|
def git_archive_command
|
71
34
|
commit.git.command('archive', '--format=tar', commit.sha1)
|
72
35
|
end
|
73
|
-
|
74
|
-
def untar_git_archive_command
|
75
|
-
source_env.command('tar', '-xf', '-', '-C', build_dir)
|
76
|
-
end
|
77
|
-
|
78
|
-
def tar_build_command
|
79
|
-
source_env.command('tar', '-czO', '-C', build_dir, '.')
|
80
|
-
end
|
81
|
-
|
82
|
-
def untar_build_command
|
83
|
-
target_env.command('tar', '-xzf', '-', '-C', target_path)
|
84
|
-
end
|
85
|
-
|
86
|
-
def source_env
|
87
|
-
::EacRubyUtils::Envs.local
|
88
|
-
end
|
89
36
|
end
|
90
37
|
end
|
91
38
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Instances
|
8
|
+
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
9
|
+
class << self
|
10
|
+
def instance_class
|
11
|
+
::Avm.const_get(stereotype_name).const_get('Instance')
|
12
|
+
end
|
13
|
+
|
14
|
+
def stereotype_module
|
15
|
+
::Avm.const_get(stereotype_name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def stereotype_name
|
19
|
+
name.demodulize
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
runner_with
|
24
|
+
description = "Utilities for #{stereotype_name} instances."
|
25
|
+
runner_definition do
|
26
|
+
desc description
|
27
|
+
pos_arg 'instance-id'
|
28
|
+
subcommands
|
29
|
+
end
|
30
|
+
|
31
|
+
delegate :instance_class, :stereotype_module, :stereotype_name, to: :class
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def instance_uncached
|
36
|
+
self.class.instance_class.by_id(options.fetch('<instance-id>'))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/postgresql/instance/data_unit'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Postgresql
|
7
|
+
class Instance
|
8
|
+
def initialize(env, connection_params)
|
9
|
+
@env = env
|
10
|
+
@connection_params = connection_params.with_indifferent_access
|
11
|
+
end
|
12
|
+
|
13
|
+
def data_unit
|
14
|
+
::Avm::Postgresql::Instance::DataUnit.new(self)
|
15
|
+
end
|
16
|
+
|
17
|
+
def dump_command
|
18
|
+
env.command('pg_dump', '--no-privileges', '--clean', '--no-owner', *common_command_args)
|
19
|
+
.envvar('PGPASSWORD', password)
|
20
|
+
end
|
21
|
+
|
22
|
+
def dump_gzip_command
|
23
|
+
dump_command.append(['@ESC_|', 'gzip', '-9', '-c'])
|
24
|
+
end
|
25
|
+
|
26
|
+
def psql_command
|
27
|
+
env.command("@ESC_PGPASSWORD=#{password}", 'psql', *common_command_args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def psql_command_command(sql)
|
31
|
+
psql_command.append(['--quiet', '--tuples-only', '--command', sql])
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
attr_reader :env, :connection_params
|
37
|
+
|
38
|
+
def common_command_args
|
39
|
+
['--host', host, '--username', user, '--port', port, name]
|
40
|
+
end
|
41
|
+
|
42
|
+
def host
|
43
|
+
connection_params[:host] || '127.0.0.1'
|
44
|
+
end
|
45
|
+
|
46
|
+
def port
|
47
|
+
connection_params[:port] || '5432'
|
48
|
+
end
|
49
|
+
|
50
|
+
def user
|
51
|
+
connection_params.fetch(:user)
|
52
|
+
end
|
53
|
+
|
54
|
+
def password
|
55
|
+
connection_params.fetch(:password)
|
56
|
+
end
|
57
|
+
|
58
|
+
def name
|
59
|
+
connection_params.fetch(:name)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/data/instance/unit'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Postgresql
|
7
|
+
class Instance
|
8
|
+
class DataUnit < ::Avm::Data::Instance::Unit
|
9
|
+
EXTENSION = '.pgdump.gz'
|
10
|
+
|
11
|
+
before_load :clear_database
|
12
|
+
|
13
|
+
def dump_command
|
14
|
+
instance.dump_gzip_command
|
15
|
+
end
|
16
|
+
|
17
|
+
def load_command
|
18
|
+
instance.psql_command.prepend(['gzip', '-d', '@ESC_|'])
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def clear_database
|
24
|
+
info 'Clearing database (Dropping all tables)...'
|
25
|
+
run_sql(drop_all_tables_sql).if_present { |v| run_sql(v) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def drop_all_tables_sql
|
29
|
+
"select 'drop table \"' || tablename || '\" cascade;' from pg_tables " \
|
30
|
+
"where schemaname = 'public';"
|
31
|
+
end
|
32
|
+
|
33
|
+
def run_sql(sql)
|
34
|
+
instance.psql_command_command(sql).execute!
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/instances/entry_keys'
|
4
|
+
require 'avm/postgresql/instance'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Postgresql
|
8
|
+
module InstanceWith
|
9
|
+
def pg
|
10
|
+
@pg ||= ::Avm::Postgresql::Instance.new(
|
11
|
+
host_env, user: read_entry(::Avm::Instances::EntryKeys::DATABASE_USERNAME),
|
12
|
+
password: read_entry(::Avm::Instances::EntryKeys::DATABASE_PASSWORD),
|
13
|
+
name: read_entry(::Avm::Instances::EntryKeys::DATABASE_NAME)
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/avm/tools/runner.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
5
|
-
::EacRubyUtils.require_sub(__FILE__)
|
6
3
|
require 'avm/self'
|
7
4
|
require 'avm/tools/version'
|
8
5
|
require 'eac_ruby_base0/runner'
|
6
|
+
require 'eac_ruby_utils/console/docopt_runner'
|
7
|
+
require 'eac_ruby_utils/core_ext'
|
9
8
|
|
10
9
|
module Avm
|
11
10
|
module Tools
|
12
11
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
13
12
|
include ::EacRubyBase0::Runner
|
13
|
+
require_sub __FILE__
|
14
14
|
|
15
15
|
runner_definition do
|
16
16
|
desc 'Tools for AVM.'
|
@@ -1,28 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'avm/eac_rails_base0'
|
4
|
+
require 'avm/eac_rails_base1/runner'
|
4
5
|
require 'eac_ruby_utils/console/docopt_runner'
|
5
|
-
require 'eac_ruby_utils/
|
6
|
-
require 'avm/eac_rails_base0/instance'
|
7
|
-
::EacRubyUtils.require_sub(__FILE__)
|
6
|
+
require 'eac_ruby_utils/core_ext'
|
8
7
|
|
9
8
|
module Avm
|
10
9
|
module Tools
|
11
10
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
12
|
-
class EacRailsBase0 < ::
|
13
|
-
|
14
|
-
|
15
|
-
runner_definition do
|
16
|
-
desc 'Utilities for EacRailsBase0 instances.'
|
17
|
-
pos_arg :instance_id
|
18
|
-
subcommands
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def instance_uncached
|
24
|
-
::Avm::EacRailsBase0::Instance.by_id(options['<instance_id>'])
|
25
|
-
end
|
11
|
+
class EacRailsBase0 < ::Avm::EacRailsBase1::Runner
|
12
|
+
require_sub __FILE__
|
26
13
|
end
|
27
14
|
end
|
28
15
|
end
|
@@ -8,7 +8,7 @@ require 'avm/eac_rails_base0/apache_path'
|
|
8
8
|
module Avm
|
9
9
|
module Tools
|
10
10
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
-
class EacRailsBase0 < ::
|
11
|
+
class EacRailsBase0 < ::Avm::EacRailsBase1::Runner
|
12
12
|
class ApachePath < ::EacRubyUtils::Console::DocoptRunner
|
13
13
|
runner_with
|
14
14
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'avm/eac_rails_base1/runner_with/bundle'
|
3
4
|
require 'avm/instances/entry_keys'
|
4
5
|
require 'eac_cli/core_ext'
|
5
6
|
require 'eac_ruby_utils/console/docopt_runner'
|
@@ -8,31 +9,25 @@ require 'shellwords'
|
|
8
9
|
module Avm
|
9
10
|
module Tools
|
10
11
|
class Runner < ::EacRubyUtils::Console::DocoptRunner
|
11
|
-
class EacRailsBase0 < ::
|
12
|
+
class EacRailsBase0 < ::Avm::EacRailsBase1::Runner
|
12
13
|
class RailsServer
|
13
|
-
|
14
|
-
|
14
|
+
DEFAULT_RAILS_ENVIRONMENT = 'development'
|
15
|
+
runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle
|
15
16
|
runner_definition do
|
16
17
|
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
18
|
end
|
20
19
|
|
21
20
|
def run
|
21
|
+
infov 'Environment', rails_environment
|
22
22
|
infov 'Bundle args', ::Shellwords.join(bundle_args)
|
23
|
-
infov 'Result',
|
23
|
+
infov 'Result', bundle_command.system
|
24
24
|
end
|
25
25
|
|
26
26
|
protected
|
27
27
|
|
28
28
|
def bundle_args
|
29
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
|
30
|
+
runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)]
|
36
31
|
end
|
37
32
|
end
|
38
33
|
end
|