avm-tools 0.87.1 → 0.92.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/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +1 -1
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/apache_host.rb +1 -1
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -3
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build/file.rb +4 -4
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/deploy.rb +6 -6
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/instance.rb +1 -1
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/project.rb +1 -1
- data/lib/avm/eac_rails_base1/runner/log.rb +43 -0
- data/lib/avm/eac_rails_base1/runner_with/bundle.rb +2 -32
- data/lib/avm/eac_rails_base1/runner_with/rails_environment.rb +47 -0
- data/lib/avm/eac_webapp_base0/deploy.rb +16 -4
- data/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +1 -1
- data/lib/avm/eac_webapp_base0/deploy/git_info.rb +1 -1
- data/lib/avm/eac_webapp_base0/instance.rb +2 -0
- data/lib/avm/eac_webapp_base0/runner/deploy.rb +13 -21
- data/lib/avm/executables.rb +1 -1
- data/lib/avm/git/auto_commit/commit_info.rb +22 -0
- data/lib/avm/git/auto_commit/rules.rb +31 -0
- data/lib/avm/git/auto_commit/rules/base.rb +39 -0
- data/lib/avm/git/auto_commit/rules/last.rb +19 -0
- data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
- data/lib/avm/git/auto_commit/rules/nth.rb +23 -0
- data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
- data/lib/avm/git/file_auto_fixup.rb +15 -62
- data/lib/avm/instances/runner.rb +1 -1
- data/lib/avm/tools/runner/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
- data/lib/avm/tools/runner/eac_webapp_base0.rb +14 -0
- data/lib/avm/tools/runner/git/auto_commit.rb +12 -13
- data/lib/avm/tools/runner/git/auto_fixup.rb +9 -9
- data/lib/avm/tools/runner/git/commit.rb +11 -20
- data/lib/avm/tools/runner/instance.rb +3 -6
- data/lib/avm/tools/runner/instance/info.rb +4 -7
- data/lib/avm/tools/runner/local_project/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
- data/lib/avm/tools/runner/local_project/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -9
- data/lib/avm/tools/version.rb +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +6 -1
- data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +42 -13
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b6568f1c571107315662a90e29d111bf1af9a534c326ea57f358fa68c7ec550
|
4
|
+
data.tar.gz: 808a16008057b72ef58b11d91f05e021c814bca2100f3c5e85c0363bcac97216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc0628987c36f9c72d642546a7b4ab85e3c630a239e053af92beb86658deac8fba9c7e389947b843097499fce529d2b100d734173aad36dea200d5c874a61ef8
|
7
|
+
data.tar.gz: c3b19cbf0a2d063e5a436d314b5b20ab7167e584bca986c486e6ee2fd9beccfcd156e0d7095559caf0fd4236f279aeea91a81cb45207cd5b01f769e2987c85b4
|
@@ -4,7 +4,7 @@ require 'eac_ruby_utils/core_ext'
|
|
4
4
|
require 'eac_ruby_utils/fs/clearable_directory'
|
5
5
|
|
6
6
|
module Avm
|
7
|
-
module
|
7
|
+
module EacAsciidoctorBase0
|
8
8
|
class Build
|
9
9
|
require_sub __FILE__
|
10
10
|
enable_console_speaker
|
@@ -15,6 +15,8 @@ module Avm
|
|
15
15
|
self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
|
16
16
|
end
|
17
17
|
|
18
|
+
SOURCE_EXTNAMES = %w[.adoc .asc].freeze
|
19
|
+
|
18
20
|
def run
|
19
21
|
infov 'Files to build', source_files.count
|
20
22
|
target_directory.clear
|
@@ -34,9 +36,9 @@ module Avm
|
|
34
36
|
def source_files_uncached
|
35
37
|
r = []
|
36
38
|
project.root.children.each do |child|
|
37
|
-
next unless child.extname
|
39
|
+
next unless SOURCE_EXTNAMES.include?(child.extname)
|
38
40
|
|
39
|
-
r << ::Avm::
|
41
|
+
r << ::Avm::EacAsciidoctorBase0::Build::File.new(self, child.basename)
|
40
42
|
end
|
41
43
|
r
|
42
44
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'asciidoctor'
|
4
4
|
|
5
5
|
module Avm
|
6
|
-
module
|
6
|
+
module EacAsciidoctorBase0
|
7
7
|
class Build
|
8
8
|
class File
|
9
9
|
enable_console_speaker
|
@@ -11,8 +11,8 @@ module Avm
|
|
11
11
|
|
12
12
|
def run
|
13
13
|
infov 'Building', subpath
|
14
|
-
|
15
|
-
|
14
|
+
::Asciidoctor.convert_file source_path.to_path,
|
15
|
+
to_file: target_path.to_path, safe: :unsafe, mkdirs: true
|
16
16
|
end
|
17
17
|
|
18
18
|
def source_path
|
@@ -1,23 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_webapp_base0/deploy'
|
4
|
-
require 'avm/
|
5
|
-
require 'avm/
|
4
|
+
require 'avm/eac_asciidoctor_base0/project'
|
5
|
+
require 'avm/eac_asciidoctor_base0/build'
|
6
6
|
|
7
7
|
module Avm
|
8
|
-
module
|
8
|
+
module EacAsciidoctorBase0
|
9
9
|
class Deploy < ::Avm::EacWebappBase0::Deploy
|
10
10
|
def build_content
|
11
|
-
::Avm::
|
11
|
+
::Avm::EacAsciidoctorBase0::Build.new(
|
12
12
|
project,
|
13
|
-
::Avm::
|
13
|
+
::Avm::EacAsciidoctorBase0::Build::OPTION_TARGET_DIRECTORY => build_dir
|
14
14
|
).run
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def project_uncached
|
20
|
-
::Avm::
|
20
|
+
::Avm::EacAsciidoctorBase0::Project.new(
|
21
21
|
instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
|
22
22
|
)
|
23
23
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_rails_base1/runner_with/rails_environment'
|
4
|
+
require 'avm/eac_webapp_base0/runner'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRailsBase1
|
8
|
+
class Runner < ::Avm::EacWebappBase0::Runner
|
9
|
+
class Log
|
10
|
+
runner_with :help, ::Avm::EacRailsBase1::RunnerWith::RailsEnvironment do
|
11
|
+
desc 'Read application\'s log.'
|
12
|
+
bool_opt '-f', '--follow', 'Output appended data as the log grows.'
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
start_banner
|
17
|
+
tail_command.system
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def log_path
|
23
|
+
::File.join(rails_instance.read_entry('fs_path'), 'log', "#{rails_environment}.log")
|
24
|
+
end
|
25
|
+
|
26
|
+
def start_banner
|
27
|
+
infov 'Environment', rails_environment
|
28
|
+
infov 'Log path', log_path
|
29
|
+
end
|
30
|
+
|
31
|
+
def tail_command
|
32
|
+
rails_instance.host_env.command(*tail_command_args)
|
33
|
+
end
|
34
|
+
|
35
|
+
def tail_command_args
|
36
|
+
r = %w[tail]
|
37
|
+
r << '--follow' if parsed.follow?
|
38
|
+
r + [log_path]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,29 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/eac_rails_base1/instance'
|
4
|
+
require 'avm/eac_rails_base1/runner_with/rails_environment'
|
4
5
|
require 'eac_cli/runner'
|
5
6
|
|
6
7
|
module Avm
|
7
8
|
module EacRailsBase1
|
8
9
|
module RunnerWith
|
9
10
|
module Bundle
|
10
|
-
DEFAULT_RAILS_ENVIRONMENT_CONSTANT = 'DEFAULT_RAILS_ENVIRONMENT'
|
11
|
-
|
12
11
|
common_concern do
|
13
|
-
include ::
|
14
|
-
|
15
|
-
runner_definition do
|
16
|
-
arg_opt '-e', '--environment', 'Specifies the environment for the runner to operate' \
|
17
|
-
' (test/development/production). Default: "development".'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
module ClassMethods
|
22
|
-
def default_rails_environment
|
23
|
-
const_get(DEFAULT_RAILS_ENVIRONMENT_CONSTANT)
|
24
|
-
rescue ::NameError
|
25
|
-
::Avm::EacRailsBase1::Instance::DEFAULT_RAILS_ENVIRONMENT
|
26
|
-
end
|
12
|
+
include ::Avm::EacRailsBase1::RunnerWith::RailsEnvironment
|
27
13
|
end
|
28
14
|
|
29
15
|
def bundle_command
|
@@ -35,22 +21,6 @@ module Avm
|
|
35
21
|
infov 'Rails environment', rails_environment
|
36
22
|
bundle_command.system!
|
37
23
|
end
|
38
|
-
|
39
|
-
def default_rails_environment
|
40
|
-
self.class.default_rails_environment
|
41
|
-
end
|
42
|
-
|
43
|
-
def rails_instance
|
44
|
-
if respond_to?(:runner_context)
|
45
|
-
runner_context.call(:instance)
|
46
|
-
else
|
47
|
-
context(:instance)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def rails_environment
|
52
|
-
parsed.environment.presence || default_rails_environment
|
53
|
-
end
|
54
24
|
end
|
55
25
|
end
|
56
26
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/eac_rails_base1/instance'
|
4
|
+
require 'eac_cli/runner'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRailsBase1
|
8
|
+
module RunnerWith
|
9
|
+
module RailsEnvironment
|
10
|
+
DEFAULT_RAILS_ENVIRONMENT_CONSTANT = 'DEFAULT_RAILS_ENVIRONMENT'
|
11
|
+
|
12
|
+
common_concern do
|
13
|
+
include ::EacCli::Runner
|
14
|
+
|
15
|
+
runner_definition do
|
16
|
+
arg_opt '-e', '--environment', 'Specifies the environment for the runner to operate' \
|
17
|
+
' (test/development/production). Default: "development".'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module ClassMethods
|
22
|
+
def default_rails_environment
|
23
|
+
const_get(DEFAULT_RAILS_ENVIRONMENT_CONSTANT)
|
24
|
+
rescue ::NameError
|
25
|
+
::Avm::EacRailsBase1::Instance::DEFAULT_RAILS_ENVIRONMENT
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def default_rails_environment
|
30
|
+
self.class.default_rails_environment
|
31
|
+
end
|
32
|
+
|
33
|
+
def rails_environment
|
34
|
+
parsed.environment.presence || default_rails_environment
|
35
|
+
end
|
36
|
+
|
37
|
+
def rails_instance
|
38
|
+
if respond_to?(:runner_context)
|
39
|
+
runner_context.call(:instance)
|
40
|
+
else
|
41
|
+
context(:instance)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -17,10 +17,16 @@ module Avm
|
|
17
17
|
|
18
18
|
enable_console_speaker
|
19
19
|
enable_simple_cache
|
20
|
-
|
20
|
+
enable_listable
|
21
|
+
lists.add_symbol :option, :appended_directories, :no_request_test, :reference
|
22
|
+
common_constructor :instance, :options, default: [{}] do
|
23
|
+
self.options = ::Avm::EacWebappBase0::Deploy.lists.option
|
24
|
+
.hash_keys_validate!(options.symbolize_keys)
|
25
|
+
end
|
21
26
|
|
22
|
-
|
23
|
-
|
27
|
+
REQUEST_TEST_JOB = 'request_test'
|
28
|
+
JOBS = (%w[create_build_dir build_content append_instance_content write_on_target
|
29
|
+
setup_files_units assert_instance_branch] + [REQUEST_TEST_JOB]).freeze
|
24
30
|
define_callbacks(*JOBS)
|
25
31
|
|
26
32
|
def run
|
@@ -67,8 +73,14 @@ module Avm
|
|
67
73
|
|
68
74
|
private
|
69
75
|
|
76
|
+
def jobs
|
77
|
+
r = JOBS.dup
|
78
|
+
r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
|
79
|
+
r
|
80
|
+
end
|
81
|
+
|
70
82
|
def run_jobs
|
71
|
-
|
83
|
+
jobs.each do |job|
|
72
84
|
run_callbacks job do
|
73
85
|
send(job)
|
74
86
|
end
|
@@ -2,34 +2,25 @@
|
|
2
2
|
|
3
3
|
require 'avm/instances/runner'
|
4
4
|
require 'avm/path_string'
|
5
|
-
require '
|
6
|
-
require 'eac_ruby_utils/console/speaker'
|
5
|
+
require 'eac_cli/core_ext'
|
7
6
|
|
8
7
|
module Avm
|
9
8
|
module EacWebappBase0
|
10
9
|
class Runner < ::Avm::Instances::Runner
|
11
|
-
class Deploy
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
__PROGRAM__ [options]
|
19
|
-
__PROGRAM__ -h | --help
|
20
|
-
|
21
|
-
Options:
|
22
|
-
-h --help Show this screen.
|
23
|
-
-r --reference=<git-reference> Git reference to deploy.
|
24
|
-
-a --append-dirs=<append-dirs> Append directories to deploy (List separated by ":").
|
25
|
-
DOCOPT
|
10
|
+
class Deploy
|
11
|
+
runner_with :help do
|
12
|
+
desc 'Deploy for instance.'
|
13
|
+
arg_opt '-r', '--reference', 'Git reference to deploy.'
|
14
|
+
arg_opt '-a', '--append-dirs', 'Append directories to deploy (List separated by ":").'
|
15
|
+
bool_opt '-T', '--no-request-test', 'Do not test web interface after deploy.'
|
16
|
+
end
|
26
17
|
|
27
18
|
def deploy_class
|
28
|
-
|
19
|
+
runner_context.call(:stereotype_module).const_get('Deploy')
|
29
20
|
end
|
30
21
|
|
31
22
|
def run
|
32
|
-
result = deploy_class.new(
|
23
|
+
result = deploy_class.new(runner_context.call(:instance), deploy_options).run
|
33
24
|
if result.error?
|
34
25
|
fatal_error result.to_s
|
35
26
|
else
|
@@ -38,8 +29,9 @@ module Avm
|
|
38
29
|
end
|
39
30
|
|
40
31
|
def deploy_options
|
41
|
-
{ reference:
|
42
|
-
appended_directories: ::Avm::PathString.paths(
|
32
|
+
{ reference: parsed.reference,
|
33
|
+
appended_directories: ::Avm::PathString.paths(parsed.append_dirs),
|
34
|
+
no_request_test: parsed.no_request_test? }
|
43
35
|
end
|
44
36
|
end
|
45
37
|
end
|
data/lib/avm/executables.rb
CHANGED
@@ -14,7 +14,7 @@ module Avm
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
%w[
|
17
|
+
%w[docker file git latex php-cs-fixer tidy yapf xdg-open].each do |program|
|
18
18
|
define_method(program.underscore + '_uncached') do
|
19
19
|
env.executable(program, '--version')
|
20
20
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module AutoCommit
|
8
|
+
class CommitInfo
|
9
|
+
enable_immutable
|
10
|
+
|
11
|
+
immutable_accessor :fixup
|
12
|
+
|
13
|
+
def git_commit_args
|
14
|
+
r = fixup.if_present([]) { |v| ['--fixup', v.sha1] }
|
15
|
+
return r if r.any?
|
16
|
+
|
17
|
+
raise 'Argument list is empty'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module AutoCommit
|
8
|
+
module Rules
|
9
|
+
require_sub __FILE__
|
10
|
+
|
11
|
+
RULES_CLASSES = %w[last manual nth unique]
|
12
|
+
.map { |key| ::Avm::Git::AutoCommit::Rules.const_get(key.camelcase) }
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def parse(string)
|
16
|
+
parts = string.split(':')
|
17
|
+
|
18
|
+
klass = rule_class_by_key(parts.shift)
|
19
|
+
klass.new(*parts)
|
20
|
+
end
|
21
|
+
|
22
|
+
def rule_class_by_key(key)
|
23
|
+
RULES_CLASSES.find { |klass| klass.keys.include?(key) } ||
|
24
|
+
raise("Rule not find with key \"#{key}\" (Available: " +
|
25
|
+
RULES_CLASSES.flat_map(&:keys) + ')')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|