avm-tools 0.94.2 → 0.98.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/app_src.rb +60 -0
  3. data/lib/avm/core_ext.rb +4 -0
  4. data/lib/avm/docker/runner.rb +22 -30
  5. data/lib/avm/eac_asciidoctor_base0/deploy.rb +5 -5
  6. data/lib/avm/eac_rails_base1/runner/bundle.rb +0 -1
  7. data/lib/avm/eac_rails_base1/runner/code_runner.rb +0 -1
  8. data/lib/avm/eac_rails_base1/runner/rails_server.rb +0 -1
  9. data/lib/avm/eac_webapp_base0/instance.rb +5 -2
  10. data/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
  11. data/lib/avm/eac_webapp_base0/runner/data.rb +1 -0
  12. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
  13. data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
  14. data/lib/avm/git/issue/complete/_test.rb +2 -2
  15. data/lib/avm/instances/base.rb +6 -12
  16. data/lib/avm/instances/base/entry_keys.rb +17 -0
  17. data/lib/{eac_launcher → avm/launcher}/instances/error.rb +0 -0
  18. data/lib/avm/launcher/instances/runner_helper.rb +41 -0
  19. data/lib/avm/patches/class.rb +4 -0
  20. data/lib/avm/patches/eac_ruby_gems_utils.rb +4 -0
  21. data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +2 -2
  22. data/lib/avm/patches/object.rb +4 -0
  23. data/lib/avm/patches/object/fs_cache.rb +16 -0
  24. data/lib/avm/ruby/bundler.rb +11 -0
  25. data/lib/avm/ruby/bundler/incompatible_parser.rb +25 -0
  26. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +25 -0
  27. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +39 -0
  28. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +19 -0
  29. data/lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb +73 -0
  30. data/lib/avm/ruby/bundler/incompatible_parser/line_factory.rb +31 -0
  31. data/lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb +19 -0
  32. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +26 -0
  33. data/lib/avm/ruby/gems/generator.rb +1 -5
  34. data/lib/avm/ruby/rubocop/_configured.rb +2 -2
  35. data/lib/avm/tools/runner/{local_project.rb → app_src.rb} +3 -3
  36. data/lib/avm/tools/runner/app_src/eac_asciidoctor_base0.rb +14 -0
  37. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0/build.rb +19 -7
  38. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0.rb +1 -2
  39. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_chapters.rb +1 -2
  40. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_single.rb +1 -2
  41. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/info.rb +1 -2
  42. data/lib/avm/tools/runner/app_src/info.rb +22 -0
  43. data/lib/avm/tools/runner/{local_project → app_src}/ruby.rb +1 -1
  44. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler.rb +1 -1
  45. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/gemfile_lock.rb +1 -1
  46. data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +84 -0
  47. data/lib/avm/tools/runner/{local_project → app_src}/test.rb +6 -9
  48. data/lib/avm/tools/runner/app_src/update.rb +22 -0
  49. data/lib/avm/tools/runner/{local_project → app_src}/version_bump.rb +1 -1
  50. data/lib/avm/tools/runner/eac_asciidoctor_base0.rb +0 -1
  51. data/lib/avm/tools/runner/eac_rails_base0.rb +0 -1
  52. data/lib/avm/tools/runner/eac_redmine_base0.rb +0 -1
  53. data/lib/avm/tools/runner/eac_wordpress_base0.rb +0 -1
  54. data/lib/avm/tools/runner/eac_writings_base0.rb +0 -1
  55. data/lib/avm/tools/runner/git.rb +0 -1
  56. data/lib/avm/tools/runner/git/commit.rb +0 -1
  57. data/lib/avm/tools/runner/git/dirty_files.rb +17 -22
  58. data/lib/avm/tools/runner/git/issue.rb +21 -36
  59. data/lib/avm/tools/runner/git/organize.rb +6 -9
  60. data/lib/avm/tools/runner/git/revisions_test.rb +14 -25
  61. data/lib/avm/tools/runner/git/subrepo.rb +3 -6
  62. data/lib/avm/tools/runner/git/subrepo/check.rb +10 -13
  63. data/lib/avm/tools/runner/git/subrepo/clone.rb +2 -3
  64. data/lib/avm/tools/runner/git/subrepo/fix.rb +2 -3
  65. data/lib/avm/tools/runner/launcher.rb +3 -6
  66. data/lib/avm/tools/runner/launcher/instances.rb +10 -21
  67. data/lib/avm/tools/runner/launcher/projects.rb +10 -18
  68. data/lib/avm/tools/runner/launcher/publish.rb +18 -26
  69. data/lib/avm/tools/runner/ruby/rubocop.rb +9 -25
  70. data/lib/avm/tools/runner/self.rb +7 -15
  71. data/lib/avm/tools/runner/self/docker.rb +1 -1
  72. data/lib/avm/tools/version.rb +1 -1
  73. data/lib/eac_launcher/instances.rb +1 -1
  74. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -5
  75. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -0
  76. data/vendor/avm-apps/avm-apps.gemspec +1 -1
  77. data/vendor/avm-apps/lib/avm/apps/sources/configuration.rb +57 -0
  78. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +18 -0
  79. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +26 -0
  80. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +29 -0
  81. data/vendor/avm-apps/lib/avm/apps/version.rb +1 -1
  82. data/vendor/avm-apps/spec/rubocop_spec.rb +1 -5
  83. data/vendor/avm-apps/spec/spec_helper.rb +3 -0
  84. data/vendor/avm-eac_asciidoctor_base0/Gemfile +5 -0
  85. data/vendor/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +20 -0
  86. data/{lib/avm/local_projects.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0.rb} +1 -1
  87. data/{lib/avm/eac_asciidoctor_base0/project.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb} +2 -4
  88. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +19 -0
  89. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb +49 -0
  90. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +30 -0
  91. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb +30 -0
  92. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +54 -0
  93. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +7 -0
  94. data/vendor/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb +3 -0
  95. data/vendor/avm-eac_asciidoctor_base0/spec/spec_helper.rb +102 -0
  96. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  97. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +5 -1
  98. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +3 -1
  99. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
  100. data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
  101. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  102. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
  103. data/vendor/eac_cli/spec/spec_helper.rb +3 -0
  104. data/vendor/eac_docker/eac_docker.gemspec +1 -1
  105. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  106. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
  107. data/vendor/eac_docker/spec/spec_helper.rb +3 -0
  108. data/vendor/eac_git/eac_git.gemspec +2 -1
  109. data/vendor/eac_git/lib/eac_git/local.rb +4 -0
  110. data/vendor/eac_git/lib/eac_git/local/commit.rb +53 -0
  111. data/vendor/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
  112. data/vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
  113. data/vendor/eac_git/lib/eac_git/rspec.rb +6 -1
  114. data/{lib/avm/git/spec_helper.rb → vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb} +16 -13
  115. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  116. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
  117. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
  118. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
  119. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
  120. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
  121. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
  122. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
  123. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
  124. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
  125. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
  126. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
  127. data/vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
  128. data/vendor/eac_git/spec/rubocop_spec.rb +1 -5
  129. data/vendor/eac_git/spec/spec_helper.rb +3 -0
  130. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
  131. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
  132. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
  133. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  134. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
  135. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
  136. data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
  137. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +4 -3
  138. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +7 -10
  139. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +9 -2
  140. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  141. data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +1 -5
  142. data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +3 -0
  143. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -1
  144. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
  145. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
  146. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
  147. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
  148. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
  149. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
  150. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
  151. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
  152. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
  153. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
  154. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
  155. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  156. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
  157. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
  158. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
  159. data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
  160. metadata +120 -39
  161. data/lib/avm/eac_asciidoctor_base0/build.rb +0 -47
  162. data/lib/avm/eac_asciidoctor_base0/build/file.rb +0 -28
  163. data/lib/avm/instances/configuration.rb +0 -55
  164. data/lib/avm/instances/configuration/_locale.rb +0 -16
  165. data/lib/avm/instances/configuration/_rubocop.rb +0 -24
  166. data/lib/avm/instances/configuration/_tests.rb +0 -27
  167. data/lib/avm/local_projects/instance.rb +0 -62
  168. data/lib/avm/tools/runner/local_project/eac_asciidoctor_base0.rb +0 -32
  169. data/lib/avm/tools/runner/local_project/info.rb +0 -25
  170. data/lib/avm/tools/runner/local_project/update.rb +0 -25
  171. data/lib/eac_launcher/instances/runner_helper.rb +0 -42
  172. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
  173. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a418fd7c14cb6599e9c75eeba391a576aefb0897c6ce0f069568495cf0cb9802
