avm-tools 0.94.1 → 0.97.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) 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_asciidoctor_base0/deploy.rb +5 -5
  5. data/lib/avm/eac_webapp_base0/instance.rb +5 -2
  6. data/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
  7. data/lib/avm/eac_webapp_base0/runner/data.rb +1 -0
  8. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
  9. data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
  10. data/lib/avm/git/issue/complete/_test.rb +2 -2
  11. data/lib/avm/instances/base.rb +6 -12
  12. data/lib/avm/instances/base/entry_keys.rb +17 -0
  13. data/lib/{eac_launcher → avm/launcher}/instances/error.rb +0 -0
  14. data/lib/avm/launcher/instances/runner_helper.rb +42 -0
  15. data/lib/avm/patches/class.rb +4 -0
  16. data/lib/avm/patches/eac_ruby_gems_utils.rb +4 -0
  17. data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +2 -2
  18. data/lib/avm/patches/object.rb +4 -0
  19. data/lib/avm/patches/object/fs_cache.rb +16 -0
  20. data/lib/avm/ruby/bundler.rb +11 -0
  21. data/lib/avm/ruby/bundler/incompatible_parser.rb +25 -0
  22. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +25 -0
  23. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +39 -0
  24. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +19 -0
  25. data/lib/avm/ruby/bundler/incompatible_parser/line_buffer.rb +73 -0
  26. data/lib/avm/ruby/bundler/incompatible_parser/line_factory.rb +31 -0
  27. data/lib/avm/ruby/bundler/incompatible_parser/line_parser_base.rb +19 -0
  28. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +26 -0
  29. data/lib/avm/ruby/gems/generator.rb +1 -5
  30. data/lib/avm/ruby/rubocop/_configured.rb +2 -2
  31. data/lib/avm/tools/runner/{local_project.rb → app_src.rb} +3 -3
  32. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0.rb +1 -1
  33. data/lib/avm/tools/runner/{local_project → app_src}/eac_asciidoctor_base0/build.rb +19 -7
  34. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0.rb +1 -1
  35. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_chapters.rb +1 -1
  36. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/build_single.rb +1 -1
  37. data/lib/avm/tools/runner/{local_project → app_src}/eac_writings_base0/info.rb +1 -1
  38. data/lib/avm/tools/runner/{local_project → app_src}/info.rb +1 -1
  39. data/lib/avm/tools/runner/{local_project → app_src}/ruby.rb +1 -1
  40. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler.rb +4 -8
  41. data/lib/avm/tools/runner/{local_project → app_src}/ruby/bundler/gemfile_lock.rb +11 -14
  42. data/lib/avm/tools/runner/app_src/ruby/bundler/incompatible.rb +84 -0
  43. data/lib/avm/tools/runner/{local_project → app_src}/test.rb +1 -1
  44. data/lib/avm/tools/runner/{local_project → app_src}/update.rb +1 -1
  45. data/lib/avm/tools/runner/{local_project → app_src}/version_bump.rb +1 -1
  46. data/lib/avm/tools/runner/launcher.rb +3 -6
  47. data/lib/avm/tools/runner/launcher/instances.rb +10 -21
  48. data/lib/avm/tools/runner/launcher/projects.rb +10 -18
  49. data/lib/avm/tools/runner/launcher/publish.rb +18 -26
  50. data/lib/avm/tools/runner/ruby/rubocop.rb +9 -25
  51. data/lib/avm/tools/runner/self.rb +7 -15
  52. data/lib/avm/tools/runner/self/docker.rb +1 -1
  53. data/lib/avm/tools/version.rb +1 -1
  54. data/lib/eac_launcher/instances.rb +1 -1
  55. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +1 -5
  56. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +2 -0
  57. data/vendor/avm-apps/avm-apps.gemspec +1 -1
  58. data/vendor/avm-apps/lib/avm/apps/sources/configuration.rb +57 -0
  59. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +18 -0
  60. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +26 -0
  61. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +29 -0
  62. data/vendor/avm-apps/lib/avm/apps/version.rb +1 -1
  63. data/vendor/avm-apps/spec/rubocop_spec.rb +1 -5
  64. data/vendor/avm-apps/spec/spec_helper.rb +3 -0
  65. data/vendor/avm-eac_asciidoctor_base0/Gemfile +5 -0
  66. data/vendor/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +19 -0
  67. data/{lib/avm/local_projects.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0.rb} +1 -1
  68. data/{lib/avm/eac_asciidoctor_base0/project.rb → vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb} +2 -4
  69. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +15 -0
  70. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb +49 -0
  71. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +30 -0
  72. data/vendor/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +7 -0
  73. data/vendor/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb +3 -0
  74. data/vendor/avm-eac_asciidoctor_base0/spec/spec_helper.rb +102 -0
  75. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  76. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +5 -1
  77. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +3 -1
  78. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
  79. data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
  80. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  81. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
  82. data/vendor/eac_cli/spec/spec_helper.rb +3 -0
  83. data/vendor/eac_docker/eac_docker.gemspec +1 -1
  84. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  85. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
  86. data/vendor/eac_docker/spec/spec_helper.rb +3 -0
  87. data/vendor/eac_git/eac_git.gemspec +2 -1
  88. data/vendor/eac_git/lib/eac_git/local.rb +4 -0
  89. data/vendor/eac_git/lib/eac_git/local/commit.rb +53 -0
  90. data/vendor/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
  91. data/vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
  92. data/vendor/eac_git/lib/eac_git/rspec.rb +6 -1
  93. data/{lib/avm/git/spec_helper.rb → vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb} +16 -13
  94. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  95. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
  96. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
  97. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
  98. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
  99. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
  100. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
  101. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
  102. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
  103. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
  104. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
  105. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
  106. data/vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
  107. data/vendor/eac_git/spec/rubocop_spec.rb +1 -5
  108. data/vendor/eac_git/spec/spec_helper.rb +3 -0
  109. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
  110. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
  111. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
  112. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  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 +4 -3
  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/patches/kernel/nyi.rb +4 -2
  128. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
  129. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
  130. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
  131. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
  132. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
  133. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +18 -5
  134. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  135. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
  136. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +9 -0
  137. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
  138. data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
  139. metadata +90 -39
  140. data/lib/avm/eac_asciidoctor_base0/build.rb +0 -47
  141. data/lib/avm/eac_asciidoctor_base0/build/file.rb +0 -28
  142. data/lib/avm/instances/configuration.rb +0 -55
  143. data/lib/avm/instances/configuration/_locale.rb +0 -16
  144. data/lib/avm/instances/configuration/_rubocop.rb +0 -24
  145. data/lib/avm/instances/configuration/_tests.rb +0 -27
  146. data/lib/avm/local_projects/instance.rb +0 -62
  147. data/lib/eac_launcher/instances/runner_helper.rb +0 -42
  148. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
  149. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_git/local'
