avm-tools 0.94.0 → 0.96.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) 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/eac_webapp_base0/instance.rb +5 -2
  5. data/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
  6. data/lib/avm/eac_webapp_base0/runner/data.rb +1 -0
  7. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
  8. data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
  9. data/lib/avm/git/file_auto_fixup.rb +12 -2
  10. data/lib/avm/instances/base.rb +6 -12
  11. data/lib/avm/instances/base/entry_keys.rb +17 -0
  12. data/lib/{eac_launcher → avm/launcher}/instances/error.rb +0 -0
  13. data/lib/avm/launcher/instances/runner_helper.rb +42 -0
  14. data/lib/avm/patches/class.rb +4 -0
  15. data/lib/avm/patches/eac_ruby_gems_utils.rb +4 -0
  16. data/lib/avm/patches/object.rb +4 -0
  17. data/lib/avm/patches/object/fs_cache.rb +16 -0
  18. data/lib/avm/ruby/bundler.rb +11 -0
  19. data/lib/avm/ruby/bundler/incompatible_parser.rb +25 -0
  20. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +25 -0
  21. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +39 -0
  22. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +19 -0
  23. data/lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb +73 -0
  24. data/lib/avm/ruby/bundler/incompatible_parser/line_factory.rb +31 -0
  25. data/lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb +19 -0
  26. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +26 -0
  27. data/lib/avm/ruby/gems/generator.rb +1 -5
  28. data/lib/avm/tools/runner/{local_project.rb → app_src.rb} +3 -3
  29. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0.rb +1 -1
  30. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0/build.rb +2 -3
  31. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0.rb +1 -1
  32. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_chapters.rb +1 -1
  33. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_single.rb +1 -1
  34. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/info.rb +1 -1
  35. data/lib/avm/tools/runner/{local_project → app_src}/info.rb +1 -1
  36. data/lib/avm/tools/runner/{local_project → app_src}/ruby.rb +3 -7
  37. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler.rb +4 -8
  38. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/gemfile_lock.rb +11 -14
  39. data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +84 -0
  40. data/lib/avm/tools/runner/{local_project → app_src}/test.rb +1 -1
  41. data/lib/avm/tools/runner/{local_project → app_src}/update.rb +1 -1
  42. data/lib/avm/tools/runner/{local_project → app_src}/version_bump.rb +1 -1
  43. data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
  44. data/lib/avm/tools/runner/launcher.rb +3 -6
  45. data/lib/avm/tools/runner/launcher/instances.rb +10 -21
  46. data/lib/avm/tools/runner/launcher/projects.rb +10 -18
  47. data/lib/avm/tools/runner/launcher/publish.rb +18 -26
  48. data/lib/avm/tools/runner/ruby/rubocop.rb +9 -25
  49. data/lib/avm/tools/runner/self.rb +7 -15
  50. data/lib/avm/tools/runner/self/docker.rb +1 -1
  51. data/lib/avm/tools/version.rb +1 -1
  52. data/lib/eac_launcher/instances.rb +1 -1
  53. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -5
  54. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -0
  55. data/vendor/avm-apps/avm-apps.gemspec +1 -1
  56. data/vendor/avm-apps/lib/avm/apps/version.rb +1 -1
  57. data/vendor/avm-apps/spec/rubocop_spec.rb +1 -5
  58. data/vendor/avm-apps/spec/spec_helper.rb +3 -0
  59. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  60. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
  61. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +5 -1
  62. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +3 -1
  63. data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
  64. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  65. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
  66. data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
  67. data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
  68. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  69. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
  70. data/vendor/eac_cli/spec/spec_helper.rb +3 -0
  71. data/vendor/eac_docker/eac_docker.gemspec +1 -1
  72. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  73. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
  74. data/vendor/eac_docker/spec/spec_helper.rb +3 -0
  75. data/vendor/eac_git/eac_git.gemspec +2 -1
  76. data/vendor/eac_git/lib/eac_git/local.rb +4 -0
  77. data/vendor/eac_git/lib/eac_git/local/commit.rb +53 -0
  78. data/vendor/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
  79. data/vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
  80. data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
  81. data/vendor/eac_git/lib/eac_git/rspec.rb +6 -1
  82. data/{lib/avm/git/spec_helper.rb → vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb} +16 -13
  83. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  84. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
  85. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
  86. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
  87. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
  88. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
  89. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
  90. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
  91. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
  92. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
  93. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
  94. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
  95. data/vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
  96. data/vendor/eac_git/spec/rubocop_spec.rb +1 -5
  97. data/vendor/eac_git/spec/spec_helper.rb +3 -0
  98. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
  99. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
  100. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
  101. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
  102. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
  103. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
  104. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
  105. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
  106. data/{lib/avm/local_projects.rb → vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb} +2 -2
  107. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
  108. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
  109. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
  110. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
  111. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  112. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
  113. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
  114. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
  115. data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
  116. data/vendor/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
  117. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +7 -10
  118. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +9 -2
  119. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  120. data/vendor/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +1 -5
  121. data/vendor/eac_ruby_gems_utils/spec/spec_helper.rb +3 -0
  122. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -1
  123. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
  124. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
  125. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
  126. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
  127. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
  128. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
  129. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
  130. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
  131. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
  132. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
  133. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
  134. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
  135. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
  136. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
  137. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
  138. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  139. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
  140. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
  141. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
  142. data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
  143. metadata +77 -32
  144. data/lib/avm/local_projects/instance.rb +0 -62
  145. data/lib/eac_launcher/instances/runner_helper.rb +0 -42
  146. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
  147. 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: d5c0c0b3a077d30739e756476f997c1d74acc2f6cbf52ba89ca55efecc87879a
