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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +1 -1
  3. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/apache_host.rb +1 -1
  4. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -3
  5. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build/file.rb +4 -4
  6. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/deploy.rb +6 -6
  7. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/instance.rb +1 -1
  8. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/project.rb +1 -1
  9. data/lib/avm/eac_rails_base1/runner/log.rb +43 -0
  10. data/lib/avm/eac_rails_base1/runner_with/bundle.rb +2 -32
  11. data/lib/avm/eac_rails_base1/runner_with/rails_environment.rb +47 -0
  12. data/lib/avm/eac_webapp_base0/deploy.rb +16 -4
  13. data/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +1 -1
  14. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +1 -1
  15. data/lib/avm/eac_webapp_base0/instance.rb +2 -0
  16. data/lib/avm/eac_webapp_base0/runner/deploy.rb +13 -21
  17. data/lib/avm/executables.rb +1 -1
  18. data/lib/avm/git/auto_commit/commit_info.rb +22 -0
  19. data/lib/avm/git/auto_commit/rules.rb +31 -0
  20. data/lib/avm/git/auto_commit/rules/base.rb +39 -0
  21. data/lib/avm/git/auto_commit/rules/last.rb +19 -0
  22. data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
  23. data/lib/avm/git/auto_commit/rules/nth.rb +23 -0
  24. data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
  25. data/lib/avm/git/file_auto_fixup.rb +15 -62
  26. data/lib/avm/instances/runner.rb +1 -1
  27. data/lib/avm/tools/runner/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
  28. data/lib/avm/tools/runner/eac_webapp_base0.rb +14 -0
  29. data/lib/avm/tools/runner/git/auto_commit.rb +12 -13
  30. data/lib/avm/tools/runner/git/auto_fixup.rb +9 -9
  31. data/lib/avm/tools/runner/git/commit.rb +11 -20
  32. data/lib/avm/tools/runner/instance.rb +3 -6
  33. data/lib/avm/tools/runner/instance/info.rb +4 -7
  34. data/lib/avm/tools/runner/local_project/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
  35. data/lib/avm/tools/runner/local_project/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -9
  36. data/lib/avm/tools/version.rb +1 -1
  37. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
  38. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +6 -1
  39. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
  40. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
  41. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
  42. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  43. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
  44. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +4 -0
  45. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  46. metadata +42 -13
  47. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -6
@@ -2,16 +2,13 @@
2
2
 
3
3
  require 'avm/instances/base'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
- class Instance < ::EacRubyUtils::Console::DocoptRunner
9
+ class Instance
11
10
  require_sub __FILE__
12
- runner_with
13
-
14
- runner_definition do
11
+ runner_with :help, :subcommands do
15
12
  desc 'Utilities for generic instances.'
16
13
  pos_arg :instance_id
17
14
  subcommands
@@ -20,7 +17,7 @@ module Avm
20
17
  private
21
18
 
22
19
  def instance_uncached
23
- ::Avm::Instances::Base.by_id(options['<instance_id>'])
20
+ ::Avm::Instances::Base.by_id(parsed.instance_id)
24
21
  end
25
22
  end
26
23
  end
@@ -2,16 +2,13 @@
2
2
 
3
3
  require 'avm/instances/entry_keys'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module Tools
9
8
  class Runner
10
- class Instance < ::EacRubyUtils::Console::DocoptRunner
11
- class Info < ::EacRubyUtils::Console::DocoptRunner
12
- runner_with
13
-
14
- runner_definition do
9
+ class Instance
10
+ class Info
11
+ runner_with :help do
15
12
  desc 'Show info about a instance.'
16
13
  end
17
14
 
@@ -35,7 +32,7 @@ module Avm
35
32
  end
36
33
 
37
34
  def instance
38
- context(:instance)
35
+ runner_context.call(:instance)
39
36
  end
40
37
  end
41
38
  end
@@ -7,11 +7,11 @@ module Avm
7
7
  module Tools
8
8
  class Runner
9
9
  class LocalProject
10
- class EacWritingsBase1
10
+ class EacAsciidoctorBase0
11
11
  require_sub __FILE__
12
12
 
13
13
  runner_with :help, :subcommands do
14
- desc 'EacWritingsBase0 utitilies for local projects.'
14
+ desc 'EacAsciidoctorBase0 utitilies for local projects.'
15
15
  subcommands
16
16
  end
17
17
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_writings_base1/build'
4
- require 'avm/eac_writings_base1/project'
3
+ require 'avm/eac_asciidoctor_base0/build'
4
+ require 'avm/eac_asciidoctor_base0/project'
5
5
  require 'eac_cli/core_ext'
6
6
  require 'eac_ruby_utils/console/docopt_runner'
7
7
 
@@ -9,7 +9,7 @@ module Avm
9
9
  module Tools
10
10
  class Runner
11
11
  class LocalProject
12
- class EacWritingsBase1
12
+ class EacAsciidoctorBase0
13
13
  class Build