4
+ require 'eac_git/local/commit'
5
+ require 'tmpdir'
6
+
7
+ RSpec.describe ::EacGit::Local::Commit, git: true do
8
+ let(:git) { stubbed_git_local_repo }
9
+
10
+ let(:first_commit_sha1) do
11
+ git.file('a.txt').write('AAA')
12
+ git.file('b.txt').write('BBB')
13
+ git.command('add', '.').execute!
14
+ git.command('commit', '-m', 'First commit.').execute!
15
+ git.rev_parse('HEAD')
16
+ end
17
+
18
+ let(:second_commit_sha1) do
19
+ first_commit_sha1
20
+ git.file('a.txt').write('AAAAA')
21
+ git.file('b.txt').delete
22
+ git.file('ç.txt').write('CCC')
23
+ git.command('add', '.').execute!
24
+ git.command('commit', '-m', 'Second commit.').execute!
25
+ git.rev_parse('HEAD')
26
+ end
27
+
28
+ let(:first_commit) { described_class.new(git, first_commit_sha1) }
29
+ let(:second_commit) { described_class.new(git, second_commit_sha1) }
30
+
31
+ describe '#changed_files' do
32
+ it { expect(first_commit.changed_files.count).to eq(2) }
33
+ it { expect(second_commit.changed_files.count).to eq(3) }
34
+
35
+ {
36
+ 'first_commit' => %w[a.txt b.txt],
37
+ 'second_commit' => %w[a.txt b.txt ç.txt]
38
+ }.each do |commit_name, filenames|
39
+ filenames.each do |filename|
40
+ it "find file \"#{filename}\" in commit \"#{commit_name}\"" do
41
+ commit = send(commit_name)
42
+ file = commit.changed_files.find { |f| f.path == filename }
43
+ expect(file).to be_a(::EacGit::Local::Commit::ChangedFile)
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ describe '#changed_files_size' do
50
+ it { expect(first_commit.changed_files_size).to eq(6) }
51
+ it { expect(second_commit.changed_files_size).to eq(8) }
52
+ end
53
+
54
+ describe '#root_child?' do
55
+ it { expect(first_commit.root_child?).to eq(true) }
56
+ it { expect(second_commit.root_child?).to eq(false) }
57
+ end
58
+ 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,7 +97,10 @@ 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
+ require 'eac_ruby_gem_support/rspec'
101
+ ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
100
102
  end
101
103
 
102
104
  require 'eac_git/rspec'
103
105
  ::EacGit::Rspec.configure
