avm-tools 0.104.0 → 0.108.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/instances/entry.rb +3 -3
  3. data/lib/avm/launcher/context/instance_collector.rb +46 -0
  4. data/lib/avm/launcher/instances/runner_helper.rb +21 -15
  5. data/lib/avm/launcher/paths/logical.rb +5 -0
  6. data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +2 -2
  7. data/lib/avm/ruby/rubocop/_configured.rb +2 -2
  8. data/lib/avm/tools/app_src.rb +68 -0
  9. data/lib/avm/tools/runner/app_src/info.rb +16 -2
  10. data/lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock/git.rb +62 -0
  11. data/lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock.rb +11 -41
  12. data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +2 -4
  13. data/lib/avm/tools/runner/app_src.rb +2 -2
  14. data/lib/avm/tools/runner/config/load_path.rb +10 -5
  15. data/lib/avm/tools/runner/git/deploy.rb +2 -2
  16. data/lib/avm/tools/runner/launcher/instances.rb +7 -5
  17. data/lib/avm/tools/runner/launcher/projects.rb +2 -4
  18. data/lib/avm/tools/runner/launcher/publish.rb +2 -6
  19. data/lib/avm/tools/runner.rb +0 -4
  20. data/lib/avm/tools/version.rb +1 -1
  21. data/vendor/avm/avm.gemspec +3 -0
  22. data/{lib → vendor/avm/lib}/avm/data/instance/files_unit.rb +0 -0
  23. data/{lib → vendor/avm/lib}/avm/data/instance/package.rb +0 -0
  24. data/{lib → vendor/avm/lib}/avm/data/instance/unit.rb +0 -0
  25. data/{lib → vendor/avm/lib}/avm/data/instance.rb +0 -0
  26. data/{lib → vendor/avm/lib}/avm/data/package/dump.rb +0 -0
  27. data/{lib → vendor/avm/lib}/avm/data/package/load.rb +0 -0
  28. data/{lib → vendor/avm/lib}/avm/data/package.rb +0 -0
  29. data/{lib → vendor/avm/lib}/avm/data/unit.rb +0 -0
  30. data/vendor/avm/lib/avm/files/formatter/formats/base.rb +2 -2
  31. data/vendor/avm/lib/avm/files/formatter/formats/javascript.rb +1 -0
  32. data/vendor/avm/lib/avm/files/formatter/formats/php.rb +1 -0
  33. data/vendor/avm/lib/avm/files/formatter/formats/python.rb +1 -0
  34. data/vendor/avm/lib/avm/files/formatter/formats/xml.rb +1 -0
  35. data/vendor/avm/lib/avm/files/formatter/utf8_assert.rb +3 -1
  36. data/vendor/avm/lib/avm/git/issue/complete/test.rb +2 -2
  37. data/vendor/avm/lib/avm/git/revision_test.rb +2 -3
  38. data/vendor/avm/lib/avm/jobs/base.rb +62 -0
  39. data/vendor/avm/lib/avm/jobs/variables_source.rb +22 -0
  40. data/vendor/{avm-apps/lib/avm/apps.rb → avm/lib/avm/jobs.rb} +1 -1
  41. data/{lib → vendor/avm/lib}/avm/path_string.rb +0 -0
  42. data/vendor/avm/lib/avm/sources/base.rb +45 -0
  43. data/vendor/avm/lib/avm/sources/configuration/_locale.rb +16 -0
  44. data/vendor/avm/lib/avm/sources/configuration/_rubocop.rb +24 -0
  45. data/vendor/avm/lib/avm/sources/configuration/_tests.rb +27 -0
  46. data/vendor/avm/lib/avm/sources/configuration.rb +55 -0
  47. data/{lib/avm/eac_asciidoctor_base0.rb → vendor/avm/lib/avm/sources.rb} +1 -1
  48. data/{lib → vendor/avm/lib}/avm/sync.rb +0 -0
  49. data/vendor/avm/lib/avm/version.rb +1 -1
  50. data/vendor/avm/spec/lib/avm/git/auto_commit_path_spec.rb +4 -3
  51. data/vendor/avm/spec/lib/avm/git/commit/diff_tree_line_spec.rb +0 -1
  52. data/vendor/avm/spec/rubocop_spec.rb +1 -1
  53. data/vendor/avm/spec/spec_helper.rb +2 -17
  54. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  55. data/vendor/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb +1 -1
  56. data/vendor/avm-eac_asciidoctor_base0/spec/spec_helper.rb +2 -100
  57. data/vendor/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  58. data/vendor/avm-eac_rails_base1/spec/rubocop_spec.rb +1 -1
  59. data/vendor/avm-eac_rails_base1/spec/spec_helper.rb +2 -100
  60. data/vendor/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +3 -1
  61. data/vendor/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/core_update.rb +3 -2
  62. data/vendor/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  63. data/vendor/avm-eac_redmine_base0/spec/rubocop_spec.rb +1 -1
  64. data/vendor/avm-eac_redmine_base0/spec/spec_helper.rb +2 -100
  65. data/vendor/avm-eac_redmine_base0/template/avm/eac_redmine_base0/deploy/config/install.sh.template +1 -0
  66. data/vendor/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_host.rb +2 -2
  67. data/vendor/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/apache_path.rb +2 -2
  68. data/vendor/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/deploy.rb +2 -2
  69. data/vendor/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  70. data/vendor/avm-eac_webapp_base0/spec/rubocop_spec.rb +1 -1
  71. data/vendor/avm-eac_webapp_base0/spec/spec_helper.rb +2 -100
  72. data/vendor/eac_cli/eac_cli.gemspec +3 -3
  73. data/vendor/eac_cli/lib/eac_cli/config.rb +6 -3
  74. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +1 -1
  75. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +9 -1
  76. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +6 -0
  77. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +3 -3
  78. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  79. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +6 -5
  80. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -1
  81. data/vendor/eac_cli/spec/spec_helper.rb +2 -101
  82. data/vendor/eac_config/eac_config.gemspec +2 -2
  83. data/vendor/eac_config/lib/eac_config/version.rb +1 -1
  84. data/vendor/eac_config/spec/rubocop_spec.rb +1 -1
  85. data/vendor/eac_config/spec/spec_helper.rb +2 -15
  86. data/vendor/eac_docker/eac_docker.gemspec +2 -2
  87. data/vendor/eac_docker/lib/eac_docker/container.rb +7 -3
  88. data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +4 -0
  89. data/vendor/eac_docker/lib/eac_docker/rspec/setup.rb +17 -0
  90. data/vendor/eac_docker/lib/eac_docker/rspec.rb +2 -10
  91. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  92. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -1
  93. data/vendor/eac_docker/spec/spec_helper.rb +2 -104
  94. data/vendor/{avm-apps → eac_fs}/Gemfile +0 -0
  95. data/vendor/eac_fs/eac_fs.gemspec +20 -0
  96. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb → eac_fs/lib/eac_fs/cache.rb} +7 -2
  97. data/{lib/avm → vendor/eac_fs/lib/eac_fs}/cached_download.rb +4 -4
  98. data/vendor/eac_fs/lib/eac_fs/file_info.rb +29 -0
  99. data/vendor/eac_fs/lib/eac_fs/patches/module/fs_cache.rb +10 -0
  100. data/vendor/eac_fs/lib/eac_fs/patches/module.rb +4 -0
  101. data/vendor/eac_fs/lib/eac_fs/patches/object/fs_cache.rb +15 -0
  102. data/vendor/eac_fs/lib/eac_fs/patches/object.rb +4 -0
  103. data/vendor/eac_fs/lib/eac_fs/patches/pathname/info.rb +12 -0
  104. data/vendor/eac_fs/lib/eac_fs/patches/pathname.rb +4 -0
  105. data/vendor/eac_fs/lib/eac_fs/patches.rb +4 -0
  106. data/vendor/eac_fs/lib/eac_fs/version.rb +5 -0
  107. data/vendor/eac_fs/lib/eac_fs.rb +7 -0
  108. data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/filesystem_cache_spec.rb → eac_fs/spec/lib/eac_fs/cache_spec.rb} +2 -2
  109. data/vendor/eac_fs/spec/rubocop_spec.rb +3 -0
  110. data/vendor/eac_fs/spec/spec_helper.rb +4 -0
  111. data/vendor/eac_git/eac_git.gemspec +3 -3
  112. data/vendor/eac_git/lib/eac_git/local/commit/archive.rb +1 -1
  113. data/vendor/eac_git/lib/eac_git/local/commit.rb +3 -3
  114. data/vendor/eac_git/lib/eac_git/local.rb +13 -0
  115. data/vendor/eac_git/lib/eac_git/rspec/setup.rb +23 -0
  116. data/vendor/eac_git/lib/eac_git/rspec.rb +1 -14
  117. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  118. data/vendor/eac_git/spec/rubocop_spec.rb +1 -1
  119. data/vendor/eac_git/spec/spec_helper.rb +2 -104
  120. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +5 -4
  121. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +4 -4
  122. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +1 -0
  123. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +16 -7
  124. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  125. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -1
  126. data/vendor/eac_ruby_base0/spec/spec_helper.rb +2 -101
  127. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +2 -2
  128. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +0 -5
  129. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  130. data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +1 -1
  131. data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +2 -101
  132. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  133. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/compact.rb +22 -0
  134. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +15 -3
  135. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +75 -0
  136. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +35 -0
  137. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/compact.rb +20 -0
  138. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/delimited.rb +16 -0
  139. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/recursive_builder.rb +51 -0
  140. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/default_setup.rb +20 -0
  141. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup/conditionals.rb +17 -0
  142. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb +12 -0
  143. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup_manager.rb +49 -0
  144. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/string_delimited.rb +70 -0
  145. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  146. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/compact_spec.rb +20 -0
  147. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/compact_spec.rb +20 -0
  148. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/string/delimited_spec.rb +34 -0
  149. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/recursive_builder_spec.rb +65 -0
  150. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -1
  151. data/vendor/eac_ruby_utils/spec/spec_helper.rb +6 -6
  152. data/vendor/eac_templates/lib/eac_templates/patches/module/erb_template.rb +9 -0
  153. data/vendor/eac_templates/lib/eac_templates/patches/module.rb +4 -0
  154. data/vendor/eac_templates/lib/eac_templates/patches/object/erb_template.rb +9 -0
  155. data/vendor/eac_templates/lib/eac_templates/patches/object.rb +4 -0
  156. data/vendor/eac_templates/lib/eac_templates/patches.rb +4 -0
  157. data/vendor/eac_templates/lib/eac_templates/version.rb +1 -1
  158. data/vendor/eac_templates/spec/rubocop_spec.rb +1 -1
  159. data/vendor/eac_templates/spec/spec_helper.rb +2 -100
  160. metadata +72 -198
  161. data/lib/avm/app_src.rb +0 -61
  162. data/lib/avm/fs_cache.rb +0 -11
  163. data/lib/avm/patches/object/fs_cache.rb +0 -16
  164. data/vendor/avm/lib/avm/files/info.rb +0 -24
  165. data/vendor/avm-apps/avm-apps.gemspec +0 -18
  166. data/vendor/avm-apps/lib/avm/apps/config.rb +0 -19
  167. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +0 -64
  168. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +0 -24
  169. data/vendor/avm-apps/lib/avm/apps/jobs.rb +0 -11
  170. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +0 -18
  171. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +0 -26
  172. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +0 -29
  173. data/vendor/avm-apps/lib/avm/apps/sources/configuration.rb +0 -57
  174. data/vendor/avm-apps/lib/avm/apps/version.rb +0 -7
  175. data/vendor/avm-apps/spec/rubocop_spec.rb +0 -3
  176. data/vendor/avm-apps/spec/spec_helper.rb +0 -103
  177. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +0 -12
  178. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb +0 -35
  179. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/stubbed_ssh.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4585c23cae62880e31d062cc01fbef21cd4736371756e717eaef78ddf16291bc