4
- data.tar.gz: 9ae79ac488f4fb96331b6d71bb7db9e943947b37577ffb725c3e10241b8b6206
3
+ metadata.gz: 2a8cd450cfc4285226ff31b7a2183ae8cb87c3cb3b688548251bd5b92c25f9c3
4
+ data.tar.gz: 4865bc83bfa9a0f04c76fce01c546d3c8df123f63647d4fdbcd6ebfc9389aaed
5
5
  SHA512:
6
- metadata.gz: 4faba2cbbbcdcc77ca7a925373de53056f7e1ef8caaa183f9eb6e8ca56c4de4e77e923cfa0567f8c83995cad400a3d09d698e18a77aa95dfbca98fcf8aa1d320
7
- data.tar.gz: 772e38b1000548d8e37bc44b2ac9380948fbeaca3706b7d7218140895765fd053e589eabe95a23e64d19c931ee7e28cc18ce865931e76536d3f8c5dd83cd0ed5
6
+ metadata.gz: 8bfbd03718cedd613906c9c550db8d1ac5ff05a4e904bce261d13382bbb20f10d7e5ab72de57f396499f5616356a7419b2fca3a65ed7fa7a3d8f7d6e0ff48841
7
+ data.tar.gz: 97fbf67954eca6d3e64d8165c6c523a092a3b50442d506858ea412a7c1849285b7d90364679773a91927b6298d1b01fad73bbcb5edadb73bf1cf2a59608c3033
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/apps/sources/configuration'
4
+ require 'eac_launcher/paths/real'
5
+ require 'eac_ruby_utils/core_ext'
6
+ require 'avm/projects/stereotypes'
7
+ require 'i18n'
8
+
9
+ module Avm
10
+ class AppSrc
11
+ enable_simple_cache
12
+ common_constructor :path do
13
+ self.path = path.to_pathname
14
+ source_stereotypes_mixins
15
+ end
16
+
17
+ delegate :to_s, to: :path
18
+
19
+ def locale
20
+ configuration.if_present(&:locale) || ::I18n.default_locale
21
+ end
22
+
23
+ # Backward compatibility with [EacLauncher::Paths::Logical].
24
+ # @return [EacLauncher::Paths::Real].
25
+ def real
26
+ ::EacLauncher::Paths::Real.new(path.to_path)
27
+ end
28
+
29
+ def run_job(job, job_args = [])
30
+ stereotypes.each { |stereotype| run_stereotype_job(stereotype, job, job_args) }
31
+ end
32
+
33
+ private
34
+
35
+ # @return [Avm::Apps::Sources::Configuration]
36
+ def configuration_uncached
37
+ ::Avm::Apps::Sources::Configuration.find_in_path(path)
38
+ end
39
+
40
+ def run_stereotype_job(stereotype, job, job_args)
41
+ job_class_method = "#{job}_class"
42
+ if stereotype.send(job_class_method).present?
43
+ puts stereotype.label + ": #{job} class found. Running..."
44
+ stereotype.send(job_class_method).new(self, *job_args).run
45
+ else
46
+ puts stereotype.label + ": #{job} class not found"
47
+ end
48
+ end
49
+
50
+ def stereotypes_uncached
51
+ ::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
52
+ end
53
+
54
+ def source_stereotypes_mixins
55
+ stereotypes.each do |s|
56
+ s.local_project_mixin_module.if_present { |v| singleton_class.include(v) }
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/patches'
4
+ require 'eac_ruby_base0/core_ext'
@@ -1,33 +1,25 @@
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 'avm/core_ext'
5
4
  require 'avm/docker/registry'