14
14
  runner_with :help do
15
15
  desc 'Build the project'
@@ -24,8 +24,8 @@ module Avm
24
24
  private
25
25
 
26
26
  def build_uncached
27
- ::Avm::EacWritingsBase1::Build.new(runner_context.call(:project),
28
- target_directory: parsed.target_dir)
27
+ ::Avm::EacAsciidoctorBase0::Build.new(runner_context.call(:project),
28
+ target_directory: parsed.target_dir)
29
29
  end
30
30
 
31
31
  def default_target_directory
@@ -36,10 +36,6 @@ module Avm
36
36
  runner_context.call(:project_banner)
37
37
  infov 'Target directory', build.target_directory
38
38
  end
39
- #
40
- # def target_directory_uncached
41
- # .if_present(default_target_directory).to_pathname
42
- # end
43
39
  end
44
40
  end
45
41
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.87.1'
5
+ VERSION = '0.92.0'
6
6
  end
7
7
  end
@@ -8,6 +8,14 @@ module EacCli
8
8
  def argument?
9
9
  true
10
10
  end
11
+
12
+ def build_value(new_value, previous_value)
13
+ repeat? ? previous_value + [new_value] : new_value
14
+ end
15
+
16
+ def default_value
17
+ repeat? ? [] : nil
18
+ end
11
19
  end
12
20
  end
13
21
  end
@@ -8,7 +8,8 @@ module EacCli
8
8
  DEFAULT_REQUIRED = false
9
9
 
10
10
  enable_listable
11
- lists.add_symbol :option, :optional, :usage, :required
11
+ enable_abstract_methods :build_value, :default_value
12
+ lists.add_symbol :option, :optional, :usage, :repeat, :required
12
13
  attr_reader :short, :long, :description, :options
13
14
 
14
15
  def initialize(short, long, description, options = {})
@@ -23,6 +24,10 @@ module EacCli
23
24
  long.to_s.variableize.to_sym
24
25
  end
25
26
 
27
+ def repeat?
28
+ options[OPTION_REPEAT]
29
+ end
30
+
26
31
  def required?
27
32
  return true if options.key?(:required) && options.fetch(:required)
28
33
  return false if options.key?(:optional) && options.fetch(:optional)
@@ -8,6 +8,14 @@ module EacCli
8
8
  def argument?
9
9
  false
10
10
  end
11
+
12
+ def build_value(_new_value, previous_value)
13
+ repeat? ? previous_value + 1 : true
14
+ end
15
+
16
+ def default_value
17
+ repeat? ? 0 : false
18
+ end
11
19
  end
12
20
  end
13
21
  end
@@ -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
@@ -24,11 +24,7 @@ module EacCli
24
24
  end
25
25
 
26
26
  def collect(option, value)
27
- if data[option].is_a?(::Array)
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] = option_default_value(option) }
46
- definition.positional.each do |positional|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.12.6'
4
+ VERSION = '0.13.0'
5
5
  end
@@ -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) { { opt1: nil, opt2: false, opt3: false, pos1: 'bbb', pos2: [] } }
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) { { opt1: nil, opt2: false, opt3: true, pos1: nil, pos2: [] } }
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
@@ -14,6 +14,10 @@ module EacRubyUtils
14
14
  %w[tz_env debian_config offset].lazy.map { |s| send("by_#{s}") }.find(&:present?)
15
15
  end
16
16
 
17
+ def auto_set
18
+ ::Time.zone = auto
19
+ end
20
+
17
21
  def by_debian_config
18
22
  path = ::Pathname.new(DEBIAN_CONFIG_PATH)
19
23
  path.exist? ? path.read.strip.presence : nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.58.0'
4
+ VERSION = '0.58.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.87.1
4
+ version: 0.92.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-06 00:00:00.000000000 Z
11
+ date: 2021-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -24,6 +24,26 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: asciidoctor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 2.0.12
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.12
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: clipboard
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -290,6 +310,13 @@ files:
290
310
  - lib/avm/docker/image.rb
291
311
  - lib/avm/docker/registry.rb
292
312
  - lib/avm/docker/runner.rb
313
+ - lib/avm/eac_asciidoctor_base0.rb
314
+ - lib/avm/eac_asciidoctor_base0/apache_host.rb
315
+ - lib/avm/eac_asciidoctor_base0/build.rb
316
+ - lib/avm/eac_asciidoctor_base0/build/file.rb
317
+ - lib/avm/eac_asciidoctor_base0/deploy.rb
318
+ - lib/avm/eac_asciidoctor_base0/instance.rb
319
+ - lib/avm/eac_asciidoctor_base0/project.rb
293
320
  - lib/avm/eac_rails_base0.rb
294
321
  - lib/avm/eac_rails_base0/apache_host.rb
295
322
  - lib/avm/eac_rails_base0/apache_path.rb
@@ -301,8 +328,10 @@ files:
301
328
  - lib/avm/eac_rails_base1/runner.rb
