avm-tools 0.89.0 → 0.94.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_asciidoctor_base0.rb +9 -0
- data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/apache_host.rb +1 -1
- data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
- 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_base0/apache_path.rb +6 -38
- data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
- data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
- data/lib/avm/eac_webapp_base0/deploy.rb +12 -30
- data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
- data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
- data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
- data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
- data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
- data/lib/avm/executables.rb +1 -1
- data/lib/avm/git/auto_commit/commit_info.rb +23 -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/new.rb +24 -0
- data/lib/avm/git/auto_commit/rules/nth.rb +31 -0
- data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
- data/lib/avm/git/auto_commit_path.rb +0 -21
- data/lib/avm/git/file_auto_fixup.rb +20 -61
- data/lib/avm/tools/runner/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
- data/lib/avm/tools/runner/git/auto_commit.rb +30 -31
- data/lib/avm/tools/runner/git/commit.rb +11 -20
- 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/runner/local_project/ruby.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby/bundler.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +1 -1
- data/lib/avm/tools/runner/ruby.rb +6 -14
- data/lib/avm/tools/runner/ruby/gems.rb +4 -7
- data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
- data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
- data/lib/avm/tools/version.rb +1 -1
- data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
- data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
- data/vendor/avm-apps/Gemfile +5 -0
- data/vendor/avm-apps/avm-apps.gemspec +18 -0
- data/{lib/avm/eac_writings_base1.rb → vendor/avm-apps/lib/avm/apps.rb} +1 -1
- data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
- data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
- data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
- data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
- data/vendor/avm-apps/spec/spec_helper.rb +100 -0
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
- data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
- data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
- 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/docopt/doc_builder.rb +15 -1
- 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/definition/alternative_spec.rb +4 -0
- 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 +55 -16
- data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
- data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
- data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -6
@@ -1,24 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'eac_ruby_utils/require_sub'
|
3
|
+
require 'eac_cli/core_ext'
|
5
4
|
|
6
5
|
module Avm
|
7
6
|
module EacWebappBase0
|
8
7
|
class Runner < ::Avm::Instances::Runner
|
9
|
-
class Data
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Usage:
|
16
|
-
__PROGRAM__ __SUBCOMMANDS__
|
17
|
-
__PROGRAM__ -h | --help
|
18
|
-
|
19
|
-
Options:
|
20
|
-
-h --help Show this screen.
|
21
|
-
DOCOPT
|
8
|
+
class Data
|
9
|
+
require_sub __FILE__
|
10
|
+
runner_with :help, :subcommands do
|
11
|
+
desc 'Data utilities for EacRailsBase0 instances.'
|
12
|
+
end
|
22
13
|
end
|
23
14
|
end
|
24
15
|
end
|
@@ -1,37 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'active_support/core_ext/numeric/time'
|
4
|
-
require 'eac_ruby_utils/console/speaker'
|
5
|
-
require 'eac_ruby_utils/simple_cache'
|
6
3
|
require 'avm/data/package/dump'
|
4
|
+
require 'eac_cli/core_ext'
|
7
5
|
|
8
6
|
module Avm
|
9
7
|
module EacWebappBase0
|
10
8
|
class Runner < ::Avm::Instances::Runner
|
11
|
-
class Data
|
12
|
-
class Dump
|
13
|
-
include ::EacRubyUtils::SimpleCache
|
14
|
-
include ::EacRubyUtils::Console::Speaker
|
15
|
-
|
9
|
+
class Data
|
10
|
+
class Dump
|
16
11
|
DUMP_EXPIRE_TIME = 1.day
|
17
12
|
DEFAULT_DUMP_PATH_ENTRY_SUFFIX = 'data.default_dump_path'
|
18
13
|
NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
|
19
14
|
'dump was expired.'
|
20
15
|
|
21
|
-
|
22
|
-
Dump utility for EacRailsBase instance.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Options:
|
28
|
-
-h --help Show this screen.
|
29
|
-
--rewrite Forces dump overwrite.
|
30
|
-
--dump-path=<dump_path> Set DUMP_PATH variable.
|
31
|
-
DOCUMENT
|
16
|
+
runner_with :help do
|
17
|
+
desc 'Dump utility for EacRailsBase instance.'
|
18
|
+
bool_opt '-w', 'rewrite', 'Forces dump overwrite.'
|
19
|
+
arg_opt '-p', '--dump-path', 'Set DUMP_PATH variable.'
|
20
|
+
end
|
32
21
|
|
33
22
|
def run
|
34
|
-
infov 'Instance to dump', "#{
|
23
|
+
infov 'Instance to dump', "#{instance} (#{instance.class})"
|
35
24
|
if package_dump.runnable?
|
36
25
|
package_dump.run
|
37
26
|
else
|
@@ -43,20 +32,25 @@ module Avm
|
|
43
32
|
|
44
33
|
private
|
45
34
|
|
35
|
+
def instance
|
36
|
+
runner_context.call(:instance)
|
37
|
+
end
|
38
|
+
|
46
39
|
def package_dump_uncached
|
47
|
-
|
40
|
+
instance
|
41
|
+
.data_package.dump(dump_path, existing: package_dump_existing)
|
48
42
|
end
|
49
43
|
|
50
44
|
def dump_path
|
51
|
-
|
45
|
+
parsed.dump_path || default_dump_path
|
52
46
|
end
|
53
47
|
|
54
48
|
def default_dump_path
|
55
|
-
|
49
|
+
instance.read_entry(DEFAULT_DUMP_PATH_ENTRY_SUFFIX)
|
56
50
|
end
|
57
51
|
|
58
52
|
def package_dump_existing
|
59
|
-
if
|
53
|
+
if parsed.rewrite?
|
60
54
|
::Avm::Data::Package::Dump::EXISTING_ROTATE
|
61
55
|
else
|
62
56
|
::Avm::Data::Package::Dump::EXISTING_ROTATE_EXPIRED
|
@@ -7,22 +7,13 @@ require 'eac_ruby_utils/simple_cache'
|
|
7
7
|
module Avm
|
8
8
|
module EacWebappBase0
|
9
9
|
class Runner < ::Avm::Instances::Runner
|
10
|
-
class Data
|
11
|
-
class Load
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
Usage:
|
19
|
-
__PROGRAM__ (<dump-path>|--source-instance=<source-instance>)
|
20
|
-
__PROGRAM__ -h | --help
|
21
|
-
|
22
|
-
Options:
|
23
|
-
-h --help Show this screen.
|
24
|
-
-S --source-instance=<source-instance> Informa a instância a ser extraída o dump.
|
25
|
-
DOCUMENT
|
10
|
+
class Data
|
11
|
+
class Load
|
12
|
+
runner_with :ĥelp do
|
13
|
+
desc 'Load utility for EacRailsBase instance.'
|
14
|
+
arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
|
15
|
+
pos_arg :dump_path, optional: true
|
16
|
+
end
|
26
17
|
|
27
18
|
def run
|
28
19
|
return ::Dev::Result.error("Dump \"#{dump_path}\" does not exist") unless
|
@@ -33,16 +24,14 @@ module Avm
|
|
33
24
|
end
|
34
25
|
|
35
26
|
def dump_path_uncached
|
36
|
-
return
|
37
|
-
return source_instance_dump_path if
|
27
|
+
return parsed.dump_path.to_s if parsed.dump_path.present?
|
28
|
+
return source_instance_dump_path if parsed.source_instance.present?
|
38
29
|
|
39
|
-
raise "Dump path unknown (Options: #{
|
30
|
+
raise "Dump path unknown (Options: #{parsed})"
|
40
31
|
end
|
41
32
|
|
42
33
|
def source_instance_dump_path
|
43
|
-
|
44
|
-
options.fetch('--source-instance')
|
45
|
-
).data_dump
|
34
|
+
runner_context.call(:instance).class.by_id(parsed.source_instance).data_dump
|
46
35
|
end
|
47
36
|
|
48
37
|
def load_dump
|
@@ -57,7 +46,7 @@ module Avm
|
|
57
46
|
private
|
58
47
|
|
59
48
|
def package_load_uncached
|
60
|
-
|
49
|
+
runner_context.call(:instance).data_package.load(dump_path)
|
61
50
|
end
|
62
51
|
end
|
63
52
|
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,23 @@
|
|
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, :message
|
12
|
+
|
13
|
+
def git_commit_args
|
14
|
+
r = fixup.if_present([]) { |v| ['--fixup', v.sha1] }
|
15
|
+
r += message.if_present([]) { |v| ['--message', v] }
|
16
|
+
return r if r.any?
|
17
|
+
|
18
|
+
raise 'Argument list is empty'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
::EacRubyUtils.require_sub __FILE__
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module Git
|
9
|
+
module AutoCommit
|
10
|
+
module Rules
|
11
|
+
RULES_CLASSES = %w[last manual new 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).join(', ') + ')')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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
|
+
class Base
|
10
|
+
class << self
|
11
|
+
def keys
|
12
|
+
[long_key, short_key]
|
13
|
+
end
|
14
|
+
|
15
|
+
def long_key
|
16
|
+
name.demodulize.variableize
|
17
|
+
end
|
18
|
+
|
19
|
+
def short_key
|
20
|
+
long_key[0, 1]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def with_file(file)
|
25
|
+
self.class.const_get('WithFile').new(self, file)
|
26
|
+
end
|
27
|
+
|
28
|
+
class WithFile
|
29
|
+
common_constructor :rule, :file
|
30
|
+
|
31
|
+
def new_commit_info
|
32
|
+
::Avm::Git::AutoCommit::CommitInfo.new
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/auto_commit/rules/base'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module AutoCommit
|
8
|
+
module Rules
|
9
|
+
class Last < ::Avm::Git::AutoCommit::Rules::Base
|
10
|
+
class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
|
11
|
+
def commit_info
|
12
|
+
file.commits.last.if_present { |v| new_commit_info.fixup(v) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/auto_commit/rules/base'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module AutoCommit
|
8
|
+
module Rules
|
9
|
+
class Manual < ::Avm::Git::AutoCommit::Rules::Base
|
10
|
+
class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
|
11
|
+
enable_console_speaker
|
12
|
+
|
13
|
+
COMMIT_FORMAT = '%h - %s (%cr)'
|
14
|
+
SKIP_OPTION = 's'
|
15
|
+
|
16
|
+
def commit_info
|
17
|
+
return nil unless file.commits.any?
|
18
|
+
|
19
|
+
commits_banner
|
20
|
+
request_input('Which commit?', list: commits_by_position).if_present do |v|
|
21
|
+
new_commit_info.fixup(v)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def commits_banner
|
26
|
+
file.commits.each_with_index do |commit, _index|
|
27
|
+
infov " #{commit.position}", format_commit(commit)
|
28
|
+
end
|
29
|
+
infov " #{SKIP_OPTION}", 'skip'
|
30
|
+
end
|
31
|
+
|
32
|
+
def commits_by_position
|
33
|
+
(file.commits.map { |commit| [commit.position.to_s, commit] } + [[SKIP_OPTION, nil]])
|
34
|
+
.to_h
|
35
|
+
end
|
36
|
+
|
37
|
+
def format_commit(commit)
|
38
|
+
commit.format(COMMIT_FORMAT)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/auto_commit/rules/base'
|
4
|
+
require 'avm/git/auto_commit_path'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Git
|
8
|
+
module AutoCommit
|
9
|
+
module Rules
|
10
|
+
class New < ::Avm::Git::AutoCommit::Rules::Base
|
11
|
+
class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
|
12
|
+
def auto_commit_path
|
13
|
+
::Avm::Git::AutoCommitPath.new(file.git, file.path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def commit_info
|
17
|
+
new_commit_info.message(auto_commit_path.commit_message)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/auto_commit/rules/base'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module AutoCommit
|
8
|
+
module Rules
|
9
|
+
class Nth < ::Avm::Git::AutoCommit::Rules::Base
|
10
|
+
SHORT_KEY = 't'
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def short_key
|
14
|
+
SHORT_KEY
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
common_constructor :number do
|
19
|
+
self.number = number.to_i
|
20
|
+
end
|
21
|
+
|
22
|
+
class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
|
23
|
+
def commit_info
|
24
|
+
file.commits(number - 1).if_present { |v| new_commit_info.fixup(v) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/git/auto_commit/rules/base'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Git
|
7
|
+
module AutoCommit
|
8
|
+
module Rules
|
9
|
+
class Unique < ::Avm::Git::AutoCommit::Rules::Base
|
10
|
+
class WithFile < ::Avm::Git::AutoCommit::Rules::Base::WithFile
|
11
|
+
def commit_info
|
12
|
+
return nil unless file.commits.count == 1
|
13
|
+
|
14
|
+
new_commit_info.fixup(file.commits.first)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,31 +6,10 @@ module Avm
|
|
6
6
|
module Git
|
7
7
|
class AutoCommitPath
|
8
8
|
require_sub __FILE__, include_modules: true
|
9
|
-
enable_console_speaker
|
10
9
|
common_constructor :git, :path do
|
11
10
|
self.path = path.to_pathname
|
12
11
|
end
|
13
12
|
|
14
|
-
CLASS_NAME_PATTERNS = [%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
|
15
|
-
|
16
|
-
def run
|
17
|
-
banner
|
18
|
-
commit
|
19
|
-
end
|
20
|
-
|
21
|
-
def banner
|
22
|
-
infom "Checking \"#{relative_path}\""
|
23
|
-
infov ' * Class name', class_name
|
24
|
-
infov ' * Commit message', commit_message
|
25
|
-
end
|
26
|
-
|
27
|
-
def commit
|
28
|
-
infom ' * Commiting...'
|
29
|
-
git.system!('reset', 'HEAD')
|
30
|
-
git.system!('add', '--', relative_path.to_path)
|
31
|
-
git.system!('commit', '-m', commit_message, '--', relative_path.to_path)
|
32
|
-
end
|
33
|
-
|
34
13
|
def class_name
|
35
14
|
ruby_class_name || relative_path.to_path
|
36
15
|
end
|