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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
  3. data/lib/avm/eac_rails_base0/apache_path.rb +6 -38
  4. data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
  5. data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
  6. data/lib/avm/eac_webapp_base0/deploy.rb +12 -30
  7. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
  8. data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
  9. data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
  10. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
  11. data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
  12. data/lib/avm/git/auto_commit/commit_info.rb +23 -0
  13. data/lib/avm/git/auto_commit/rules.rb +31 -0
  14. data/lib/avm/git/auto_commit/rules/base.rb +39 -0
  15. data/lib/avm/git/auto_commit/rules/last.rb +19 -0
  16. data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
  17. data/lib/avm/git/auto_commit/rules/new.rb +24 -0
  18. data/lib/avm/git/auto_commit/rules/nth.rb +31 -0
  19. data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
  20. data/lib/avm/git/auto_commit_path.rb +0 -21
  21. data/lib/avm/git/file_auto_fixup.rb +26 -57
  22. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
  23. data/lib/avm/tools/runner/git/auto_commit.rb +30 -31
  24. data/lib/avm/tools/runner/git/commit.rb +11 -20
  25. data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
  26. data/lib/avm/tools/runner/local_project/ruby.rb +3 -7
  27. data/lib/avm/tools/runner/local_project/ruby/bundler.rb +4 -8
  28. data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +11 -14
  29. data/lib/avm/tools/runner/ruby.rb +6 -14
  30. data/lib/avm/tools/runner/ruby/gems.rb +4 -7
  31. data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
  32. data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
  33. data/lib/avm/tools/version.rb +1 -1
  34. data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
  35. data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
  36. data/vendor/avm-apps/Gemfile +5 -0
  37. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  38. data/vendor/avm-apps/lib/avm/apps.rb +9 -0
  39. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  40. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  41. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  42. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  43. data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
  44. data/vendor/avm-apps/spec/spec_helper.rb +100 -0
  45. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
  46. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
  47. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
  48. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
  49. data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
  50. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
  51. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
  52. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
  53. data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
  54. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
  55. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  56. data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
  57. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  58. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
  59. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
  60. data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
  61. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  62. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
  63. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
  64. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
  65. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
  66. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
  67. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
  68. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
  69. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
  70. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
  71. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
  72. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  73. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
  74. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
  75. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
  76. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
  77. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
  78. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  79. metadata +40 -5
  80. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
  81. data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
  82. data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
@@ -1,18 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_redmine_base0/core_update'
4
- require 'eac_cli/default_runner'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
- require 'eac_ruby_utils/core_ext'
4
+ require 'eac_cli/core_ext'
7
5
 
8
6
  module Avm
9
7
  module Tools
10
8
  class Runner
11
9
  class EacRedmineBase0 < ::Avm::EacRailsBase1::Runner
12
- class CoreUpdate < ::EacRubyUtils::Console::DocoptRunner
13
- include ::EacCli::DefaultRunner
14
-
15
- runner_definition do
10
+ class CoreUpdate
11
+ runner_with :help do
16
12
  arg_opt '-u', '--url', 'Core\'s package URL.'
17
13
  arg_opt '-v', '--version', 'Core\'s version.'
18
14
  desc 'Update instance\' core.'
@@ -32,7 +28,7 @@ module Avm
32
28
  end
33
29
 
34
30
  def update
35
- ::Avm::EacRedmineBase0::CoreUpdate.new(context(:instance), version, url).run
31
+ ::Avm::EacRedmineBase0::CoreUpdate.new(runner_context.call(:instance), version, url).run
36
32
  end
37
33
 
38
34
  def url
@@ -40,7 +36,7 @@ module Avm
40
36
  end
41
37
 
42
38
  def url_by_version
43
- options.fetch('--version').if_present do |v|
39
+ parsed.version.if_present do |v|
44
40
  "https://www.redmine.org/releases/redmine-#{v}.tar.gz"
45
41
  end
46
42
  end
@@ -52,11 +48,11 @@ module Avm
52
48
  end
53
49
 
54
50
  def version
55
- options.fetch('--version') || version_by_url
51
+ parsed.version || version_by_url
56
52
  end
57
53
 
58
54
  def version_by_url
59
- options.fetch('--url').if_present do |v|
55
+ parsed.url.if_present do |v|
60
56
  /(\d+.\d+.\d+)/.if_match(v, false) { |m| m[1] }
61
57
  end
62
58
  end