6
5
 
7
6
  module Avm
8
7
  module Docker
9
- class Runner < ::EacRubyUtils::Console::DocoptRunner
8
+ class Runner
10
9
  enable_console_speaker
11
10
  enable_simple_cache
12
11
 
13
- DOC = <<~DOCOPT
14
- Manipulate Docker images.
15
-
16
- Usage:
17
- __PROGRAM__ [options] [-B <build-arg>...] [-E <run-arg>...]
18
- __PROGRAM__ -h | --help
19
-
20
- Options:
21
- -h --help Show this help.
22
- -n --registry-name=<registry-name> Docker registry's name.
23
- -p --push Push the image to Docker registry.
24
- -r --run Run or start a container with builded image.
25
- -B --build-arg=<build-arg> Argument for "docker build".
26
- -E --entrypoint-arg=<run-arg> Argument for entrypoint on "docker run"
27
- -c --clear Remove container if exist before run.
28
- -S --no-snapshot Does not add "-snapshot" to image tag.
29
- -V --no-version Does not add version to image tag.
30
- DOCOPT
12
+ runner_with :help do
13
+ desc 'Manipulate Docker images.'
14
+ arg_opt '-n', '--registry-name', 'Docker registry\'s name.'
15
+ bool_opt '-p', '--push', 'Push the image to Docker registry.'
16
+ bool_opt '-r', '--run', 'Run or start a container with builded image.'
17
+ arg_opt '-B', '--build-arg', 'Argument for "docker build".', repeat: true
18
+ arg_opt '-E', '--entrypoint-arg', 'Argument for entrypoint on "docker run"', repeat: true
19
+ bool_opt '-c', '--clear', 'Remove container if exist before run.'
20
+ bool_opt '-S', '--no-snapshot', 'Does not add "-snapshot" to image tag.'
21
+ bool_opt '-V', '--no-version', 'Does not add version to image tag.'
22
+ end
31
23
 