4
- data.tar.gz: 7f45edf7e390d0ca3fbaf0de62ce51820090d9fc1fe5e692b9e6c0a6624efb3a
3
+ metadata.gz: f2aa6c6cff787569f6631e98dc1bb02e19e37358bffabdd12c770af457e4bf50
4
+ data.tar.gz: e324057b567e115c8449e3db04e82cf51955020539779e2d4928ede0338592c2
5
5
  SHA512:
6
- metadata.gz: 1fa3e825fae8f70e9defcb19e44252ecd10872cf250fe043dfb8a6e40a5ccd12f6ce159f94afe602ad23a435e2e8ed84381d165f6498cb85ecfb6cdd3efe9033
7
- data.tar.gz: 426f5496fe6e1701dc078f02ccd038d932a09fc362da23a89c9ce1e883ba0a515e1562031d0faaf0c817717a4fc92899af8820484297e0b183f860df33036f8d
6
+ metadata.gz: b8b1b1fd688eef382e3d483ffa6fa5af94bc6d334c944d2772774b55eacd87c63f56306121fe58e8e4254c4e09e3cf3d055b1c941991ce30cd418096418dba0e
7
+ data.tar.gz: 81e7f566f5cc5e0a202440343b3318b934d15258cb02662ab39fe708b458cac5365e07d01b05834da0263840e1e49b86283534139ebbb4f582f4ff11499b729f
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/apps/config'
3
+ require 'eac_config/node'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
@@ -31,7 +31,7 @@ module Avm
31
31
  end