@@ -1,64 +1,63 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/git/auto_commit_path'
3
+ require 'eac_cli/core_ext'
4
4
  require 'avm/files/formatter'
5
- require 'eac_cli/default_runner'
5
+ require 'avm/git/file_auto_fixup'
6
+ require 'avm/git/auto_commit/rules'
6
7
 
7
8
  module Avm
8
9
  module Tools
9
10
  class Runner
10
11
  class Git
11
- class AutoCommit < ::EacRubyUtils::Console::DocoptRunner
12
- include ::EacCli::DefaultRunner
13
-
14
- runner_definition do
15
- desc 'Commit with message based in content commited.'
12
+ class AutoCommit
13
+ runner_with :help do
14
+ desc 'Auto fixup files.'
16
15
  bool_opt '-d', '--dirty', 'Select dirty files.'
17
16
  bool_opt '-f', '--format', 'Format files before commit.'
18
- pos_arg 'paths', repeat: true, optional: true
17
+ arg_opt '-r', '--rule', 'Apply a rule in the specified order.', repeat: true
18
+ pos_arg :files, repeat: true, optional: true
19
19
  end
20
20
 
21
21
  def run
22
- clear_stage
23
- banner
24
22
  format_files
25
- run_paths
23
+ files.each do |file|
24
+ ::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file, rules).run
25
+ end
26
26
  end
27
27
 
28
28
  private
29
29
 
30
- def banner
31
- infov 'Paths', paths.count
30
+ def files_uncached
31
+ (files_from_option + dirty_files).sort.uniq
32
32
  end
33
33
 
34
- def clear_stage
35
- infom 'Clearing stage...'
36
- context(:git).system!('reset', 'HEAD')
34
+ def files_from_option
35
+ parsed.files.map { |p| p.to_pathname.expand_path }
37
36
  end
38
37
 
39
- def dirty_paths
40
- return [] unless options.fetch('--dirty')
38
+ def format_files
39
+ return unless parsed.format?
41
40
 
42
- context(:git).dirty_files.map { |d| context(:git).root_path.join / d.path }
41
+ infom 'Formating files...'
42
+ ::Avm::Files::Formatter.new(files, ::Avm::Files::Formatter::OPTION_APPLY => true).run
43
43
  end
44
44
 
45
- def format_files
46
- return unless options.fetch('--format')
45
+ def dirty_files
46
+ return [] unless parsed.dirty?
47
47
 
48
- infom 'Formating files...'
49
- ::Avm::Files::Formatter.new(paths.map(&:path),
50
- ::Avm::Files::Formatter::OPTION_APPLY => true).run
48
+ runner_context.call(:git).dirty_files.map do |file|
49
+ file.path.to_pathname.expand_path(runner_context.call(:git).root_path)
50
+ end
51
51
  end
52
52
 
53
- def paths_uncached
54
- (options.fetch('<paths>')
55
- .map { |p| p.to_pathname.expand_path } + dirty_paths)
56
- .reject(&:directory?)
57
- .sort.uniq.map { |path| ::Avm::Git::AutoCommitPath.new(context(:git), path) }
53
+ def rules
54
+ parsed.rule.map do |rule_string|
55
+ ::Avm::Git::AutoCommit::Rules.parse(rule_string)
56
+ end
58
57
  end
59
58
 
60
- def run_paths
61
- paths.each(&:run)
59
+ def select
60
+ parsed.last? ? 1 : parsed.select
62
61
  end
63
62
  end
64
63
  end
@@ -11,22 +11,13 @@ module Avm
11
11
  module Tools
12
12
  class Runner
13
13
  class Git
14
- class Commit < ::EacRubyUtils::Console::DocoptRunner
15
- include ::EacRubyUtils::SimpleCache
16
- include ::EacRubyUtils::Console::Speaker
17
-
18
- DOC = <<~DOCOPT
19
- Mostra informações de um commit.
20
-
21
- Usage:
22
- __PROGRAM__ [options] <ref>
23
- __PROGRAM__ -h | --help
24
-
25
- Options:
26
- -h --help Mostra esta ajuda.
27
- -f --files Mostra os arquivos.
28
- -s --size Mostra o tamanho de arquivos.
29
- DOCOPT
14
+ class Commit
15
+ runner_with :help do
16
+ desc 'Mostra informações de um commit.'
17
+ bool_opt '-f', '--files', 'Mostra os arquivos.'
18
+ bool_opt '-s', '--size', 'Mostra o tamanho de arquivos.'
19
+ pos_arg :ref
20
+ end
30
21
 