32
24
  def run
33
25
  setup
@@ -61,42 +53,42 @@ module Avm
61
53
  end
62
54
 
63
55
  def build_args
64
- options.fetch('--build-arg')
56
+ parsed.build_arg
65
57
  end
66
58
 
67
59
  def entrypoint_args
68
- options.fetch('--entrypoint-arg')
60
+ parsed.entrypoint_arg
69
61
  end
70
62
 
71
63
  def push
72
- instance.docker_image.push if options.fetch('--push')
64
+ instance.docker_image.push if parsed.push?
73
65
  end
74
66
 
75
67
  def container_run
76
- return unless options.fetch('--run')
68
+ return unless parsed.run?
77
69
 
78
70
  instance.docker_container.run(
79
71
  entrypoint_args: entrypoint_args,
80
- clear: options.fetch('--clear')
72
+ clear: parsed.clear?
81
73
  )
82
74
  end
83
75
 
84
76
  def registry_uncached
85
- options.fetch('--registry-name').if_present(::Avm::Docker::Registry.default) do |v|
77
+ parsed.registry_name.if_present(::Avm::Docker::Registry.default) do |v|
86
78
  ::Avm::Docker::Registry.new(v)
87
79
  end
88
80
  end
89
81
 
90
82
  def snapshot?
91
- !options.fetch('--no-snapshot')
83
+ !parsed.no_snapshot?
92
84
  end
93
85
 
94
86
  def version?
95
- !options.fetch('--no-version')
87
+ !parsed.no_version?
96
88
  end
97
89
 