106
+ require 'aranha/parsers/spec/source_target_fixtures_example'
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'eac_cli', '~> 0.7'
16
- s.add_dependency 'eac_ruby_gems_utils', '~> 0.7', '>= 0.7.2'
17
- s.add_dependency 'eac_ruby_utils', '~> 0.46'
15
+ s.add_dependency 'eac_cli', '~> 0.15', '>= 0.15.1'
16
+ s.add_dependency 'eac_ruby_gems_utils', '~> 0.8'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.60'
18
18
 
19
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
20
20
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/abstract_methods'
6
+
7
+ module EacRubyBase0
8
+ module RunnerWith
9
+ module Input
10
+ STDIN_OPTION = '-'
11
+ BLANK_OPTION = '+'
12
+ DEFAULT_DEFAULT_INPUT_OPTION = BLANK_OPTION
13
+
14
+ common_concern do
15
+ enable_settings_provider
16
+ include ::EacCli::Runner
17
+
18
+ runner_definition do
19
+ arg_opt '-i', '--input', 'Input from file.'
20
+ end
21
+ end
22
+
23
+ def input_content
24
+ case input_option
25
+ when STDIN_OPTION then $stdin.read
26
+ when BLANK_OPTION then ''
27
+ else input_option.to_pathname.read
28
+ end
29
+ end
30
+
31
+ def input_option
32
+ parsed.input || setting_value(:default_input_option, default: DEFAULT_DEFAULT_INPUT_OPTION)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/abstract_methods'
6
+
7
+ module EacRubyBase0
8
+ module RunnerWith
9
+ module Output
10
+ STDOUT_OPTION = '-'
11
+ DEFAULT_FILE_OPTION = '+'
12
+ DEFAULT_DEFAULT_OUTPUT_OPTION = STDOUT_OPTION
13
+ DEFAULT_DEFAULT_FILE_TO_OUTPUT = 'output'
14
+
15
+ common_concern do
16
+ enable_abstract_methods
17
+ enable_settings_provider
18
+ include ::EacCli::Runner
19
+
20
+ abstract_methods :output_content
21
+
22
+ runner_definition do
23
+ arg_opt '-o', '--output', 'Output to file.'
24
+ end
25
+ end
26
+
27
+ def run_output
28
+ file = file_to_output
29
+ if file
30
+ file.to_pathname.write(output_content)
31
+ else
32
+ $stdout.write(output_content)
33
+ end
34
+ end
35
+
36
+ def output_option
37
+ parsed.output || default_output_option_value
38
+ end
39
+
40
+ def file_to_output
41
+ case output_option
42
+ when STDOUT_OPTION then nil
43
+ when DEFAULT_FILE_OPTION then default_file_to_output_value
44
+ else output_option
45
+ end
46
+ end
47
+
48
+ def default_output_option_value
49
+ setting_value(:default_output_option,
50
+ default: DEFAULT_DEFAULT_OUTPUT_OPTION)
51
+ end
52
+
53
+ def default_file_to_output_value
54
+ setting_value(:default_file_to_output, default: DEFAULT_DEFAULT_FILE_TO_OUTPUT)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.5.0'
4
+ VERSION = '0.7.1'
5
5
  end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/runner_with/output'
4
+ require 'eac_ruby_utils/fs/temp'
5
+
6
+ RSpec.describe ::EacRubyBase0::RunnerWith::Output do
7
+ let(:runner) do
8
+ the_module = described_class
9
+ Class.new do
10
+ include the_module
11
+
12
+ attr_accessor :temp_dir
13
+
14
+ runner_definition do
15
+ desc 'A stub root runner.'
16
+ pos_arg :input_text
17
+ end
18
+
19
+ def run
20
+ run_output
21
+ end
22
+
23
+ def output_content
24
+ parsed.input_text
25
+ end
26
+
27
+ def default_file_to_output
28
+ temp_dir.join('default_file')
29
+ end
30
+ end
31
+ end
32
+
33
+ let(:stub_text) { 'STUB_TEXT' }
34
+ let(:instance) do
35
+ r = runner.create(argv: runner_argv)
36
+ r.temp_dir = temp_dir
37
+ r
38
+ end
39
+ let(:temp_dir) { ::EacRubyUtils::Fs::Temp.directory }
40
+
41
+ after { temp_dir.remove }
42
+
43
+ context 'without --output option' do
44
+ let(:runner_argv) { [stub_text] }
45
+
46
+ it do
47
+ expect { instance.run }.to output(stub_text).to_stdout_from_any_process
48
+ end
49
+ end
50
+
51
+ context 'without --output option as to stdout' do
52
+ let(:runner_argv) { ['--output', ::EacRubyBase0::RunnerWith::Output::STDOUT_OPTION, stub_text] }
53
+
54
+ it do
55
+ expect { instance.run }.to output(stub_text).to_stdout_from_any_process
56
+ end
57
+ end
58
+
59
+ context 'without --output option as to default file' do
60
+ let(:output_file) { temp_dir.join('default_file') }
61
+ let(:runner_argv) do
62
+ ['--output', ::EacRubyBase0::RunnerWith::Output::DEFAULT_FILE_OPTION,
63
+ stub_text]
64
+ end
65
+
66
+ before { instance.run }
67
+
68
+ it { expect(output_file).to exist }
69
+ it { expect(output_file.read).to eq(stub_text) }
70
+ end
71
+
72
+ context 'with --output option' do
73
+ let(:output_file) { temp_dir.join('a output file') }
74
+ let(:runner_argv) { ['--output', output_file.to_path, stub_text] }
75
+
76
+ before { instance.run }
77
+
78
+ it { expect(output_file).to exist }
79
+ it { expect(output_file.read).to eq(stub_text) }
80
+ end
81
+ 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
@@ -19,11 +19,12 @@ Gem::Specification.new do |s|
19
19
  s.rdoc_options = ['--charset=UTF-8']
20
20
 
21
21
  s.require_paths = ['lib']
22
- s.files = `git ls-files`.split("\n")
23
- s.test_files = `git ls-files spec examples`.split("\n")
22
+ s.files = Dir['{lib}/**/*', 'Gemfile']
23
+ s.test_files = Dir['{spec}/**/*', '.rspec']
24
24
 
25
+ s.add_dependency 'bundler', '~> 2.2', '>= 2.2.17'
25
26
  s.add_dependency 'eac_ruby_utils', '~> 0.29'
26
27
 
27
28
  # Tests
28
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1'
29
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
29
30
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/fs/logs'
4
5
  require 'eac_ruby_utils/fs_cache'
5
6
  require 'eac_ruby_utils/listable'
6
7
  require 'eac_ruby_utils/on_clean_ruby_environment'
@@ -27,20 +28,16 @@ module EacRubyGemsUtils
27
28
  self.class.name.demodulize.gsub(/Test\z/, '')
28
29
  end
29
30
 
30
- def stdout_cache
31
- root_cache.child('stdout')
32
- end
33
-
34
- def stderr_cache
35
- root_cache.child('stderr')
36
- end
37
-
38
31
  def to_s
39
32
  "#{gem}[#{name}]"
40
33
  end
41
34
 
42
35
  private
43
36
 
37
+ def logs_uncached
38
+ ::EacRubyUtils::Fs::Logs.new.add(:stdout).add(:stderr)
39
+ end
40
+
44
41
  def result_uncached
45
42
  return RESULT_NONEXISTENT unless elegible?
46
43
 
@@ -53,8 +50,8 @@ module EacRubyGemsUtils
53
50
 
54
51
  def exec_run_with_log
55
52
  r = exec_run
56
- stdout_cache.write(r[:stdout])
57
- stderr_cache.write(r[:stderr])
53
+ logs[:stdout].write(r[:stdout])
54
+ logs[:stderr].write(r[:stderr])
58
55
  r[:exit_code].zero?
59
56
  end
60
57
 
@@ -27,6 +27,12 @@ module EacRubyGemsUtils
27
27
  decorated_gems.flat_map(&:tests)
28
28
  end
29
29
 
30
+ def clear_logs
31
+ all_tests.each do |test|
32
+ test.logs.remove_all
33
+ end
34
+ end
35
+
30
36
  def prepare_all_gems
31
37
  infom 'Preparing all gems...'
32
38
  decorated_gems.each(&:prepare)
@@ -47,8 +53,7 @@ module EacRubyGemsUtils
47
53
  warn 'Some test did not pass:'
48
54
  failed_tests.each do |test|
49
55
  infov ' * Test', test
50
- infov ' * STDOUT', test.stdout_cache.content_path
51
- infov ' * STDERR', test.stderr_cache.content_path
56
+ info test.logs.truncate_all
52
57
  end
53
58
  else
54
59
  success 'All tests passed'
@@ -60,6 +65,8 @@ module EacRubyGemsUtils
60
65
  prepare_all_gems
61
66
  test_all_gems
62
67
  final_results_banner
68
+ ensure
69
+ clear_logs
63
70
  end
64
71
 
65
72
  def start_banner
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyGemsUtils
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.2'
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 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
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency 'addressable', '~> 2.6'
20
20
  s.add_dependency 'colorize', '~> 0.8.1'
21
21
  s.add_dependency 'docopt', '~> 0.6.1'
22
+ s.add_dependency 'filesize'
22
23
  s.add_dependency 'net-ssh', '~> 4.2'
23
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.1'
24
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
24
25
  end
@@ -24,6 +24,12 @@ module EacRubyUtils
24
24
  ::File.read(content_path)
25
25
  end
26
26
 
27
+ def read_or_cache
28
+ write(yield) unless cached?
29
+
30
+ read
31
+ end
32
+
27
33
  def write(value)
28
34
  assert_directory_on_path
29
35
  ::File.write(content_path, value)