31
22
  def run
32
23
  input_banner
@@ -64,7 +55,7 @@ module Avm
64
55
  end
65
56
 
66
57
  def files_banner
67
- return unless options.fetch('--files')
58
+ return unless parsed.files?
68
59
 
69
60
  commit.files.each do |file|
70
61
  infov " #{file.path}", file_value(file)
@@ -82,11 +73,11 @@ module Avm
82
73
  end
83
74
 
84
75
  def reference
85
- options.fetch('<ref>')
76
+ parsed.ref
86
77
  end
87
78
 
88
79
  def git_uncached
89
- ::EacLauncher::Git::Base.new(context(:repository_path))
80
+ ::EacLauncher::Git::Base.new(runner_context.call(:repository_path))
90
81
  end
91
82
 
92
83
  def commit_uncached
@@ -103,7 +94,7 @@ module Avm
103
94
  end
104
95
 
105
96
  def show_size?
106
- options.fetch('--size')
97
+ parsed.size?
107
98
  end
108
99
  end
109
100
  end
@@ -30,7 +30,7 @@ module Avm
30
30
  local_repos.dirty_files.each do |file|
31
31
  infov ' * Ammending', file.path
32
32
  ::Avm::Git::FileAutoFixup.new(runner_context.call(:git), file.path,
33
- ::Avm::Git::FileAutoFixup::OPTION_UNIQUE => true).run
33
+ [::Avm::Git::AutoCommit::Rules::Unique.new]).run
34
34
  end
35
35
  end
36
36
 
@@ -1,19 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/patches/eac_ruby_gems_utils/gem'
4
- require 'eac_cli/default_runner'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
- require 'eac_ruby_utils/core_ext'
4
+ require 'eac_cli/core_ext'
7
5
 
8
6
  module Avm
9
7
  module Tools
10
8
  class Runner
11
9
  class LocalProject
12
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
10
+ class Ruby
13
11
  require_sub __FILE__
14
- include ::EacCli::DefaultRunner
15
-
16
- runner_definition do
12
+ runner_with :help, :subcommands do
17
13
  desc 'Ruby utitilies for local projects.'
18
14
  subcommands
19
15
  end
@@ -1,19 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/console/docopt_runner'
5
- require 'eac_ruby_utils/core_ext'
3
+ require 'eac_ruby_base0/core_ext'
6
4
 
7
5
  module Avm
8
6
  module Tools
9
7
  class Runner
10
8
  class LocalProject
11
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
12
- class Bundler < ::EacRubyUtils::Console::DocoptRunner
9
+ class Ruby
10
+ class Bundler
13
11
  require_sub __FILE__
14
- include ::EacCli::DefaultRunner
15
-
16
- runner_definition do
12
+ runner_with :help, :subcommands do
17
13
  desc 'Ruby\'s bundler utitilies for local projects.'
18
14
  subcommands
19
15
  end
@@ -1,18 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'eac_ruby_base0/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
8
  class LocalProject
10
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
11
- class Bundler < ::EacRubyUtils::Console::DocoptRunner
12
- class GemfileLock < ::EacRubyUtils::Console::DocoptRunner
13
- include ::EacCli::DefaultRunner
14
-
15
- runner_definition do
9
+ class Ruby
10
+ class Bundler
11
+ class GemfileLock
12
+ runner_with :help do
16
13
  desc 'Manipulage a "Gemfile.lock" file.'
17
14
  bool_opt '-c', '--continue', 'Continue Git rebase/cherry-pick.'
18
15
  bool_opt '-i', '--install', 'Run "bundle install".'
@@ -34,7 +31,7 @@ module Avm
34
31
  private
35
32
 
36
33
  def complete?
37
- !option_or_all?('--recursive') || !conflict?
34
+ !option_or_all?(:recursive) || !conflict?
38
35
  end
39
36
 
40
37
  def rebasing?
@@ -51,21 +48,21 @@ module Avm
51
48
  end
52
49
 
53
50
  def bundle_install
54
- return unless check_capability(__method__, :ruby_gem, '--install')
51
+ return unless check_capability(__method__, :ruby_gem, :install)
55
52
 
56
53
  infom '"bundle install"...'
57
54
  bundle_run('install')
58
55
  end
59
56
 
60
57
  def bundle_update
61
- return unless check_capability(__method__, :ruby_gem, '--update')
58
+ return unless check_capability(__method__, :ruby_gem, :update)
62
59
 