32
32
 
33
33
  def read(extra_options = {})
34
- ::Avm::Apps::Config.current.entry(full_path, options.merge(extra_options)).value
34
+ ::EacConfig::Node.context.current.entry(full_path, options.merge(extra_options)).value
35
35
  end
36
36
 
37
37
  def suffix_as_array
@@ -47,7 +47,7 @@ module Avm
47
47
  end
48
48
 
49
49
  def write(value)
50
- ::Avm::Apps::Config.current.entry(full_path).value = value
50
+ ::EacConfig::Node.context.current.entry(full_path).value = value
51
51
  end
52
52
  end
53
53
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Launcher
7
+ class Context
8
+ class InstanceCollector
9
+ common_constructor :context
10
+
11
+ def add_all
12
+ instances_set.merge(context.instances)
13
+ self
14
+ end
15
+
16
+ def add_path(path)
17
+ instances_set.merge(instances_on_path(path))
18
+ self
19
+ end
20
+
21
+ def add_pending
22
+ instances_set.merge(context.pending_instances)
23
+ self
24
+ end
25
+
26
+ def instances
27
+ instances_set.sort
28
+ end
29
+
30
+ private
31
+
32
+ def instance_match?(instance, instance_name)
33
+ ::File.fnmatch?(instance_name, instance.name)
34
+ end
35
+
36
+ def instances_on_path(path)
37
+ context.instances.select { |instance| instance_match?(instance, path) }
38
+ end
39
+
40
+ def instances_set
41
+ @instances_set ||= ::Set.new
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,31 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/launcher/context'
3
4
  require 'avm/tools/core_ext'
