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
@@ -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 '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::Instances::Configuration.find_in_path(root)
16
+ ::Avm::Apps::Sources::Configuration.find_in_path(root)
17
17
  end
18
18
 
19
19
  def gemfile_path_uncached
@@ -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
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/gem_conflict'
5
+ require 'avm/ruby/bundler/incompatible_parser/line_factory'
6
+
7
+ module Avm
8
+ module Ruby
9
+ module Bundler
10
+ class IncompatibleParser
11
+ class LineBuffer
12
+ class << self
13
+ def from_file(path)
14
+ new(::File.read(path.to_s))
15
+ end
16
+ end
17
+
18
+ attr_reader :gems_in_conflict
19
+
20
+ def initialize(content)
21
+ self.gems_in_conflict = []
22
+ self.parsing_required = false
23
+ content.each_line { |string_line| add_line(LineFactory.new(string_line)) }
24
+ end
25
+
26
+ private
27
+
28
+ attr_accessor :parsing_required
29
+ attr_writer :gems_in_conflict
30
+
31
+ def add_line(line)
32
+ return if line.blank?
33
+
34
+ return if LineFactory::TYPES.any? do |type|
35
+ next false unless line.result.is_a?(type)
36
+
37
+ send("on_#{type.name.demodulize.underscore.variableize}_line", line.result)
38
+ true
39
+ end
40
+
41
+ return unless parsing_required
42
+
43
+ raise(::ArgumentError, "Unparsed line: \"#{line.content}\"")
44
+ end
45
+
46
+ def on_gem_conflict_line(result)
47
+ self.parsing_required = true
48
+ gems_in_conflict << result
49
+ end
50
+
51
+ def on_in_gemfile_line(result)
52
+ # Do nothing
53
+ end
54
+
55
+ def on_depends_on_line(result)
56
+ current_gem_conflict.add_depends_on(result)
57
+ end
58
+
59
+ def on_version_requirement_line(result)
60
+ current_gem_conflict.add_version_requirement(result)
61
+ end
62
+
63
+ def current_gem_conflict
64
+ raise 'No gems in conflict' if gems_in_conflict.none?
65
+ raise 'Last gem is blank' if gems_in_conflict.last.blank?
66
+
67
+ gems_in_conflict.last
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/ruby/bundler/incompatible_parser/depends_on'
5
+ require 'avm/ruby/bundler/incompatible_parser/gem_conflict'
6
+ require 'avm/ruby/bundler/incompatible_parser/in_gemfile'
7
+
8
+ module Avm
9
+ module Ruby
10
+ module Bundler
11
+ class IncompatibleParser
12
+ class LineFactory
13
+ TYPES = [GemConflict, InGemfile, DependsOn, VersionRequirement].freeze
14
+
15
+ enable_simple_cache
16
+ common_constructor :content do
17
+ self.content = content.strip
18
+ end
19
+
20
+ delegate :blank?, to: :content
21
+
22
+ private
23
+
24
+ def result_uncached
25
+ TYPES.lazy.map { |type| type.parse(content) }.find(&:present?)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,19 @@
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
+ class LineParserBase
10
+ class << self
11
+ def parse(line_content)
12
+ const_get('LINE_PARSER').parse(line_content)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
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 VersionRequirement < ::Avm::Ruby::Bundler::IncompatibleParser::LineParserBase
11
+ LINE_PARSER = /\A([a-z][a-z_0-9]*)(?: \((.+)\))?\z/
12
+ .to_parser { |m| new(m[1], m[2]) }
13
+
14
+ enable_simple_cache
15
+ attr_accessor :stack
16
+
17
+ common_constructor :gem_name, :requirements_source
18
+
19
+ def data
20
+ { requirements_source: requirements_source, stack: stack.map(&:data) }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -8,7 +8,7 @@ module Avm
8
8
  module Gems
9
9
  class Generator
10
10
  IDENT = ' '
11
- JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock rspec].freeze
11
+ JOBS = %w[root_directory gemspec root_lib version_lib static gemfile_lock].freeze
12
12
  TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
13
13
 
14
14
  enable_console_speaker
@@ -92,10 +92,6 @@ module Avm
92
92
  template_apply('root_lib', "lib/#{lib_path}.rb")
93
93
  end
94
94
 
95
- def generate_rspec
96
- self_gem.bundle('exec', 'rspec').chdir_root.execute!
97
- end
98
-
99
95
  def generate_static
100
96
  template.child('static').apply(self, root_directory)
101
97
  end
@@ -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
 
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::Instances::Configuration.find_by_path(base_path)
25
+ ::Avm::Apps::Sources::Configuration.find_by_path(base_path)
26
26
  end
27
27
  end
28
28
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/local_projects/instance'
3
+ require 'avm/app_src'
4
4
  require 'eac_cli/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Tools
8
8
  class Runner
9
- class LocalProject
9
+ class AppSrc
10
10
  require_sub __FILE__
11
11
  runner_with :help, :subcommands do
12
12
  desc 'Utilities for local projects.'
@@ -22,7 +22,7 @@ module Avm
22
22
  private
23
23
 
24
24
  def instance_uncached
25
- ::Avm::LocalProjects::Instance.new(instance_path)
25
+ ::Avm::AppSrc.new(instance_path)
26
26
  end
27
27
 
28
28
  def instance_path_uncached
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_asciidoctor_base0/sources/runner'
4
+
5
+ module Avm
6
+ module Tools
7
+ class Runner
8
+ class AppSrc
9
+ class EacAsciidoctorBase0 < ::Avm::EacAsciidoctorBase0::Sources::Runner
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,37 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_asciidoctor_base0/build'
4
- require 'avm/eac_asciidoctor_base0/project'
5
- require 'eac_cli/core_ext'
6
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'avm/core_ext'
4
+ require 'avm/eac_asciidoctor_base0/sources/build'
5
+ require 'os'
7
6
 
8
7
  module Avm
9
8
  module Tools
10
9
  class Runner
11
- class LocalProject
10
+ class AppSrc
12
11
  class EacAsciidoctorBase0
13
12
  class Build
14
13
  runner_with :help do
15
14
  desc 'Build the project'
16
15
  arg_opt '-d', '--target-dir', 'Directory to build'
16
+ bool_opt '--open', 'Show the result.'
17
17
  end
18
18
 
19
19
  def run
20
20
  start_banner
21
21
  build.run
22
+ open
22
23
  end
23
24
 
24
25
  private
25
26
 
26
27
  def build_uncached
27
- ::Avm::EacAsciidoctorBase0::Build.new(runner_context.call(:project),
28
- target_directory: parsed.target_dir)
28
+ ::Avm::EacAsciidoctorBase0::Sources::Build.new(runner_context.call(:project),
29
+ target_directory: parsed.target_dir)
29
30
  end
30
31
 
31
32
  def default_target_directory
32
33
  runner_context.call(:project).root.join('build')
33
34
  end
34
35
 
36
+ def open
37
+ return unless parsed.open?
38
+
39
+ infom "Opening \"#{open_path}\"..."
40
+ ::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
41
+ end
42
+
43
+ def open_path
44
+ build.source_files.first.target_path
45
+ end
46
+
35
47
  def start_banner
36
48
  runner_context.call(:project_banner)
37
49
  infov 'Target directory', build.target_directory