4
- data.tar.gz: e26b9535c059c92e9a401db8552d33ca16f8ee38bf9743100cb61cbcf2d27c39
3
+ metadata.gz: 6ef7523f40504ec0ae7da047ae97a104ee39e70cfc7ce6a799391615e8a62acf
4
+ data.tar.gz: cc8d89ba7e4f9025fd0553f4f4d448d7b11c3a65d07ec5f46646619f7b517baa
5
5
  SHA512:
6
- metadata.gz: ce8b71b8307d328e7a8ecb64d6c860eea72a47c22a769de30c101686b7089b9e6ee1d05a932c311139e3ba554bff03fae9d091cd9c1eb97ae2cb6d8135e8ee6b
7
- data.tar.gz: eb891b911edc41e6989ab28f59f79b47e9d49ad18454cb8178a49f3e87f79f3b36206057476aa524d7a197d333228f551dfcce43553ae4aac2369382e62b94bf
6
+ metadata.gz: 06e6b348ab5fdd9c2df75c7959dc1b9ef6202e44fde8af352603c3f8883de2c5ec5abd46f0fb0f6771e7a78befdf97fd109f17c6622dffb942ae758ac54a3998
7
+ data.tar.gz: 32835edd010fc51fdd12ca6a0c85c4950c946463ec067de823f96d4bb24dc70bfae8e94fe4d1c3cfa66a882b2e8566b0ea3c79bd46ffd9c0a51edd699207deb9
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/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::Instances::Configuration]
36
+ def configuration_uncached
37
+ ::Avm::Instances::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'
@@ -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
@@ -11,7 +11,7 @@ module Avm
11
11
  enable_listable
12
12
 
13
13
  common_constructor :git, :path, :rules do
14
- self.path = path.to_pathname
14
+ self.path = path.to_pathname.expand_path(git.root_path)
15
15
  end
16
16
 
17
17
  COMMITS_SEARCH_INTERVAL = 'origin/master..HEAD'
@@ -44,11 +44,21 @@ module Avm
44
44
  return false if commit_info.blank?
45
45
 
46
46
  infov ' Commit arguments', ::Shellwords.join(commit_args)
47
- git.execute!('commit', *commit_args)
47
+ run_git_add_and_commit
48
48
  success ' Commited'
49
49
  true
50
50
  end
51
51
 
52
+ def run_git_add_and_commit
53
+ git.execute!('reset', '--soft', 'HEAD')
54
+ if path.exist?
55
+ git.execute!('add', git_relative_path)
56
+ else
57
+ git.execute!('rm', '-f', git_relative_path)
58
+ end
59
+ git.execute!('commit', *commit_args)
60
+ end
61
+
52
62
  def commits_uncached