302
329
  - lib/avm/eac_rails_base1/runner/bundle.rb
303
330
  - lib/avm/eac_rails_base1/runner/code_runner.rb
331
+ - lib/avm/eac_rails_base1/runner/log.rb
304
332
  - lib/avm/eac_rails_base1/runner/rails_server.rb
305
333
  - lib/avm/eac_rails_base1/runner_with/bundle.rb
334
+ - lib/avm/eac_rails_base1/runner_with/rails_environment.rb
306
335
  - lib/avm/eac_redmine_base0.rb
307
336
  - lib/avm/eac_redmine_base0/apache_host.rb
308
337
  - lib/avm/eac_redmine_base0/core_update.rb
@@ -346,13 +375,6 @@ files:
346
375
  - lib/avm/eac_writings_base0/project_build.rb
347
376
  - lib/avm/eac_writings_base0/project_build/chapters_content.rb
348
377
  - lib/avm/eac_writings_base0/project_build/copy_files.rb
349
- - lib/avm/eac_writings_base1.rb
350
- - lib/avm/eac_writings_base1/apache_host.rb
351
- - lib/avm/eac_writings_base1/build.rb
352
- - lib/avm/eac_writings_base1/build/file.rb
353
- - lib/avm/eac_writings_base1/deploy.rb
354
- - lib/avm/eac_writings_base1/instance.rb
355
- - lib/avm/eac_writings_base1/project.rb
356
378
  - lib/avm/executables.rb
357
379
  - lib/avm/files.rb
358
380
  - lib/avm/files/appendable.rb
@@ -378,6 +400,13 @@ files:
378
400
  - lib/avm/files/rotate.rb
379
401
  - lib/avm/fs_cache.rb
380
402
  - lib/avm/git.rb
403
+ - lib/avm/git/auto_commit/commit_info.rb
404
+ - lib/avm/git/auto_commit/rules.rb
405
+ - lib/avm/git/auto_commit/rules/base.rb
406
+ - lib/avm/git/auto_commit/rules/last.rb
407
+ - lib/avm/git/auto_commit/rules/manual.rb
408
+ - lib/avm/git/auto_commit/rules/nth.rb
409
+ - lib/avm/git/auto_commit/rules/unique.rb
381
410
  - lib/avm/git/auto_commit_path.rb
382
411
  - lib/avm/git/auto_commit_path/ruby.rb
383
412
  - lib/avm/git/commit.rb
@@ -496,15 +525,16 @@ files:
496
525
  - lib/avm/sync.rb
497
526
  - lib/avm/tools.rb
498
527
  - lib/avm/tools/runner.rb
528
+ - lib/avm/tools/runner/eac_asciidoctor_base0.rb
499
529
  - lib/avm/tools/runner/eac_rails_base0.rb
500
530
  - lib/avm/tools/runner/eac_rails_base0/apache_path.rb
501
531
  - lib/avm/tools/runner/eac_redmine_base0.rb
502
532
  - lib/avm/tools/runner/eac_redmine_base0/core_update.rb
503
533
  - lib/avm/tools/runner/eac_redmine_base0/docker.rb
504
534
  - lib/avm/tools/runner/eac_redmine_base0/project_rename.rb
535
+ - lib/avm/tools/runner/eac_webapp_base0.rb
505
536
  - lib/avm/tools/runner/eac_wordpress_base0.rb
506
537
  - lib/avm/tools/runner/eac_writings_base0.rb
507
- - lib/avm/tools/runner/eac_writings_base1.rb
508
538
  - lib/avm/tools/runner/files.rb
509
539
  - lib/avm/tools/runner/files/format.rb
510
540
  - lib/avm/tools/runner/files/rotate.rb
@@ -528,12 +558,12 @@ files:
528
558
  - lib/avm/tools/runner/launcher/projects.rb
529
559
  - lib/avm/tools/runner/launcher/publish.rb
530
560
  - lib/avm/tools/runner/local_project.rb
561
+ - lib/avm/tools/runner/local_project/eac_asciidoctor_base0.rb
562
+ - lib/avm/tools/runner/local_project/eac_asciidoctor_base0/build.rb
531
563
  - lib/avm/tools/runner/local_project/eac_writings_base0.rb
532
564
  - lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb
533
565
  - lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb
534
566
  - lib/avm/tools/runner/local_project/eac_writings_base0/info.rb
535
- - lib/avm/tools/runner/local_project/eac_writings_base1.rb
536
- - lib/avm/tools/runner/local_project/eac_writings_base1/build.rb
537
567
  - lib/avm/tools/runner/local_project/info.rb
538
568
  - lib/avm/tools/runner/local_project/ruby.rb
539
569
  - lib/avm/tools/runner/local_project/ruby/bundler.rb
@@ -1038,7 +1068,6 @@ files:
1038
1068
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb
1039
1069
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb
1040
1070
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time.rb
1041
- - vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb
1042
1071
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb
1043
1072
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb
1044
1073
  - vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb