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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacAsciidoctorBase0
5
+ VERSION = '0.2.0'
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43
+ # have no way to turn it off -- the option exists only for backwards
44
+ # compatibility in RSpec 3). It causes shared context metadata to be
45
+ # inherited by the metadata hash of host groups and examples, rather than
46
+ # triggering implicit auto-inclusion in groups with matching metadata.
47
+ config.shared_context_metadata_behavior = :apply_to_host_groups
48
+
49
+ # The settings below are suggested to provide a good initial experience
50
+ # with RSpec, but feel free to customize to your heart's content.
51
+ # # This allows you to limit a spec run to individual examples or groups
52
+ # # you care about by tagging them with `:focus` metadata. When nothing
53
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
54
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
55
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
56
+ # config.filter_run_when_matching :focus
57
+ #
58
+ # # Allows RSpec to persist some state between runs in order to support
59
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
60
+ # # you configure your source control system to ignore this file.
61
+ # config.example_status_persistence_file_path = "spec/examples.txt"
62
+ #
63
+ # # Limits the available syntax to the non-monkey patched syntax that is
64
+ # # recommended. For more details, see:
65
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
66
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
68
+ # config.disable_monkey_patching!
69
+ #
70
+ # # This setting enables warnings. It's recommended, but in some cases may
71
+ # # be too noisy due to issues in dependencies.
72
+ # config.warnings = true
73
+ #
74
+ # # Many RSpec users commonly either run the entire suite or an individual
75
+ # # file, and it's useful to allow more verbose output when running an
76
+ # # individual spec file.
77
+ # if config.files_to_run.one?
78
+ # # Use the documentation formatter for detailed output,
79
+ # # unless a formatter has already been configured
80
+ # # (e.g. via a command-line flag).
81
+ # config.default_formatter = "doc"
82
+ # end
83
+ #
84
+ # # Print the 10 slowest examples and example groups at the
85
+ # # end of the spec run, to help surface which specs are running
86
+ # # particularly slow.
87
+ # config.profile_examples = 10
88
+ #
89
+ # # Run specs in random order to surface order dependencies. If you find an
90
+ # # order dependency and want to debug it, you can fix the order by providing
91
+ # # the seed, which is printed after each run.
92
+ # # --seed 1234
93
+ # config.order = :random
94
+ #
95
+ # # Seed global randomization in this process using the `--seed` CLI option.
96
+ # # Setting this allows you to use `--seed` to deterministically reproduce
97
+ # # test failures related to randomization by passing the same `--seed` value
98
+ # # as the one that triggered the failure.
99
+ # Kernel.srand config.seed
100
+ require 'eac_ruby_gem_support/rspec'
101
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__))
102
+ end
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'eac_ruby_utils', '~> 0.55'
16
16
 
17
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
17
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
18
18
  end
@@ -28,7 +28,11 @@ module EacCli
28
28
  end
29
29
 
30
30
  def identifier
31
- long.to_s.variableize.to_sym
31
+ [long, short].each do |v|
32
+ v.to_s.if_present { |vv| return vv.variableize.to_sym }
33
+ end
34
+
35
+ raise 'No short or long option to build identifier'
32
36
  end
33
37
 
34
38
  def repeat?
@@ -36,7 +36,9 @@ module EacCli
36
36
  end
37
37
 
38
38
  def option_definition(option)
39
- self.class.option_usage_full(option) + OPTION_DESC_SEP + option.description
39
+ self.class.option_usage_full(option) + option.description.if_present('') do |v|
40
+ OPTION_DESC_SEP + v
41
+ end
40
42
  end
41
43
 
42
44
  def section(header, include_header = true)
@@ -27,8 +27,9 @@ module EacCli
27
27
 
28
28
  def parent_call(method_name, *args)
29
29
  return parent.context(method_name, *args) if parent.respond_to?(:context)
30
+ return parent.runner_context.call(method_name, *args) if parent.respond_to?(:runner_context)
30
31
 
31
- parent.runner_context.call(method_name, *args)
32
+ raise "Parent #{parent} do not respond to .context or .runner_context (Runner: #{runner})"
32
33
  end
33
34
  end
34
35
  end
@@ -3,15 +3,22 @@
3
3
  module EacCli
4
4
  module Runner
5
5
  module InstanceMethods
6
+ PARSER_ERROR_EXIT_CODE = 1
7
+
6
8
  def run_run
7
9
  parsed
8
10
  run_callbacks(:run) { run }
9
11
  rescue ::EacCli::Parser::Error => e
10
- $stderr.write("#{e}\n")
12
+ run_parser_error(e)
11
13
  rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException
12
14
  # Do nothing
13
15
  end
14
16
 
17
+ def run_parser_error(error)
18
+ $stderr.write("#{error}\n")
19
+ ::Kernel.exit(PARSER_ERROR_EXIT_CODE)
20
+ end
21
+
15
22
  def runner_context
16
23
  return @runner_context if @runner_context
17
24
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.15.1'
4
+ VERSION = '0.16.3'
5
5
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,4 +97,7 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
103
  end
@@ -14,5 +14,5 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency 'eac_ruby_utils', '~> 0.36'
16
16
 
17
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.1'
17
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacDocker
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_gem_support/spec/examples/rubocop_check'
4
-
5
- RSpec.describe ::RuboCop, slow: true do
6
- include_examples 'rubocop_check', ::File.expand_path('..', __dir__)
7
- end
3
+ ::EacRubyGemSupport::Rspec.default.describe_rubocop
@@ -97,6 +97,9 @@ RSpec.configure do |config|
97
97
  # # test failures related to randomization by passing the same `--seed` value
98
98
  # # as the one that triggered the failure.
99
99
  # Kernel.srand config.seed
100
+
101
+ require 'eac_ruby_gem_support/rspec'
102
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
103
  end
101
104
 
102
105
  require 'eac_docker/rspec'
@@ -15,5 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency 'eac_ruby_utils', '~> 0.37'
16
16
  s.add_dependency 'parseconfig', '~> 1.0', '>= 1.0.8'
17
17
 
18
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
18
+ s.add_development_dependency 'aranha-parsers', '~> 0.7'
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
19
20
  end
@@ -12,6 +12,10 @@ module EacGit
12
12
  self.root_path = root_path.to_pathname
13
13
  end
14
14
 
15
+ def commit(ref, required = false)
16
+ rev_parse(ref, required).if_present { |v| ::EacGit::Local::Commit.new(self, v) }
17
+ end
18
+
15
19
  def descendant?(descendant, ancestor)
16
20
  base = merge_base(descendant, ancestor)
17
21
  return false if base.blank?
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacGit
6
+ class Local
7
+ class Commit
8
+ require_sub __FILE__, include_modules: true
9
+ enable_simple_cache
10
+
11
+ FIELDS = {
12
+ author_name: '%an', author_email: '%ae', author_date: '%ai',
13
+ subject: '%s',
14
+ author_all: '%an <%ae>, %ai',
15
+ commiter_name: '%cn', commiter_email: '%ce', commiter_date: '%ci',
16
+ commiter_all: '%cn <%ce>, %ci'
17
+ }.freeze
18
+
19
+ common_constructor :repo, :hash
20
+
21
+ def format(format)
22
+ repo.command('--no-pager', 'log', '-1', "--pretty=format:#{format}", hash).execute!.strip
23
+ end
24
+
25
+ FIELDS.each do |field, format|
26
+ define_method(field) { format(format) }
27
+ end
28
+
29
+ def changed_files_uncached
30
+ diff_tree_execute.each_line.map do |line|
31
+ ::EacGit::Local::Commit::ChangedFile.new(self, line)
32
+ end
33
+ end
34
+
35
+ def changed_files_size_uncached
36
+ changed_files.inject(0) { |a, e| a + e.dst_size }
37
+ end
38
+
39
+ def root_child?
40
+ format('%P').blank?
41
+ end
42
+
43
+ private
44
+
45
+ def diff_tree_execute
46
+ args = []
47
+ args << '--root' if root_child?
48
+ args << hash
49
+ repo.command(*::EacGit::Local::Commit::DiffTreeLine::GIT_COMMAND_ARGS, *args).execute!
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_git/local/commit/diff_tree_line'
5
+
6
+ module EacGit
7
+ class Local
8
+ class Commit
9
+ class ChangedFile
10
+ enable_simple_cache
11
+
12
+ attr_reader :commit, :diff_tree
13
+
14
+ # @param commit [EacGit::Local::Commit]
15
+ # @param diff_tree_line [String] A line from command "repo diff-tree --no-commit-id -r
16
+ # --full-index"'s output.
17
+ def initialize(commit, diff_tree_line)
18
+ @commit = commit
19
+ @diff_tree = ::EacGit::Local::Commit::DiffTreeLine.new(diff_tree_line)
20
+ end
21
+
22
+ delegate(*::EacGit::Local::Commit::DiffTreeLine::FIELDS, to: :diff_tree)
23
+
24
+ def to_s
25
+ "#{path}|#{status}"
26
+ end
27
+
28
+ def src_size_uncached
29
+ size(src_sha1)
30
+ end
31
+
32
+ def dst_size_uncached
33
+ size(dst_sha1)
34
+ end
35
+
36
+ private
37
+
38
+ def size(id)
39
+ return 0 if /\A0+\z/.match(id)
40
+
41
+ commit.repo.command('cat-file', '-s', id).execute!.strip.to_i
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacGit
4
+ class Local
5
+ class Commit
6
+ class DiffTreeLine
7
+ DIFF_TREE_PATTERN = /\A:(\d{6}) (\d{6}) (\S+) (\S+) (\S+)\t(\S.*)\z/.freeze
8
+ FIELDS = %w[src_mode dst_mode src_sha1 dst_sha1 status path].freeze
9
+ GIT_COMMAND_ARGS = %w[-c core.quotepath=off diff-tree --no-commit-id -r --full-index].freeze
10
+
11
+ attr_reader(*FIELDS)
12
+
13
+ # line: a line of command "git [GIT_COMMAND_ARGS]"'s output.
14
+ # Reference: https://git-scm.com/docs/git-diff-tree
15
+ def initialize(line)
16
+ m = DIFF_TREE_PATTERN.match(line.strip)
17
+ raise "\"#{line}\" did not match pattern" unless m
18
+
19
+ FIELDS.count.times { |i| send("#{FIELDS[i]}=", m[i + 1]) }
20
+ end
21
+
22
+ def fields
23
+ FIELDS.map { |field| [field, send(field)] }.to_h
24
+ end
25
+
26
+ private
27
+
28
+ attr_writer(*FIELDS)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -5,12 +5,17 @@ require 'eac_git/executables'
5
5
 
