eac_tools 0.62.1 → 0.63.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -19
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/avm.gemspec +2 -2
- data/sub/avm/lib/avm/data/package.rb +11 -0
- data/sub/avm/lib/avm/instances/data/files_unit.rb +2 -2
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm-eac_postgresql_base0/Gemfile +3 -0
- data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +3 -3
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/data_unit.rb +12 -12
- data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
- data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +3 -3
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit/clear.rb +23 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit/dump.rb +25 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit/load.rb +25 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit.rb +41 -0
- data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
- data/sub/eac_cli/eac_cli.gemspec +1 -1
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +38 -21
- data/sub/eac_cli/lib/eac_cli/runner_with/help/list_section.rb +22 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +3 -4
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +5 -2
- data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/list_section_spec.rb +21 -0
- data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb +14 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb +2 -11
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e107f6aa74ee0e1e360adc2984d3c2a68aea45023eb92fd0c2612b3f99231fcd
|
4
|
+
data.tar.gz: 4ec44416302a162992af3a0410033895e2a3179847d285cdf295b4c1e303af10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a89a40d5ceefd62730be561a0bf3305bfacdcdf71ad65c77fbb9e2d04f6e31592e12a54efc2dfcac24f0a39bdd0fdeda2d8a94200c0fd9b8141f45a47b2b3469
|
7
|
+
data.tar.gz: 8e2546581a3d82e9d3d984894e35cc40941364e338c39433e9bfd9cb169222b9f3277042523293ea04e4aa87401d8b4b32f039552c03a101e29e33f61c0f6f0e
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.
|
5
|
-
avm (~> 0.
|
4
|
+
eac_tools (0.63.0)
|
5
|
+
avm (~> 0.69)
|
6
6
|
avm-eac_asciidoctor_base0 (~> 0.19)
|
7
7
|
avm-eac_generic_base0 (~> 0.12)
|
8
8
|
avm-eac_latex_base0 (~> 0.3, >= 0.3.1)
|
9
9
|
avm-eac_php_base0 (~> 0.4, >= 0.4.2)
|
10
|
-
avm-eac_postgresql_base0 (~> 0.
|
10
|
+
avm-eac_postgresql_base0 (~> 0.4)
|
11
11
|
avm-eac_python_base0 (~> 0.2, >= 0.2.1)
|
12
12
|
avm-eac_rails_base0 (~> 0.10, >= 0.10.2)
|
13
13
|
avm-eac_rails_base1 (~> 0.8, >= 0.8.4)
|
14
14
|
avm-eac_redmine_base0 (~> 0.20, >= 0.20.1)
|
15
15
|
avm-eac_redmine_plugin_base0 (~> 0.4)
|
16
16
|
avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
|
17
|
-
avm-eac_webapp_base0 (~> 0.
|
17
|
+
avm-eac_webapp_base0 (~> 0.16)
|
18
18
|
avm-eac_wordpress_base0 (~> 0.3, >= 0.3.1)
|
19
19
|
avm-git (~> 0.13, >= 0.13.2)
|
20
20
|
avm-tools (~> 0.145, >= 0.145.1)
|
21
|
-
eac_ruby_utils (~> 0.
|
21
|
+
eac_ruby_utils (~> 0.113)
|
22
22
|
|
23
23
|
PATH
|
24
24
|
remote: sub/aranha-parsers
|
@@ -67,9 +67,9 @@ PATH
|
|
67
67
|
PATH
|
68
68
|
remote: sub/avm-eac_postgresql_base0
|
69
69
|
specs:
|
70
|
-
avm-eac_postgresql_base0 (0.
|
71
|
-
avm (~> 0.
|
72
|
-
eac_ruby_utils (~> 0.
|
70
|
+
avm-eac_postgresql_base0 (0.4.0)
|
71
|
+
avm (~> 0.69)
|
72
|
+
eac_ruby_utils (~> 0.113)
|
73
73
|
|
74
74
|
PATH
|
75
75
|
remote: sub/avm-eac_python_base0
|
@@ -134,13 +134,13 @@ PATH
|
|
134
134
|
PATH
|
135
135
|
remote: sub/avm-eac_webapp_base0
|
136
136
|
specs:
|
137
|
-
avm-eac_webapp_base0 (0.
|
138
|
-
avm (~> 0.
|
137
|
+
avm-eac_webapp_base0 (0.16.0)
|
138
|
+
avm (~> 0.69)
|
139
139
|
avm-eac_generic_base0 (~> 0.12)
|
140
|
-
avm-eac_postgresql_base0 (~> 0.
|
140
|
+
avm-eac_postgresql_base0 (~> 0.4)
|
141
141
|
avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.2)
|
142
142
|
avm-files (~> 0.6, >= 0.6.2)
|
143
|
-
eac_ruby_utils (~> 0.
|
143
|
+
eac_ruby_utils (~> 0.113)
|
144
144
|
|
145
145
|
PATH
|
146
146
|
remote: sub/avm-eac_wordpress_base0
|
@@ -191,14 +191,14 @@ PATH
|
|
191
191
|
PATH
|
192
192
|
remote: sub/avm
|
193
193
|
specs:
|
194
|
-
avm (0.
|
194
|
+
avm (0.69.0)
|
195
195
|
aranha-parsers (~> 0.17, >= 0.17.1)
|
196
|
-
eac_cli (~> 0.
|
196
|
+
eac_cli (~> 0.32)
|
197
197
|
eac_config (~> 0.12)
|
198
198
|
eac_docker (~> 0.7)
|
199
199
|
eac_fs (~> 0.16)
|
200
200
|
eac_git (~> 0.14, >= 0.14.1)
|
201
|
-
eac_ruby_utils (~> 0.
|
201
|
+
eac_ruby_utils (~> 0.113)
|
202
202
|
eac_templates (~> 0.5)
|
203
203
|
filesize (~> 0.2)
|
204
204
|
htmlbeautifier (~> 1.4, >= 1.4.2)
|
@@ -207,10 +207,10 @@ PATH
|
|
207
207
|
PATH
|
208
208
|
remote: sub/eac_cli
|
209
209
|
specs:
|
210
|
-
eac_cli (0.
|
210
|
+
eac_cli (0.32.0)
|
211
211
|
colorize (~> 0.8, >= 0.8.1)
|
212
212
|
eac_config (~> 0.12)
|
213
|
-
eac_ruby_utils (~> 0.
|
213
|
+
eac_ruby_utils (~> 0.113)
|
214
214
|
|
215
215
|
PATH
|
216
216
|
remote: sub/eac_config
|
@@ -261,9 +261,9 @@ PATH
|
|
261
261
|
PATH
|
262
262
|
remote: sub/eac_ruby_utils
|
263
263
|
specs:
|
264
|
-
eac_ruby_utils (0.
|
264
|
+
eac_ruby_utils (0.113.0)
|
265
265
|
activesupport (>= 4, < 7)
|
266
|
-
addressable (~> 2.8, >= 2.8.
|
266
|
+
addressable (~> 2.8, >= 2.8.4)
|
267
267
|
bundler
|
268
268
|
filesize (~> 0.2)
|
269
269
|
net-ssh (~> 4.2)
|
data/lib/eac_tools/version.rb
CHANGED
data/sub/avm/avm.gemspec
CHANGED
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
15
|
s.add_dependency 'aranha-parsers', '~> 0.17', '>= 0.17.1'
|
16
|
-
s.add_dependency 'eac_cli', '~> 0.
|
16
|
+
s.add_dependency 'eac_cli', '~> 0.32'
|
17
17
|
s.add_dependency 'eac_config', '~> 0.12'
|
18
18
|
s.add_dependency 'eac_docker', '~> 0.7'
|
19
19
|
s.add_dependency 'eac_fs', '~> 0.16'
|
20
20
|
s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
|
21
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
21
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.113'
|
22
22
|
s.add_dependency 'eac_templates', '~> 0.5'
|
23
23
|
s.add_dependency 'filesize', '~> 0.2'
|
24
24
|
s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
|
@@ -45,9 +45,20 @@ module Avm
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
# @param id [Symbol]
|
49
|
+
# @return [Avm::Data::Unit]
|
50
|
+
def unit(identifier)
|
51
|
+
units[identifier.to_sym] || raise("No unit found with identifier \"#{identifier}\"")
|
52
|
+
end
|
53
|
+
|
48
54
|
def units
|
49
55
|
@units ||= {}
|
50
56
|
end
|
57
|
+
|
58
|
+
# @return [Enumerable<String>]
|
59
|
+
def units_ids
|
60
|
+
units.keys
|
61
|
+
end
|
51
62
|
end
|
52
63
|
end
|
53
64
|
end
|
@@ -17,7 +17,7 @@ module Avm
|
|
17
17
|
self.options = self.class.lists.option.hash_keys_validate!(options)
|
18
18
|
end
|
19
19
|
|
20
|
-
before_load :
|
20
|
+
before_load :clear
|
21
21
|
|
22
22
|
# @return [Pathname]
|
23
23
|
def files_path
|
@@ -33,7 +33,7 @@ module Avm
|
|
33
33
|
instance_command('tar', '-xzf', '-', '-C', files_path)
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def clear
|
37
37
|
infom "Removing all files under #{files_path}..."
|
38
38
|
instance_command('mkdir', '-p', files_path).execute!
|
39
39
|
instance_command('find', files_path, '-mindepth', 1, '-delete').execute!
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.69'
|
16
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.113'
|
17
17
|
|
18
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.
|
18
|
+
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
19
19
|
end
|
@@ -12,7 +12,18 @@ module Avm
|
|
12
12
|
TABLES_SQL = "select schemaname || '#{TABLE_PARTS_SEPARATOR}' || tablename from " \
|
13
13
|
"pg_tables where schemaname = '#{SCHEMA_VAR}'"
|
14
14
|
|
15
|
-
before_load :
|
15
|
+
before_load :clear
|
16
|
+
|
17
|
+
def clear
|
18
|
+
info 'Clearing database (Dropping all tables)...'
|
19
|
+
ts = tables
|
20
|
+
if ts.empty?
|
21
|
+
info 'Database has no tables'
|
22
|
+
else
|
23
|
+
info "Removing #{ts.count} table(s)..."
|
24
|
+
run_sql(drop_tables_sql(ts))
|
25
|
+
end
|
26
|
+
end
|
16
27
|
|
17
28
|
def dump_command
|
18
29
|
instance.dump_gzip_command
|
@@ -30,17 +41,6 @@ module Avm
|
|
30
41
|
'drop table ' + table_list.map(&:to_s).join(', ') + ' cascade'
|
31
42
|
end
|
32
43
|
|
33
|
-
def clear_database
|
34
|
-
info 'Clearing database (Dropping all tables)...'
|
35
|
-
ts = tables
|
36
|
-
if ts.empty?
|
37
|
-
info 'Database has no tables'
|
38
|
-
else
|
39
|
-
info "Removing #{ts.count} table(s)..."
|
40
|
-
run_sql(drop_tables_sql(ts))
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
44
|
# @param parts [Array<String>, Strings]
|
45
45
|
# @return [String]
|
46
46
|
def join_table_parts(parts)
|
@@ -12,12 +12,12 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib,template}/**/*']
|
14
14
|
|
15
|
-
s.add_dependency 'avm', '~> 0.
|
15
|
+
s.add_dependency 'avm', '~> 0.69'
|
16
16
|
s.add_dependency 'avm-eac_generic_base0', '~> 0.12'
|
17
|
-
s.add_dependency 'avm-eac_postgresql_base0', '~> 0.
|
17
|
+
s.add_dependency 'avm-eac_postgresql_base0', '~> 0.4'
|
18
18
|
s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.2'
|
19
19
|
s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
|
20
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
20
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.113'
|
21
21
|
|
22
22
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
|
23
23
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWebappBase0
|
7
|
+
module Instances
|
8
|
+
module Runners
|
9
|
+
class Data
|
10
|
+
class Unit
|
11
|
+
class Clear
|
12
|
+
runner_with :help
|
13
|
+
|
14
|
+
def run
|
15
|
+
runner_context.call(:data_unit).clear
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWebappBase0
|
7
|
+
module Instances
|
8
|
+
module Runners
|
9
|
+
class Data
|
10
|
+
class Unit
|
11
|
+
class Dump
|
12
|
+
runner_with :help do
|
13
|
+
pos_arg :dump_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
nyi
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWebappBase0
|
7
|
+
module Instances
|
8
|
+
module Runners
|
9
|
+
class Data
|
10
|
+
class Unit
|
11
|
+
class Load
|
12
|
+
runner_with :help do
|
13
|
+
pos_arg :dump_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
nyi
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module EacWebappBase0
|
7
|
+
module Instances
|
8
|
+
module Runners
|
9
|
+
class Data
|
10
|
+
class Unit
|
11
|
+
require_sub __FILE__
|
12
|
+
runner_with :help, :subcommands do
|
13
|
+
pos_arg :identifier
|
14
|
+
subcommands
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Enumerable<String>]
|
18
|
+
def available_units_ids
|
19
|
+
data_package.units_ids
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Avm::Instances::Data::Package]
|
23
|
+
def data_package
|
24
|
+
runner_context.call(:instance).data_package
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Avm::Instances::Data::Unit]
|
28
|
+
def data_unit
|
29
|
+
data_package.unit(parsed.identifier)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Hash<String, Enumerable<String>]
|
33
|
+
def help_extra_text
|
34
|
+
super.merge('Available units' => available_units_ids)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/sub/eac_cli/eac_cli.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
|
16
16
|
s.add_dependency 'eac_config', '~> 0.12'
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
17
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.113'
|
18
18
|
|
19
19
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
|
20
20
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/runner_with/help/list_section'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module EacCli
|
@@ -9,9 +10,8 @@ module EacCli
|
|
9
10
|
require_sub __FILE__, require_dependency: true
|
10
11
|
common_constructor :runner
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
OPTION_DESC_SEP = IDENT * 2
|
13
|
+
OPTION_DESC_SEP = ::EacCli::RunnerWith::Help::ListSection::IDENTATION * 2
|
14
|
+
SECTION_SEPARATOR = "\n"
|
15
15
|
|
16
16
|
class << self
|
17
17
|
def option_long(option)
|
@@ -35,7 +35,7 @@ module EacCli
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def word_separator
|
38
|
-
|
38
|
+
::EacCli::RunnerWith::Help::ListSection::WORD_SEPARATOR
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -45,36 +45,53 @@ module EacCli
|
|
45
45
|
runner.class.runner_definition
|
46
46
|
end
|
47
47
|
|
48
|
+
# @return [String, nil]
|
49
|
+
def extra_section
|
50
|
+
ess = extra_sections
|
51
|
+
return nil if ess.none?
|
52
|
+
|
53
|
+
ess.join(SECTION_SEPARATOR)
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Enumerable<String>]
|
57
|
+
def extra_sections
|
58
|
+
runner.if_respond(:help_extra_text, []) do |v|
|
59
|
+
if v.is_a?(::Hash)
|
60
|
+
v.map do |title, lines|
|
61
|
+
::EacCli::RunnerWith::Help::ListSection.new(title, lines)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
[v.to_s]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
48
69
|
def option_definition(option)
|
49
70
|
[self.class.option_usage_full(option), option.description,
|
50
71
|
option.default_value? ? "[Default: \"#{option.default_value}\"]" : nil]
|
51
72
|
.reject(&:blank?).join(OPTION_DESC_SEP)
|
52
73
|
end
|
53
74
|
|
54
|
-
|
55
|
-
b = include_header ? "#{header.humanize}:\n" : ''
|
56
|
-
b += send("self_#{header}") + "\n"
|
57
|
-
definition.alternatives.each do |alternative|
|
58
|
-
b += IDENT + self.alternative(alternative) + "\n"
|
59
|
-
end
|
60
|
-
b
|
61
|
-
end
|
62
|
-
|
75
|
+
# @return [String]
|
63
76
|
def options_section
|
64
|
-
|
65
|
-
|
66
|
-
|
77
|
+
::EacCli::RunnerWith::Help::ListSection.new(
|
78
|
+
'Options',
|
79
|
+
definition.alternatives.flat_map(&:options).map { |option| option_definition(option) }
|
80
|
+
)
|
67
81
|
end
|
68
82
|
|
83
|
+
# @return [String]
|
69
84
|
def usage_section
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
85
|
+
::EacCli::RunnerWith::Help::ListSection.new(
|
86
|
+
'Usage',
|
87
|
+
definition.alternatives.map { |alternative| self.alternative(alternative) }
|
88
|
+
)
|
74
89
|
end
|
75
90
|
|
76
91
|
def to_s
|
77
|
-
"#{definition.description}\n
|
92
|
+
r = ["#{definition.description}\n", usage_section, options_section]
|
93
|
+
.map { |s| "#{s}#{SECTION_SEPARATOR}" }.join
|
94
|
+
extra_section.if_present(r) { |v| r + v }
|
78
95
|
end
|
79
96
|
end
|
80
97
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module Help
|
8
|
+
class ListSection
|
9
|
+
WORD_SEPARATOR = ' '
|
10
|
+
IDENTATION = WORD_SEPARATOR * 2
|
11
|
+
|
12
|
+
common_constructor :title, :items
|
13
|
+
|
14
|
+
# @return [String]
|
15
|
+
def to_s
|
16
|
+
(["#{title}:"] + items.map { |line| "#{IDENTATION}#{line}" })
|
17
|
+
.map { |line| "#{line}\n" }.join
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/core_ext'
|
|
6
6
|
module EacCli
|
7
7
|
module RunnerWith
|
8
8
|
module Help
|
9
|
-
require_sub __FILE__,
|
9
|
+
require_sub __FILE__, require_mode: :kernel
|
10
10
|
common_concern do
|
11
11
|
include ::EacCli::Runner
|
12
12
|
|
@@ -27,10 +27,9 @@ module EacCli
|
|
27
27
|
raise ::EacCli::Runner::Exit
|
28
28
|
end
|
29
29
|
|
30
|
+
# @return [String]
|
30
31
|
def help_text
|
31
|
-
|
32
|
-
r += help_extra_text if respond_to?(:help_extra_text)
|
33
|
-
r
|
32
|
+
::EacCli::RunnerWith::Help::Builder.new(self).to_s
|
34
33
|
end
|
35
34
|
|
36
35
|
def show_help?
|
@@ -51,9 +51,12 @@ module EacCli
|
|
51
51
|
available_subcommands.keys.sort.join(', ')
|
52
52
|
end
|
53
53
|
|
54
|
+
# @return [Hash<String, Enumerable<String>]
|
54
55
|
def help_extra_text
|
55
|
-
|
56
|
-
|
56
|
+
{
|
57
|
+
'Subcommands' =>
|
58
|
+
available_subcommands.keys.sort
|
59
|
+
}
|
57
60
|
end
|
58
61
|
|
59
62
|
def method_missing(method_name, *arguments, &block)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/help/list_section'
|
4
|
+
|
5
|
+
::RSpec.describe ::EacCli::RunnerWith::Help::ListSection do
|
6
|
+
{
|
7
|
+
['Options', ['Option A', 'Option B']] => <<~TEXT
|
8
|
+
Options:
|
9
|
+
Option A
|
10
|
+
Option B
|
11
|
+
TEXT
|
12
|
+
}.each do |source, expected|
|
13
|
+
context "when source is #{source}" do
|
14
|
+
let(:instance) { described_class.new(*source) }
|
15
|
+
|
16
|
+
it do
|
17
|
+
expect(instance.to_s).to eq(expected)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = Dir['{lib}/**/*', 'MIT-LICENSE', 'README.rdoc']
|
17
17
|
|
18
18
|
s.add_dependency 'activesupport', '>= 4', '< 7'
|
19
|
-
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.
|
19
|
+
s.add_dependency 'addressable', '~> 2.8', '>= 2.8.4'
|
20
20
|
s.add_dependency 'bundler'
|
21
21
|
s.add_dependency 'filesize', '~> 0.2'
|
22
22
|
s.add_dependency 'net-ssh', '~> 4.2'
|
@@ -15,13 +15,17 @@ module EacRubyUtils
|
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
include ::EacRubyUtils::Listable
|
18
|
-
lists.add_symbol :option, :base, :include_modules, :require_dependency
|
18
|
+
lists.add_symbol :option, :base, :include_modules, :require_dependency, :require_mode
|
19
|
+
lists.add_symbol :require_mode, :active_support, :autoload, :kernel
|
19
20
|
|
20
21
|
attr_reader :file, :options
|
21
22
|
|
22
23
|
def initialize(file, options = {})
|
23
24
|
@file = file
|
24
25
|
@options = self.class.lists.option.hash_keys_validate!(options)
|
26
|
+
return unless options[OPTION_REQUIRE_MODE]
|
27
|
+
|
28
|
+
self.class.lists.require_mode.value_validate!(options[OPTION_REQUIRE_MODE])
|
25
29
|
end
|
26
30
|
|
27
31
|
# @return [Boolean]
|
@@ -54,6 +58,15 @@ module EacRubyUtils
|
|
54
58
|
" \"#{options[OPTION_INCLUDE_MODULES]}\""
|
55
59
|
end
|
56
60
|
|
61
|
+
# @return [Symbol]
|
62
|
+
def require_mode
|
63
|
+
return options[OPTION_REQUIRE_MODE] if options[OPTION_REQUIRE_MODE]
|
64
|
+
return REQUIRE_MODE_ACTIVE_SUPPORT if active_support_require?
|
65
|
+
return REQUIRE_MODE_AUTOLOAD if base?
|
66
|
+
|
67
|
+
REQUIRE_MODE_KERNEL
|
68
|
+
end
|
69
|
+
|
57
70
|
def require_sub_files
|
58
71
|
sub_files.each(&:require_file)
|
59
72
|
end
|
@@ -38,26 +38,17 @@ module EacRubyUtils
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def require_file
|
41
|
-
|
41
|
+
send("#{owner.require_mode}_require")
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
46
|
def active_support_require
|
47
|
-
return false unless owner.active_support_require?
|
48
|
-
|
49
47
|
::Kernel.require_dependency(path)
|
50
|
-
true
|
51
48
|
end
|
52
49
|
|
53
50
|
def autoload_require
|
54
|
-
|
55
|
-
|
56
|
-
basename = ::File.basename(path, '.*')
|
57
|
-
return false if basename.start_with?('_')
|
58
|
-
|
59
|
-
owner.base.autoload ::ActiveSupport::Inflector.camelize(basename), path
|
60
|
-
true
|
51
|
+
owner.base.autoload ::ActiveSupport::Inflector.camelize(::File.basename(path, '.*')), path
|
61
52
|
end
|
62
53
|
|
63
54
|
def kernel_require
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.63.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.69'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.69'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: avm-eac_asciidoctor_base0
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,14 +98,14 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0.
|
101
|
+
version: '0.4'
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '0.
|
108
|
+
version: '0.4'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: avm-eac_python_base0
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,20 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: '0.
|
230
|
-
- - ">="
|
231
|
-
- !ruby/object:Gem::Version
|
232
|
-
version: 0.15.1
|
229
|
+
version: '0.16'
|
233
230
|
type: :runtime
|
234
231
|
prerelease: false
|
235
232
|
version_requirements: !ruby/object:Gem::Requirement
|
236
233
|
requirements:
|
237
234
|
- - "~>"
|
238
235
|
- !ruby/object:Gem::Version
|
239
|
-
version: '0.
|
240
|
-
- - ">="
|
241
|
-
- !ruby/object:Gem::Version
|
242
|
-
version: 0.15.1
|
236
|
+
version: '0.16'
|
243
237
|
- !ruby/object:Gem::Dependency
|
244
238
|
name: avm-eac_wordpress_base0
|
245
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -306,14 +300,14 @@ dependencies:
|
|
306
300
|
requirements:
|
307
301
|
- - "~>"
|
308
302
|
- !ruby/object:Gem::Version
|
309
|
-
version: '0.
|
303
|
+
version: '0.113'
|
310
304
|
type: :runtime
|
311
305
|
prerelease: false
|
312
306
|
version_requirements: !ruby/object:Gem::Requirement
|
313
307
|
requirements:
|
314
308
|
- - "~>"
|
315
309
|
- !ruby/object:Gem::Version
|
316
|
-
version: '0.
|
310
|
+
version: '0.113'
|
317
311
|
- !ruby/object:Gem::Dependency
|
318
312
|
name: eac_ruby_gem_support
|
319
313
|
requirement: !ruby/object:Gem::Requirement
|
@@ -885,6 +879,10 @@ files:
|
|
885
879
|
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data.rb
|
886
880
|
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/dump.rb
|
887
881
|
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/load.rb
|
882
|
+
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit.rb
|
883
|
+
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit/clear.rb
|
884
|
+
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit/dump.rb
|
885
|
+
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/unit/load.rb
|
888
886
|
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/deploy.rb
|
889
887
|
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources.rb
|
890
888
|
- sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/sources/base.rb
|
@@ -1370,6 +1368,7 @@ files:
|
|
1370
1368
|
- sub/eac_cli/lib/eac_cli/runner_with/help.rb
|
1371
1369
|
- sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb
|
1372
1370
|
- sub/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb
|
1371
|
+
- sub/eac_cli/lib/eac_cli/runner_with/help/list_section.rb
|
1373
1372
|
- sub/eac_cli/lib/eac_cli/runner_with/input.rb
|
1374
1373
|
- sub/eac_cli/lib/eac_cli/runner_with/output.rb
|
1375
1374
|
- sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb
|
@@ -1387,6 +1386,7 @@ files:
|
|
1387
1386
|
- sub/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb
|
1388
1387
|
- sub/eac_cli/spec/lib/eac_cli/runner_spec.rb
|
1389
1388
|
- sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb
|
1389
|
+
- sub/eac_cli/spec/lib/eac_cli/runner_with/help/list_section_spec.rb
|
1390
1390
|
- sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
|
1391
1391
|
- sub/eac_cli/spec/lib/eac_cli/runner_with/output_spec.rb
|
1392
1392
|
- sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb
|