5
+ require 'avm/launcher/context/instance_collector'
4
6
 
5
7
  module Avm
6
8
  module Launcher
7
9
  module Instances
8
- class RunnerHelper
9
- def context
10
- @context ||= ::Avm::Launcher::Context.current
11
- end
10
+ module RunnerHelper
11
+ common_concern do
12
+ runner_definition do
13
+ bool_opt '--all', 'Select all instances.'
14
+ bool_opt '--pending', 'Select pending instances.'
15
+ bool_opt '--recache', 'Rewrite instances cache.'
16
+ end
12
17
 
13
- def find_instances(instance_name)
14
- context.instances.select { |instance| instance_match?(instance, instance_name) }
18
+ set_callback :run, :before, :setup_cache
15
19
  end
16
20
 
17
- def instance_match?(instance, instance_name)
18
- ::File.fnmatch?(instance_name, instance.name)
21
+ def context
22
+ @context ||= ::Avm::Launcher::Context.current
19
23
  end
20
24
 
21
25
  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
26
+ collector = ::Avm::Launcher::Context::InstanceCollector.new(context)
27
+ collector.add_all if parsed.all?
28
+ collector.add_pending if parsed.pending?
29
+ parsed.instance_path.flat_map { |p| collector.add_path(p) }
30
+ collector.instances
29
31
  end
30
32
 
31
33
  def instance_stereotypes(instance)
@@ -35,6 +37,10 @@ module Avm
35
37
  def instance_label(instance)
36
38
  "#{instance.name} [#{instance_stereotypes(instance)}]"
37
39
  end
40
+
41
+ def setup_cache
42
+ ::Avm::Launcher::Context.current.recache = parsed.recache?
43
+ end
38
44
  end
39
45
  end
40
46
  end
@@ -7,6 +7,7 @@ module Avm
7
7
  module Launcher
8
8
  module Paths
9
9
  class Logical
10
+ include ::Comparable
10
11
  include ::EacRubyUtils::SimpleCache
11
12
 
12
13
  class << self
@@ -25,6 +26,10 @@ module Avm
25
26
  @logical = logical