53
63
  git.execute!('log', '--pretty=format:%H', COMMITS_SEARCH_INTERVAL, '--', path)
54
64
  .each_line.map { |sha1| ::Avm::Git::Commit.new(git, sha1.strip) }
@@ -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,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/console/docopt_runner'
4
+ require 'eac_ruby_utils/console/speaker'
5
+
6
+ module Avm
7
+ module Launcher
8
+ module Instances
9
+ class RunnerHelper < ::EacRubyUtils::Console::DocoptRunner
10
+ def context
11
+ @context ||= ::EacLauncher::Context.current
12
+ end
13
+
14
+ def find_instances(instance_name)
15
+ context.instances.select { |instance| instance_match?(instance, instance_name) }
16
+ end
17
+
18
+ def instance_match?(instance, instance_name)
19
+ ::File.fnmatch?(instance_name, instance.name)
20
+ end
21
+
22
+ def instances
23
+ if parsed.all?
24
+ context.instances
25
+ elsif parsed.pending?
26
+ context.pending_instances
27
+ else
28
+ parsed.instance_path.flat_map { |p| find_instances(p) }
29
+ end
30
+ end
31
+
32
+ def instance_stereotypes(instance)
33
+ instance.stereotypes.map(&:label).join(', ')
34
+ end
35
+
36
+ def instance_label(instance)
37
+ "#{instance.name} [#{instance_stereotypes(instance)}]"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ 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__)
@@ -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,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/self'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ class Object
7
+ class << self
8
+ def avm_fs_cache
9
+ ::Avm::Self.application.fs_cache.child(name.variableize)
10
+ end
11
+ end
12
+
13
+ def avm_fs_cache
14
+ self.class.avm_fs_cache.child(avm_fs_cache_object_id)
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Ruby
7
+ module Bundler
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Ruby
7
+ module Bundler
8
+ class IncompatibleParser
9
+ require_sub __FILE__
10
+
11
+ enable_simple_cache
12
+ attr_reader :gems_in_conflict
13
+
14
+ def initialize(path)
15
+ @gems_in_conflict = ::Avm::Ruby::Bundler::IncompatibleParser::LineBuffer
16
+ .from_file(path).gems_in_conflict.freeze
17
+ end
18
+
19
+ def data
20
+ gems_in_conflict.map(&:data)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
5
+
6
+ module Avm
7
+ module Ruby
8
+ module Bundler
9
+ class IncompatibleParser
10
+ class DependsOn < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /(.+) was resolved to (.+), which depends on/
12
+ .to_parser { |m| new(m[1], m[2]) }
13
+
14
+ common_constructor :gem_name, :version do
15
+ self.version = ::Gem::Version.new(version)
16
+ end
17
+
18
+ def data
19
+ { gem_name: gem_name, version: version }
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
5
+
6
+ module Avm
7
+ module Ruby
8
+ module Bundler
9
+ class IncompatibleParser
10
+ class GemConflict < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /Bundler could not find compatible versions for gem "(.+)":/
12
+ .to_parser { |m| new(m[1]) }
13
+
14
+ enable_simple_cache
15
+ common_constructor :gem_name
16
+
17
+ def add_depends_on(depends_on)
18
+ @depends_on_stack ||= []
19
+ @depends_on_stack << depends_on
20
+ end
21
+
22
+ def add_version_requirement(version_requirement)
23
+ version_requirement.stack = @depends_on_stack
24
+ versions_requirements << version_requirement
25
+ @depends_on_stack = nil
26
+ end
27
+
28
+ def data
29
+ { gem_name: gem_name, versions_requirements: versions_requirements.map(&:data) }
30
+ end
31
+
32
+ def versions_requirements
33
+ @versions_requirements ||= []
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/line_parser_base'
5
+
6
+ module Avm
7
+ module Ruby
8
+ module Bundler
9
+ class IncompatibleParser
10
+ class InGemfile < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /In Gemfile:/
12
+ .to_parser { |_m| new }
13
+
14
+ common_constructor
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end