avm-tools 0.91.0 → 0.94.2
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/apache_path.rb +10 -0
- 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/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 +26 -57
- 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/git/subrepo/fix.rb +1 -1
- data/lib/avm/tools/runner/local_project/ruby.rb +3 -7
- data/lib/avm/tools/runner/local_project/ruby/bundler.rb +4 -8
- data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +11 -14
- 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/vendor/avm-apps/lib/avm/apps.rb +9 -0
- 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/core_ext.rb +2 -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/alternative/short_options.rb +4 -2
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
- 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_git/lib/eac_git/local/dirty_files.rb +2 -3
- data/vendor/eac_git/lib/eac_git/version.rb +1 -1
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
- data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +40 -5
- 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
@@ -13,6 +13,18 @@ module EacCli
|
|
13
13
|
options.assert_valid_keys(self.class.lists.option.values)
|
14
14
|
end
|
15
15
|
|
16
|
+
def build_value(new_value, previous_value)
|
17
|
+
if previous_value.is_a?(::Array)
|
18
|
+
previous_value + [new_value]
|
19
|
+
else
|
20
|
+
new_value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_value
|
25
|
+
repeat? ? [] : nil
|
26
|
+
end
|
27
|
+
|
16
28
|
def identifier
|
17
29
|
name.to_s.variableize.to_sym
|
18
30
|
end
|
@@ -19,10 +19,24 @@ module EacCli
|
|
19
19
|
b += '=<value>' if option.argument?
|
20
20
|
b
|
21
21
|
end
|
22
|
+
|
23
|
+
def option_short(option)
|
24
|
+
b = option.short
|
25
|
+
b += '=<value>' if option.argument?
|
26
|
+
b
|
27
|
+
end
|
28
|
+
|
29
|
+
def option_usage_full(option)
|
30
|
+
if option.long.present?
|
31
|
+
[option.short, option_long(option)].reject(&:blank?).join(SEP)
|
32
|
+
else
|
33
|
+
option_short(option)
|
34
|
+
end
|
35
|
+
end
|
22
36
|
end
|
23
37
|
|
24
38
|
def option_definition(option)
|
25
|
-
|
39
|
+
self.class.option_usage_full(option) + OPTION_DESC_SEP + option.description
|
26
40
|
end
|
27
41
|
|
28
42
|
def section(header, include_header = true)
|
@@ -14,7 +14,9 @@ module EacCli
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def find_short_option(char)
|
17
|
-
alternative.options.find
|
17
|
+
alternative.options.find do |option|
|
18
|
+
short_without_prefix(option.short).if_present(false) { |v| v == char }
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
def short_option_collect_argv_value
|
@@ -37,7 +39,7 @@ module EacCli
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def short_without_prefix(short)
|
40
|
-
short.gsub(/\A#{::Regexp.quote(SHORT_OPTION_PREFIX)}/, '')
|
42
|
+
short.to_s.gsub(/\A#{::Regexp.quote(SHORT_OPTION_PREFIX)}/, '')
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -24,11 +24,7 @@ module EacCli
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def collect(option, value)
|
27
|
-
|
28
|
-
data[option] << value
|
29
|
-
else
|
30
|
-
data[option] = value
|
31
|
-
end
|
27
|
+
data[option] = option.build_value(value, data[option])
|
32
28
|
end
|
33
29
|
|
34
30
|
def supplied?(option)
|
@@ -42,18 +38,8 @@ module EacCli
|
|
42
38
|
end
|
43
39
|
|
44
40
|
def default_values
|
45
|
-
definition.options.each { |option| data[option] =
|
46
|
-
definition.positional.each
|
47
|
-
data[positional] = positional_default_value(positional)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def option_default_value(option)
|
52
|
-
option.argument? ? nil : false
|
53
|
-
end
|
54
|
-
|
55
|
-
def positional_default_value(positional)
|
56
|
-
positional.repeat? ? [] : nil
|
41
|
+
definition.options.each { |option| data[option] = option.default_value }
|
42
|
+
definition.positional.each { |positional| data[positional] = positional.default_value }
|
57
43
|
end
|
58
44
|
end
|
59
45
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
4
|
require 'eac_cli/runner'
|
5
5
|
require 'eac_cli/runner_with'
|
6
|
+
require 'eac_cli/runner_with_set'
|
6
7
|
|
7
8
|
class Object
|
8
9
|
def runner_with(*runners, &block)
|
@@ -10,7 +11,7 @@ class Object
|
|
10
11
|
enable_simple_cache
|
11
12
|
enable_console_speaker
|
12
13
|
runners.each do |runner|
|
13
|
-
include
|
14
|
+
include ::EacCli::RunnerWithSet.default.item_to_module(runner)
|
14
15
|
end
|
15
16
|
runner_definition(&block) if block
|
16
17
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacCli
|
4
|
+
class RunnerWithSet
|
5
|
+
class << self
|
6
|
+
def default
|
7
|
+
@default ||= new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_namespace(namespace)
|
12
|
+
namespace = sanitize_namespace(namespace)
|
13
|
+
raise "\"#{namespace}\" already was included" if namespace_set.include?(namespace)
|
14
|
+
|
15
|
+
namespace_set << namespace
|
16
|
+
self
|
17
|
+
end
|
18
|
+
|
19
|
+
def item_to_module(item)
|
20
|
+
item.is_a?(::Module) ? item : key_to_module(item)
|
21
|
+
end
|
22
|
+
|
23
|
+
def namespaces
|
24
|
+
namespace_set.dup
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def namespace_set
|
30
|
+
@namespace_set ||= ::Array.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def key_to_module(key)
|
34
|
+
namespace_set.lazy
|
35
|
+
.map { |namespace| key_to_module_in_namespace(namespace, key) }
|
36
|
+
.find(&:present?) ||
|
37
|
+
raise("Not module found with key \"#{key}\" (Namespaces: #{namespace_set})")
|
38
|
+
end
|
39
|
+
|
40
|
+
def key_to_module_in_namespace(namespace, key)
|
41
|
+
namespace.const_get(key.to_s.camelize)
|
42
|
+
rescue ::NameError
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def sanitize_namespace(source)
|
47
|
+
source.is_a?(::Module) ? source : source.to_s.constantize
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -7,6 +7,10 @@ RSpec.describe ::EacCli::Definition::Alternative do
|
|
7
7
|
|
8
8
|
it { expect { instance.arg_opt '-a', '--opt2', 'A argument option' }.not_to raise_error }
|
9
9
|
it { expect { instance.bool_opt '-b', '--opt1', 'A boolean option' }.not_to raise_error }
|
10
|
+
it { expect { instance.bool_opt '-b', '--no-description' }.not_to raise_error }
|
11
|
+
it { expect { instance.bool_opt '--opt1', 'A option without short' }.not_to raise_error }
|
12
|
+
it { expect { instance.bool_opt '-b', 'A option without long' }.not_to raise_error }
|
13
|
+
it { expect { instance.bool_opt 'A option without selectors' }.to raise_error(::StandardError) }
|
10
14
|
it { expect { instance.options_argument(true) }.not_to raise_error }
|
11
15
|
it { expect { instance.pos_arg :pos1 }.not_to raise_error }
|
12
16
|
it { expect { instance.pos_arg :pos2, optional: true, repeat: true }.not_to raise_error }
|
@@ -12,6 +12,8 @@ RSpec.describe ::EacCli::Runner do
|
|
12
12
|
runner_definition do
|
13
13
|
arg_opt '-o', '--opt1', 'A arg option.'
|
14
14
|
bool_opt '-p', '--opt2', 'A boolean option'
|
15
|
+
arg_opt '-q', '--opt4', 'A repeatable argument option.', repeat: true
|
16
|
+
bool_opt '-r', '--opt5', 'A repeatable boolean option', repeat: true
|
15
17
|
pos_arg :pos1
|
16
18
|
pos_arg :pos2, repeat: true, optional: true
|
17
19
|
alt do
|
@@ -29,7 +31,7 @@ RSpec.describe ::EacCli::Runner do
|
|
29
31
|
context 'when all args are supplied' do
|
30
32
|
let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd] }
|
31
33
|
let(:parsed_expected) do
|
32
|
-
{ opt1: 'aaa', opt2: true, opt3: false, pos1: 'bbb',
|
34
|
+
{ opt1: 'aaa', opt2: true, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
33
35
|
pos2: %w[ccc ddd] }
|
34
36
|
end
|
35
37
|
|
@@ -63,7 +65,10 @@ RSpec.describe ::EacCli::Runner do
|
|
63
65
|
|
64
66
|
context 'when only required args are supplied' do
|
65
67
|
let(:argv) { %w[bbb] }
|
66
|
-
let(:parsed_expected)
|
68
|
+
let(:parsed_expected) do
|
69
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
|
70
|
+
pos2: [] }
|
71
|
+
end
|
67
72
|
|
68
73
|
it { expect(parsed_actual).to eq(parsed_expected) }
|
69
74
|
it { expect(instance.parsed.opt1).to be_nil }
|
@@ -82,12 +87,25 @@ RSpec.describe ::EacCli::Runner do
|
|
82
87
|
|
83
88
|
context 'when alternative args are supplied' do
|
84
89
|
let(:argv) { %w[--opt3] }
|
85
|
-
let(:parsed_expected)
|
90
|
+
let(:parsed_expected) do
|
91
|
+
{ opt1: nil, opt2: false, opt3: true, opt4: [], opt5: 0, pos1: nil,
|
92
|
+
pos2: [] }
|
93
|
+
end
|
86
94
|
|
87
95
|
it { expect(parsed_actual).to eq(parsed_expected) }
|
88
96
|
it { expect(instance.parsed.opt3?).to eq(true) }
|
89
97
|
end
|
90
98
|
|
99
|
+
context 'when repeated options are supplied' do
|
100
|
+
let(:argv) { %w[--opt5 -rrr --opt4=A -q B --opt4 C AAA] }
|
101
|
+
let(:parsed_expected) do
|
102
|
+
{ opt1: nil, opt2: false, opt3: false, opt4: %w[A B C], opt5: 4, pos1: 'AAA',
|
103
|
+
pos2: [] }
|
104
|
+
end
|
105
|
+
|
106
|
+
it { expect(parsed_actual).to eq(parsed_expected) }
|
107
|
+
end
|
108
|
+
|
91
109
|
context 'when extra args are not supplied' do
|
92
110
|
let(:runner_class) do
|
93
111
|
the_module = described_class
|
@@ -20,9 +20,8 @@ module EacGit
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def dirty_files
|
23
|
-
command('status', '--porcelain', '--untracked-files')
|
24
|
-
parse_status_line(line.gsub(/\n\z/, ''))
|
25
|
-
end
|
23
|
+
command('status', '--porcelain=v1', '--untracked-files', '--no-renames')
|
24
|
+
.execute!.each_line.map { |line| parse_status_line(line.gsub(/\n\z/, '')) }
|
26
25
|
end
|
27
26
|
|
28
27
|
private
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/console/speaker'
|
4
|
+
require 'eac_ruby_utils/settings_provider'
|
5
|
+
|
6
|
+
module EacRubyBase0
|
7
|
+
module JobsRunner
|
8
|
+
common_concern do
|
9
|
+
include ::EacRubyUtils::Console::Speaker
|
10
|
+
include ::EacRubyUtils::SettingsProvider
|
11
|
+
end
|
12
|
+
|
13
|
+
def run_job(job)
|
14
|
+
return unless run_job?(job)
|
15
|
+
|
16
|
+
infom "Running job \"#{job}\"..."
|
17
|
+
send(job)
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_job?(job)
|
21
|
+
the_method = "run_#{job}?"
|
22
|
+
respond_to?(the_method, true) ? send(the_method) : true
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_jobs(*jobs)
|
26
|
+
jobs = setting_value(:jobs) if jobs.empty?
|
27
|
+
jobs.each { |job| run_job(job) }
|
28
|
+
success 'Done'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/fs/traversable'
|
6
|
+
|
7
|
+
module EacRubyBase0
|
8
|
+
module RunnerWith
|
9
|
+
module Confirmation
|
10
|
+
DEFAULT_CONFIRM_QUESTION_TEXT = 'Confirm?'
|
11
|
+
|
12
|
+
common_concern do
|
13
|
+
include ::EacCli::Runner
|
14
|
+
enable_settings_provider
|
15
|
+
runner_definition do
|
16
|
+
bool_opt '--no', 'Deny confirmation without question.'
|
17
|
+
bool_opt '--yes', 'Accept confirmation without question.'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def confirm?(message = nil)
|
22
|
+
return false if parsed.no?
|
23
|
+
return true if parsed.yes?
|
24
|
+
|
25
|
+
request_input(
|
26
|
+
message || setting_value(:confirm_question_text, default: DEFAULT_CONFIRM_QUESTION_TEXT),
|
27
|
+
bool: true
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def run_confirm(message = nil)
|
32
|
+
yield if confirm?(message)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/fs/traversable'
|
6
|
+
require 'eac_ruby_utils/settings_provider'
|
7
|
+
|
8
|
+
module EacRubyBase0
|
9
|
+
module RunnerWith
|
10
|
+
module FilesystemTraverser
|
11
|
+
DEFAULT_DEFAULT_TRAVERSER_RECURSIVE = false
|
12
|
+
|
13
|
+
common_concern do
|
14
|
+
include ::EacCli::Runner
|
15
|
+
include ::EacRubyUtils::Fs::Traversable
|
16
|
+
enable_settings_provider
|
17
|
+
include TopMethods
|
18
|
+
runner_definition do
|
19
|
+
bool_opt '-R', '--recursive', 'Recursive.'
|
20
|
+
bool_opt '--no-recursive', 'No recursive.'
|
21
|
+
pos_arg :paths, optional: true, repeat: true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module TopMethods
|
26
|
+
def on_none_path_informed
|
27
|
+
infom 'Warning: none path informed'
|
28
|
+
end
|
29
|
+
|
30
|
+
def paths
|
31
|
+
parsed.paths.map(&:to_pathname)
|
32
|
+
end
|
33
|
+
|
34
|
+
def run_filesystem_traverser
|
35
|
+
if parsed.paths.any?
|
36
|
+
parsed.paths.each { |path| traverser_check_path(path) }
|
37
|
+
else
|
38
|
+
on_none_path_informed
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def traverser_recursive
|
43
|
+
return false if parsed.no_recursive?
|
44
|
+
return true if parsed.recursive?
|
45
|
+
|
46
|
+
setting_value(:default_traverser_recursive, required: false)
|
47
|
+
.if_not_nil(DEFAULT_DEFAULT_TRAVERSER_RECURSIVE)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|