26
27
  end
27
28
 
29
+ def <=>(other)
30
+ [logical, real] <=> [other.logical, other.real]
31
+ end
32
+
28
33
  def to_s
29
34
  logical
30
35
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/apps/sources/configuration'
3
+ require 'avm/sources/configuration'
4
4
  require 'eac_ruby_gems_utils/gem'
5
5
  require 'eac_ruby_utils/core_ext'
6
6
 
@@ -13,7 +13,7 @@ module Avm
13
13
  private
14
14
 
15
15
  def configuration_uncached
16
- ::Avm::Apps::Sources::Configuration.find_in_path(root)
16
+ ::Avm::Sources::Configuration.find_in_path(root)
17
17
  end
18
18
 
19
19
  def gemfile_path_uncached
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/apps/sources/configuration'
3
+ require 'avm/sources/configuration'
4
4
 
5
5
  module Avm
6
6
  module Ruby
@@ -22,7 +22,7 @@ module Avm
22
22
  private
23
23
 
24
24
  def configuration_uncached
25
- ::Avm::Apps::Sources::Configuration.find_by_path(base_path)
25
+ ::Avm::Sources::Configuration.find_by_path(base_path)
26
26
  end
27
27
  end
28
28
  end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/base'
4
+ require 'avm/sources/configuration'
5
+ require 'avm/launcher/paths/real'
6
+ require 'avm/projects/stereotype/job_comparator'
7
+ require 'eac_ruby_utils/core_ext'
8
+ require 'avm/projects/stereotypes'
9
+ require 'i18n'
10
+
11
+ module Avm
12
+ module Tools
13
+ class AppSrc
14
+ enable_simple_cache
15
+ common_constructor :path do
16
+ self.path = path.to_pathname
17
+ source_stereotypes_mixins
18
+ end
19
+
20
+ delegate :to_s, to: :path
21
+
22
+ def locale
23
+ configuration.if_present(&:locale) || ::I18n.default_locale
24
+ end
25
+
26
+ # Backward compatibility with [Avm::Launcher::Paths::Logical].
27
+ # @return [Avm::Launcher::Paths::Real].
28
+ def real
29
+ ::Avm::Launcher::Paths::Real.new(path.to_path)
30
+ end
31
+
32
+ def run_job(job, job_args = [])
33
+ stereotypes_jobs(job, job_args).each(&:run)
34
+ end
35
+
36
+ private
37
+
38
+ def avm_instance_uncached
39
+ ::Avm::Sources::Base.new(path)
40
+ end
41
+
42
+ # @return [Avm::Sources::Configuration]
43
+ def configuration_uncached
44
+ ::Avm::Sources::Configuration.find_in_path(path)
45
+ end
46
+
47
+ def stereotypes_jobs(job, job_args)
48
+ job_class_method = "#{job}_class"
49
+ r = []
50
+ stereotypes.each do |stereotype|
51
+ r << stereotype.send(job_class_method).new(self, *job_args) if
52
+ stereotype.send(job_class_method).present?
53
+ end
54
+ r.sort { |a, b| ::Avm::Projects::Stereotype::JobComparator.new(a, b).result }
55
+ end
56
+
57
+ def stereotypes_uncached
58
+ ::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
59
+ end
60
+
61
+ def source_stereotypes_mixins
62
+ stereotypes.each do |s|
63
+ s.local_project_mixin_module.if_present { |v| singleton_class.include(v) }
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -12,8 +12,22 @@ module Avm
12
12
  end
13
13
 
14
14
  def run
15
- infov 'Path', runner_context.call(:instance).path
16
- infov 'Stereotypes', runner_context.call(:instance).stereotypes.map(&:label).join(', ')
15
+ infov 'Path', instance.path
16
+ infov 'Stereotypes', instance.stereotypes.map(&:label).join(', ')
17
+ show_subs
18
+ end
19
+
20
+ private
21
+
22
+ def show_subs
23
+ infov 'Sub applications', instance.avm_instance.subs.count
24
+ instance.avm_instance.subs.each do |subapp|
25
+ infov ' * ', subapp.relative_path
26
+ end
27
+ end
28
+
29
+ def instance
30
+ runner_context.call(:instance)
17
31
  end
18
32
  end