63
60
  infom '"bundle update"...'
64
61
  bundle_run('update')
65
62
  end
66
63
 
67
64
  def git_continue
68
- return unless check_capability(__method__, :git_repo, '--continue')
65
+ return unless check_capability(__method__, :git_repo, :continue)
69
66
 
70
67
  infom "Adding \"#{gemfile_lock}\"..."
71
68
  instance.git_repo.command('add', gemfile_lock).execute!
@@ -115,11 +112,11 @@ module Avm
115
112
  end
116
113
 
117
114
  def option_or_all?(option)
118
- options.fetch(option) || options.fetch('--all')
115
+ parsed[option] || parsed.all?
119
116
  end
120
117
 
121
118
  def instance
122
- context(:instance)
119
+ runner_context.call(:instance)
123
120
  end
124
121
 
125
122
  def check_capability(caller, capability, option)
@@ -1,24 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'eac_cli/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
8
+ class Ruby
10
9
  require_sub __FILE__
11
-
12
- DOC = <<~DOCOPT
13
- Ruby utilities for AVM.
14
-
15
- Usage:
16
- __PROGRAM__ [options] __SUBCOMMANDS__
17
- __PROGRAM__ -h | --help
18
-
19
- Options:
20
- -h --help Show this screen.
21
- DOCOPT
10
+ runner_with :help, :subcommands do
11
+ desc 'Ruby utilities for AVM.'
12
+ subcommands
13
+ end
22
14
  end
23
15
  end
24
16
  end
@@ -1,17 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'eac_cli/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
10
- class Gems < ::EacRubyUtils::Console::DocoptRunner
8
+ class Ruby
9
+ class Gems
11
10
  require_sub __FILE__
12
- include ::EacCli::DefaultRunner
13
-
14
- runner_definition do
11
+ runner_with :help, :subcommands do
15
12
  desc 'Rubygems utilities for AVM.'
16
13
  subcommands
17
14
  end
@@ -1,31 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/ruby/gems/generator'
4
- require 'eac_ruby_utils/console/docopt_runner'
5
- require 'eac_ruby_utils/core_ext'
6
- require 'eac_cli/default_runner'
4
+ require 'eac_cli/core_ext'
7
5
 
8
6
  module Avm
9
7
  module Tools
10
8
  class Runner
11
- class Ruby < ::EacRubyUtils::Console::DocoptRunner
12
- class Gems < ::EacRubyUtils::Console::DocoptRunner
13
- class Generate < ::EacRubyUtils::Console::DocoptRunner
14
- enable_console_speaker
15
- enable_simple_cache
16
-
17
- DOC = <<~DOCUMENT
18
- Create a gem.
19
-
20
- Usage:
21
- __PROGRAM__ [options] <path>
22
- __PROGRAM__ -h --help
23
-
24
- Options:
25
- -h --help Show this help.
26
- --eac-ruby-utils-version=<version> Version for "eac_ruby_utils" gem.
27
- --eac-ruby-gem-support-version=<version> Version for "eac_ruby_gem_support" gem.
28
- DOCUMENT
9
+ class Ruby
10
+ class Gems
11
+ class Generate
12
+ runner_with :help do
13
+ desc 'Create a gem.'
14
+ arg_opt '--eac-ruby-utils-version', 'Version for "eac_ruby_utils" gem.'
15
+ arg_opt '--eac-ruby-gem-support-version', 'Version for "eac_ruby_gem_support" gem.'
16
+ pos_arg :path
17
+ end
29
18
 
30
19
  def run
31
20
  success "Gem \"#{generator.name}\" created in \"#{generator.root_directory}\""
@@ -34,12 +23,12 @@ module Avm
34
23
  private
35
24
 
36
25
  def generator_uncached
37
- ::Avm::Ruby::Gems::Generator.new(options.fetch('<path>'), generator_options)
26
+ ::Avm::Ruby::Gems::Generator.new(parsed.path, generator_options)
38
27
  end
39
28
 
40
29
  def generator_options
41
30
  %w[eac_ruby_utils eac_ruby_gem_support].map do |gem_name|
42
- ["#{gem_name}_version".to_sym, options.fetch("--#{gem_name.dasherize}-version")]
31
+ ["#{gem_name}_version".to_sym, parsed.fetch("#{gem_name.variableize}_version")]
43
32
  end.to_h
44
33
  end
45
34
  end