6
6
  module EacGit
7
7
  module Rspec
8
+ require_sub __FILE__
9
+
8
10
  class << self
9
11
  def configure
10
12
  ::EacRubyUtils::Rspec::Conditional.default.add(:git) do
11
13
  ::EacGit::Executables.git.validate
12
14
  end
13
- RSpec.configure { |config| ::EacRubyUtils::Rspec::Conditional.default.configure(config) }
15
+ RSpec.configure do |config|
16
+ ::EacRubyUtils::Rspec::Conditional.default.configure(config)
17
+ config.include ::EacGit::Rspec::StubbedGitLocalRepo
18
+ end
14
19
  end
15
20
  end
16
21
  end
@@ -1,28 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_git/local'
3
4
  require 'eac_ruby_utils/envs'
4
- require 'eac_launcher/git/base'
5
5
  require 'fileutils'
6
6
  require 'tmpdir'
7
7
 
8
- module Avm
9
- module Git
10
- module SpecHelper
11
- def stubbed_git_repository(bare = false)
8
+ module EacGit
9
+ module Rspec
10
+ module StubbedGitLocalRepo
11
+ def stubbed_git_local_repo(bare = false)
12
12
  path = ::Dir.mktmpdir
13
- ::EacRubyUtils::Envs.local.command(stubbed_git_repository_args(path, bare)).execute!
14
- StubbedGitRepository.new(path)
13
+ ::EacRubyUtils::Envs.local.command(stubbed_git_local_repo_args(path, bare)).execute!
14
+ repo = StubbedGitRepository.new(path)
15
+ repo.command('config', 'user.email', 'theuser@example.net').execute!
16
+ repo.command('config', 'user.name', 'The User').execute!
17
+ repo
15
18
  end
16
19
 
17
20
  private
18
21
 
19
- def stubbed_git_repository_args(path, bare)
22
+ def stubbed_git_local_repo_args(path, bare)
20
23
  r = %w[git init]
21
24
  r << '--bare' if bare
22
25
  r + [path]
23
26
  end
24
27
 
25
- class StubbedGitRepository < ::EacLauncher::Git::Base
28
+ class StubbedGitRepository < ::EacGit::Local
26
29
  def file(*subpath)
27
30
  StubbedGitRepositoryFile.new(self, subpath)
28
31
  end
@@ -37,19 +40,19 @@ module Avm
37
40
  end
38
41
 
39
42
  def path
40
- ::File.join(git, *subpath)
43
+ git.root_path.join(*subpath)
41
44
  end
42
45
 
43
46
  def touch
44
- ::FileUtils.touch(path)
47
+ ::FileUtils.touch(path.to_path)
45
48
  end
46
49
 
47
50
  def delete
48
- ::File.unlink(path)
51
+ path.unlink
49
52
  end
50
53
 
51
54
  def write(content)
52
- ::File.write(path, content)
55
+ path.write(content)
53
56
  end
54
57
  end
55
58
  end