19
33
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/core_ext'
4
+
5
+ module Avm
6
+ module Tools
7
+ class Runner
8
+ class AppSrc
9
+ class Ruby
10
+ class Bundler
11
+ class GemfileLock
12
+ module Git
13
+ private
14
+
15
+ def git_continue
16
+ return unless check_capability(__method__, :git_repo, :continue)
17
+
18
+ infom "Adding \"#{gemfile_lock}\"..."
19
+ instance.git_repo.command('add', gemfile_lock).execute!
20
+ if rebase_conflict?
21
+ git_continue_run('rebase')
22
+ elsif cherry_conflict?
23
+ git_continue_run('cherry-pick')
24
+ else
25
+ raise 'Unknown how to continue'
26
+ end
27
+ end
28
+
29
+ def git_continue_run(command)
30
+ infom "\"#{command}\" --continue..."
31
+ cmd = instance.git_repo.command(command, '--continue')
32
+ .envvar('GIT_EDITOR', 'true')
33
+ return unless !cmd.system && !conflict?
34
+
35
+ fatal_error "\"#{cmd}\" failed and there is no conflict"
36
+ end
37
+
38
+ def git_reset_checkout
39
+ return unless check_capability(__method__, :git_repo, nil)
40
+
41
+ git_reset_gemfile_lock
42
+ git_checkout_gemfile_lock
43
+ end
44
+
45
+ def git_checkout_gemfile_lock
46
+ infom 'Checkouting...'
47
+ instance.git_repo.command('checkout', '--', gemfile_lock).system!
48
+ end
49
+
50
+ def git_reset_gemfile_lock
51
+ infom 'Reseting...'
52
+ instance.git_repo.command('reset', gemfile_lock).system! if
53
+ ::File.exist?(gemfile_lock)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -9,18 +9,21 @@ module Avm
9
9
  class Ruby
10
10
  class Bundler
11
11
  class GemfileLock
12
+ require_sub __FILE__, include_modules: true
12
13
  runner_with :help do
13
14
  desc 'Manipulage a "Gemfile.lock" file.'
14
15
  bool_opt '-c', '--continue', 'Continue Git rebase/cherry-pick.'
15
16
  bool_opt '-i', '--install', 'Run "bundle install".'
16
17
  bool_opt '-u', '--update', 'Run "bundle update".'
17
18
  bool_opt '-r', '--recursive', 'Run until Git rebase/cherry-pick is finished.'
18
- bool_opt '-a', '--all', 'Same as "-ciru".'
19
+ bool_opt '-a', '--all', 'Same as "-cirud".'
20
+ bool_opt '-d', '--delete', 'Delete Gemfile.lock'
19
21
  end
20
22
 
21
23
  def run
22
24
  loop do
23
25
  git_reset_checkout
26
+ delete_gemfile_lock
24
27
  bundle_update
25
28
  bundle_install
26
29
  git_continue
@@ -34,17 +37,14 @@ module Avm
34
37
  !option_or_all?(:recursive) || !conflict?
35
38
  end
36
39
 
37
- def rebasing?
38
- instance.git_repo.root_path.join('.git', 'rebase-merge').exist?
39
- end
40
+ def delete_gemfile_lock
41
+ return unless check_capability(__method__, nil, :delete)
40
42
 
41
- def git_reset_checkout
42
- return unless check_capability(__method__, :git_repo, nil)
43
+ ::FileUtils.rm_f(gemfile_lock)
44
+ end
43
45
 
44
- infom 'Reseting...'
45
- instance.git_repo.command('reset', gemfile_lock).system!
46
- infom 'Checkouting...'
47
- instance.git_repo.command('checkout', '--', gemfile_lock).system!
46
+ def rebasing?
47
+ instance.git_repo.root_path.join('.git', 'rebase-merge').exist?
48
48
  end
49
49
 
50
50
  def bundle_install
@@ -61,44 +61,14 @@ module Avm
61
61
  bundle_run('update')
62
62
  end
63
63
 
64
- def git_continue
65
- return unless check_capability(__method__, :git_repo, :continue)
66
-
67
- infom "Adding \"#{gemfile_lock}\"..."
68
- instance.git_repo.command('add', gemfile_lock).execute!
69
- if rebase_conflict?
70
- git_continue_run('rebase')
71
- elsif cherry_conflict?
72
- git_continue_run('cherry-pick')
73
- else
74
- raise 'Unknown how to continue'
75
- end
76
- end
77
-
78
- def git_continue_run(command)
79
- infom "\"#{command}\" --continue..."
80
- cmd = instance.git_repo.command(command, '--continue').envvar('GIT_EDITOR', 'true')
81
- return unless !cmd.system && !conflict?
82
-
83
- fatal_error "\"#{cmd}\" failed and there is no conflict"
84
- end
85
-
86
64
  def gemfile_lock
87
65
  'Gemfile.lock'
88
66
  end
89
67
 
90
- def git_uncached
91
- ::EacGit::Local.new(git_path)
92
- end
93
-
94
68
  def bundle_run(*args)
95
69
  instance.ruby_gem.bundle(*args).system!
96
70
  end
97
71
 
98
- def git_path
99
- '.'
100
- end
101
-
102
72
  def conflict?
103
73
  rebase_conflict? || cherry_conflict?
104
74
  end
@@ -121,7 +91,7 @@ module Avm
121
91
 
122
92
  def check_capability(caller, capability, option)
123
93
  return false unless option.blank? || option_or_all?(option)
124
- return true if instance.respond_to?(capability)
94
+ return true if capability.if_present(true) { |v| instance.respond_to?(v) }
125
95
 
126
96
  warn "Cannot run #{caller}: instance has no capability \"#{capability}\""
127
97
  false
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/fs_cache'
4
3
  require 'avm/ruby/bundler/incompatible_parser'
5
4
  require 'eac_ruby_base0/core_ext'
6
5
 
@@ -36,9 +35,8 @@ module Avm
36
35
  fs_cache.content_path
37
36
  end
38
37
 
39
- def fs_cache_uncached
40
- ::Avm.fs_cache.child(self.class.name.variableize)
41
- .child(instance.path.to_s.variableize)
38
+ def fs_cache_object_id
39
+ instance.path.to_s.variableize
42
40
  end
43
41
 
44
42
  def gem_title(gem_in_conflict)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/app_src'
3
+ require 'avm/tools/app_src'
4
4
  require 'eac_cli/core_ext'
5
5
 
6
6
  module Avm
@@ -22,7 +22,7 @@ module Avm
22
22
  private
23
23
 
24
24
  def instance_uncached
25
- ::Avm::AppSrc.new(instance_path)
25
+ ::Avm::Tools::AppSrc.new(instance_path)
26
26
  end
27
27
 
28
28
  def instance_path_uncached
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/apps/config'
4
3
  require 'avm/self'
5
4
  require 'avm/tools/core_ext'
5
+ require 'eac_config/node'
6
+ require 'eac_ruby_utils/recursive_builder'
6
7
 
7
8
  module Avm
8
9
  module Tools
@@ -15,15 +16,19 @@ module Avm
15
16
  end
16
17
 
17
18
  def run
18
- run_show
19
+ config_nodes.each { |config_node| run_show(config_node) }
19
20
  run_add
20
21
  end
21
22
 
22
23
  private
23
24
 
24
25
  # @return [[EacCli::Config]]
25
- def config_node
26
- ::Avm::Apps::Config.current
26
+ def root_config_node
27
+ ::EacConfig::Node.context.current
28
+ end
29
+
30
+ def config_nodes
31
+ ::EacRubyUtils::RecursiveBuilder.new(root_config_node, &:self_loaded_nodes).result
27
32
  end
28
33
 
29
34
  def run_add
@@ -34,7 +39,7 @@ module Avm
34
39
  end
35
40
  end
36
41
 
37
- def run_show
42
+ def run_show(config_node)
38
43
  infov 'Configuration path', config_node.url
39
44
  infov 'Paths included', config_node.self_loaded_nodes.count
40
45
  config_node.self_loaded_nodes.each do |loaded_node|
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/apps/config'
4
3
  require 'avm/launcher/git/base'
5
4
  require 'avm/git/commit'
5
+ require 'eac_config/node'
6
6
 
7
7
  module Avm
8
8
  module Tools
@@ -91,7 +91,7 @@ module Avm
91
91
  end
92
92
 
93
93
  def variables_source
94
- instance || ::Avm::Apps::Config.current
94
+ instance || ::EacConfig::Node.context.current
95
95
  end
96
96
 
97
97
  def instance_uncached
@@ -6,16 +6,14 @@ module Avm
6
6
  module Tools
7
7
  class Runner
8
8
  class Launcher
9
- class Instances < ::Avm::Launcher::Instances::RunnerHelper
10
- runner_with :help do
9
+ class Instances
10
+ runner_with :help, ::Avm::Launcher::Instances::RunnerHelper do
11
11
  desc 'Mostra informações sobre instâncias.'
12
- bool_opt '--recache', 'Rewrite instances cache.'
13
- bool_opt '--all', 'Get all instances.'
12
+ bool_opt '-e', '--extra', 'Show instances\' extra data.'
14
13
  pos_arg :instance_path, repeat: true, optional: true
15
14
  end
16
15
 
17
16
  def run
18
- ::Avm::Launcher::Context.current.recache = parsed.recache?
19
17
  instances.each { |i| show_instance(i) }
20
18
  end
21
19
 
@@ -23,6 +21,10 @@ module Avm
23
21
 
24
22
  def show_instance(instance)
25
23
  puts instance_label(instance)
24
+ show_instance_extra(instance) if parsed.extra?
25
+ end
26
+
27
+ def show_instance_extra(instance)
26
28
  infov(' * Parent', (instance.parent ? instance_label(instance.parent) : '-'))
27
29
  infov(' * Git current revision', instance.options.git_current_revision)
28
30
  infov(' * Git publish remote', instance.options.git_publish_remote)
@@ -7,15 +7,13 @@ module Avm
7
7
  module Tools
8
8
  class Runner
9
9
  class Launcher
10
- class Projects < ::Avm::Launcher::Instances::RunnerHelper
11
- runner_with :help do
10
+ class Projects
11
+ runner_with :help, ::Avm::Launcher::Instances::RunnerHelper do
12
12
  desc 'Shows available projects.'
13
- bool_opt '--recache', 'Rewrite instances cache.'
14
13
  bool_opt '-i', '--instances', 'Show instances.'
15
14
  end
16
15
 
17
16
  def run
18
- ::Avm::Launcher::Context.current.recache = parsed.recache?
19
17
  ::Avm::Launcher::Context.current.projects.each do |p|
20
18
  show_project(p)
21
19
  end
@@ -6,21 +6,17 @@ module Avm
6
6
  module Tools
7
7
  class Runner
8
8
  class Launcher
9
- class Publish < ::Avm::Launcher::Instances::RunnerHelper
10
- runner_with :help do
9
+ class Publish
10
+ runner_with :help, ::Avm::Launcher::Instances::RunnerHelper do
11
11
  desc 'Publica projetos ou instâncias.'
12
- bool_opt '--all', 'Get all instances.'
13
12
  bool_opt '-d', '--dry-run', '"Dry run" publishing.'
14
13
  bool_opt '--new', 'Publish projects not published before.'
15
- bool_opt '--pending', 'Publish only pending.'
16
- bool_opt '--recache', 'Rewrite instances cache.'
17
14
  bool_opt '--run', 'Confirm publishing.'
18
15
  arg_opt '-s', '--stereotype', 'Publish only for stereotype <stereotype>.'
19
16
  pos_arg :instance_path, repeat: true, optional: true
20
17
  end
21
18
 
22
19
  def run
23
- ::Avm::Launcher::Context.current.recache = parsed.recache?
24
20
  build_publish_options
25
21
  instances.each do |i|
26
22
  next unless i.options.publishable?
@@ -17,10 +17,6 @@ module Avm
17
17
  def application
18
18
  ::Avm::Self.application
19
19
  end
20
-
21
- def run
22
- ::Avm::Apps::Config.context.on(::Avm::Self.build_config) { super }
23
- end
24
20
  end
25
21
  end
26
22
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.104.0'
5
+ VERSION = '0.108.0'
6
6
  end
7
7
  end
@@ -16,6 +16,9 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency 'eac_git', '~> 0.6'
17
17
  s.add_dependency 'eac_ruby_utils', '~> 0.68'
18
18
  s.add_dependency 'eac_templates', '~> 0.1', '>= 0.1.1'
19
+ s.add_dependency 'filesize', '~> 0.2'
20
+ s.add_dependency 'htmlbeautifier', '~> 1.3', '>= 1.3.1'
21
+ s.add_dependency 'minitar', '~> 0.9'
19
22
 
20
23
  s.add_development_dependency 'aranha-parsers', '~> 0.7', '>= 0.7.2'
21
24
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
File without changes
File without changes