98
90
  def instance
99
- context(:instance)
91
+ runner_context.call(:instance)
100
92
  end
101
93
  end
102
94
  end
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_webapp_base0/deploy'
4
- require 'avm/eac_asciidoctor_base0/project'
5
- require 'avm/eac_asciidoctor_base0/build'
4
+ require 'avm/eac_asciidoctor_base0/sources/base'
5
+ require 'avm/eac_asciidoctor_base0/sources/build'
6
6
 
7
7
  module Avm
8
8
  module EacAsciidoctorBase0
9
9
  class Deploy < ::Avm::EacWebappBase0::Deploy
10
10
  def build_content
11
- ::Avm::EacAsciidoctorBase0::Build.new(
11
+ ::Avm::EacAsciidoctorBase0::Sources::Build.new(
12
12
  project,
13
- ::Avm::EacAsciidoctorBase0::Build::OPTION_TARGET_DIRECTORY => build_dir
13
+ ::Avm::EacAsciidoctorBase0::Sources::Build::OPTION_TARGET_DIRECTORY => build_dir
14
14
  ).run
15
15
  end
16
16
 
17
17
  private
18
18
 
19
19
  def project_uncached
20
- ::Avm::EacAsciidoctorBase0::Project.new(
20
+ ::Avm::EacAsciidoctorBase0::Sources::Base.new(
21
21
  instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
22
22
  )
23
23
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_rails_base1/runner_with/bundle'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
  require 'shellwords'
7
6
 
8
7
  module Avm
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'avm/eac_rails_base1/runner_with/bundle'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
6
5
 
7
6
  module Avm
8
7
  module EacRailsBase1
@@ -3,7 +3,6 @@
3
3
  require 'avm/eac_rails_base1/runner_with/bundle'
4
4
  require 'avm/instances/entry_keys'
5
5
  require 'eac_cli/core_ext'
6
- require 'eac_ruby_utils/console/docopt_runner'
7
6
  require 'shellwords'
8
7
 
9
8
  module Avm
@@ -9,6 +9,7 @@ require 'avm/eac_webapp_base0/deploy/file_unit'
9
9
  module Avm
10
10
  module EacWebappBase0
11
11
  class Instance < ::Avm::Instances::Base
12
+ require_sub __FILE__
12
13
  include ::Avm::Postgresql::InstanceWith
13
14
 
14
15
  FILES_UNITS = [].freeze
@@ -26,8 +27,10 @@ module Avm
26
27
  end
27
28
 
28
29
  def run_subcommand(subcommand_class, argv)
29
- parent = ::OpenStruct.new(instance: self)
30
- subcommand_class.new(argv: argv, parent: parent).run
30
+ subcommand_class.create(
31
+ argv: argv,
32
+ parent: ::Avm::EacWebappBase0::Instance::SubcommandParent.new(self)
33
+ ).run
31
34
  end
32
35
 
33
36
  def data_package
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ class Instance < ::Avm::Instances::Base
8
+ class SubcommandParent
9
+ enable_simple_cache
10
+ common_constructor :instance
11
+
12
+ private
13
+
14
+ def runner_context_uncached
15
+ ::EacCli::Runner::Context.new(self, argv: runner_argv)
16
+ end
17
+
18
+ def runner_argv
19
+ [instance.class.name.split('::')[-2].dasherize, instance.id]
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -9,6 +9,7 @@ module Avm
9
9
  require_sub __FILE__
10
10
  runner_with :help, :subcommands do
11
11
  desc 'Data utilities for EacRailsBase0 instances.'
12
+ subcommands
12
13
  end
13
14
  end
14
15
  end
@@ -15,7 +15,7 @@ module Avm
15
15
 
16
16
  runner_with :help do
17
17
  desc 'Dump utility for EacRailsBase instance.'
18
- bool_opt '-w', 'rewrite', 'Forces dump overwrite.'
18
+ bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
19
19
  arg_opt '-p', '--dump-path', 'Set DUMP_PATH variable.'
20
20
  end
21
21
 
@@ -9,7 +9,7 @@ module Avm
9
9
  class Runner < ::Avm::Instances::Runner
10
10
  class Data
11
11
  class Load
12
- runner_with :ĥelp do
12
+ runner_with :help do
13
13
  desc 'Load utility for EacRailsBase instance.'
14
14
  arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
15
15
  pos_arg :dump_path, optional: true
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/instances/configuration'
3
+ require 'avm/apps/sources/configuration'
4
4
  require 'avm/result'
5
5
  require 'eac_ruby_utils/fs/temp'
6
6
 
@@ -35,7 +35,7 @@ module Avm
35
35
  end
36
36
 
37
37
  def configuration_uncached
38
- ::Avm::Instances::Configuration.find_by_path(@git)
38
+ ::Avm::Apps::Sources::Configuration.find_by_path(@git)
39
39
  end
40
40
  end
41
41
  end
@@ -3,16 +3,13 @@
3
3
  require 'eac_ruby_utils/require_sub'
4
4
  require 'eac_ruby_utils/simple_cache'
5
5
  require 'avm/instances/entries'
6
- require 'avm/instances/entry_keys'
7
- ::EacRubyUtils.require_sub(__FILE__)
8
6
 
9
7
  module Avm
10
8
  module Instances
11
9
  class Base
12
- include ::EacRubyUtils::Listable
13
- include ::EacRubyUtils::SimpleCache
14
- include ::Avm::Instances::Base::AutoValues
15
- include ::Avm::Instances::Base::Dockerizable
10
+ enable_listable
11
+ enable_simple_cache
12
+ require_sub __FILE__, include_modules: true
16
13
  include ::Avm::Instances::Entries
17
14
 
18
15
  lists.add_string :access, :local, :ssh
@@ -36,11 +33,8 @@ module Avm
36
33
  end
37
34
  end
38
35
 
39
- attr_reader :application, :suffix
40
-
41
- def initialize(application, suffix)
42
- @application = application
43
- @suffix = suffix.to_s
36
+ common_constructor :application, :suffix do
37
+ self.suffix = suffix.to_s
44
38
  end
45
39
 
46
40
  def id
@@ -63,7 +57,7 @@ module Avm
63
57
  private
64
58
 
65
59
  def source_instance_uncached
66
- ::Avm::Instances::Base.by_id(read_entry(::Avm::Instances::EntryKeys::SOURCE_INSTANCE_ID))
60
+ ::Avm::Instances::Base.by_id(source_instance_id)
67
61
  end
68
62
  end
69
63
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/entry_keys'
4
+
5
+ module Avm
6
+ module Instances
7
+ class Base
8
+ module EntryKeys
9
+ ::Avm::Instances::EntryKeys.all.each do |key|
10
+ define_method key.to_s.variableize do
11
+ read_entry(key)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/core_ext'
4
+
5
+ module Avm
6
+ module Launcher
7
+ module Instances
8
+ class RunnerHelper
9
+ def context
10
+ @context ||= ::EacLauncher::Context.current
11
+ end
12
+
13
+ def find_instances(instance_name)
14
+ context.instances.select { |instance| instance_match?(instance, instance_name) }
15
+ end
16
+
17
+ def instance_match?(instance, instance_name)
18
+ ::File.fnmatch?(instance_name, instance.name)
19
+ end
20
+
21
+ def instances
22
+ if parsed.all?
23
+ context.instances
24
+ elsif parsed.pending?
25
+ context.pending_instances
26
+ else
27
+ parsed.instance_path.flat_map { |p| find_instances(p) }
28
+ end
29
+ end
30
+
31
+ def instance_stereotypes(instance)
32
+ instance.stereotypes.map(&:label).join(', ')
33
+ end
34
+
35
+ def instance_label(instance)
36
+ "#{instance.name} [#{instance_stereotypes(instance)}]"
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub(__FILE__)