ehbrs-tools 0.21.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/exe/ehbrs +2 -2
  3. data/lib/ehbrs/core_ext.rb +4 -0
  4. data/lib/ehbrs/music/album.rb +2 -0
  5. data/{vendor/eac_cli/lib/eac_cli/patches/module.rb → lib/ehbrs/patches.rb} +1 -1
  6. data/lib/ehbrs/tools/runner.rb +21 -0
  7. data/lib/ehbrs/tools/runner/cooking_book.rb +32 -0
  8. data/lib/ehbrs/tools/runner/cooking_book/build.rb +52 -0
  9. data/lib/ehbrs/{runner/videos/series.rb → tools/runner/finances.rb} +4 -4
  10. data/lib/ehbrs/tools/runner/finances/bb_browser.rb +66 -0
  11. data/lib/ehbrs/tools/runner/fs.rb +18 -0
  12. data/lib/ehbrs/tools/runner/fs/selected.rb +81 -0
  13. data/lib/ehbrs/tools/runner/fs/used_space.rb +161 -0
  14. data/lib/ehbrs/tools/runner/google.rb +18 -0
  15. data/lib/ehbrs/tools/runner/google/translate.rb +89 -0
  16. data/lib/ehbrs/tools/runner/music.rb +18 -0
  17. data/lib/ehbrs/tools/runner/music/selected.rb +28 -0
  18. data/lib/ehbrs/tools/runner/self.rb +18 -0
  19. data/lib/ehbrs/tools/runner/self/test.rb +27 -0
  20. data/lib/ehbrs/tools/runner/telegram.rb +28 -0
  21. data/lib/ehbrs/tools/runner/telegram/send_message.rb +31 -0
  22. data/lib/ehbrs/tools/runner/vg.rb +18 -0
  23. data/lib/ehbrs/tools/runner/vg/ips.rb +134 -0
  24. data/lib/ehbrs/tools/runner/vg/wii.rb +74 -0
  25. data/lib/ehbrs/{runner/web_utils → tools/runner}/videos.rb +3 -3
  26. data/lib/ehbrs/tools/runner/videos/extract.rb +70 -0
  27. data/lib/ehbrs/tools/runner/videos/probe.rb +34 -0
  28. data/lib/ehbrs/tools/runner/videos/series.rb +20 -0
  29. data/lib/ehbrs/tools/runner/videos/series/rename.rb +74 -0
  30. data/lib/ehbrs/tools/runner/videos/unsupported.rb +61 -0
  31. data/lib/ehbrs/tools/runner/web_utils.rb +26 -0
  32. data/lib/ehbrs/tools/runner/web_utils/videos.rb +20 -0
  33. data/lib/ehbrs/tools/runner/web_utils/videos/download.rb +65 -0
  34. data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +77 -0
  35. data/lib/ehbrs/tools/version.rb +1 -1
  36. data/lib/ehbrs/vg/wii/game_file.rb +10 -0
  37. data/lib/ehbrs/videos/unsupported/check_support.rb +12 -8
  38. data/vendor/aranha-parsers/aranha-parsers.gemspec +2 -2
  39. data/vendor/aranha-parsers/lib/aranha/parsers/rspec.rb +11 -0
  40. data/vendor/aranha-parsers/lib/aranha/parsers/rspec/setup_include.rb +17 -0
  41. data/vendor/aranha-parsers/lib/aranha/parsers/{spec → rspec}/source_target_fixtures_example.rb +0 -0
  42. data/vendor/aranha-parsers/lib/aranha/parsers/source_address.rb +10 -8
  43. data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
  44. data/vendor/aranha-parsers/spec/lib/rubocop_check_spec.rb +1 -5
  45. data/vendor/aranha-parsers/spec/spec_helper.rb +2 -6
  46. data/vendor/aranha-selenium/aranha-selenium.gemspec +2 -2
  47. data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +1 -1
  48. data/vendor/aranha-selenium/spec/rubocop_check_spec.rb +1 -5
  49. data/vendor/aranha-selenium/spec/spec_helper.rb +2 -98
  50. data/vendor/eac_cli/eac_cli.gemspec +3 -4
  51. data/vendor/eac_cli/lib/eac_cli/config.rb +18 -0
  52. data/vendor/eac_cli/lib/eac_cli/config/entry.rb +46 -0
  53. data/vendor/eac_cli/lib/eac_cli/config/entry/options.rb +57 -0
  54. data/vendor/eac_cli/lib/eac_cli/config/entry/undefined.rb +26 -0
  55. data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +3 -2
  56. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +6 -1
  57. data/vendor/eac_cli/lib/eac_cli/old_configs.rb +0 -1
  58. data/vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +2 -2
  59. data/vendor/eac_cli/lib/eac_cli/old_configs_bridge.rb +39 -0
  60. data/vendor/eac_cli/lib/eac_cli/runner.rb +0 -2
  61. data/vendor/eac_cli/lib/eac_cli/runner/after_class_methods.rb +20 -3
  62. data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +5 -1
  63. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +9 -4
  64. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +73 -0
  65. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +56 -0
  66. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -4
  67. data/vendor/eac_cli/lib/eac_cli/speaker.rb +15 -19
  68. data/vendor/eac_cli/lib/eac_cli/speaker/_constants.rb +1 -1
  69. data/vendor/eac_cli/lib/eac_cli/speaker/list.rb +1 -1
  70. data/vendor/eac_cli/lib/eac_cli/speaker/options.rb +38 -0
  71. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  72. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +1 -1
  73. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +0 -1
  74. data/vendor/eac_cli/spec/lib/eac_cli/speaker_spec.rb +5 -9
  75. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -1
  76. data/vendor/eac_cli/spec/spec_helper.rb +2 -101
  77. data/vendor/eac_config/Gemfile +5 -0
  78. data/vendor/eac_config/eac_config.gemspec +19 -0
  79. data/vendor/eac_config/lib/eac_config.rb +7 -0
  80. data/vendor/eac_config/lib/eac_config/entry.rb +49 -0
  81. data/vendor/eac_config/lib/eac_config/entry_path.rb +41 -0
  82. data/vendor/eac_config/lib/eac_config/envvars_node.rb +25 -0
  83. data/vendor/eac_config/lib/eac_config/envvars_node/entry.rb +54 -0
  84. data/vendor/eac_config/lib/eac_config/load_nodes_search.rb +39 -0
  85. data/vendor/eac_config/lib/eac_config/load_path.rb +28 -0
  86. data/vendor/eac_config/lib/eac_config/node.rb +67 -0
  87. data/vendor/eac_config/lib/eac_config/node_entry.rb +18 -0
  88. data/vendor/eac_config/lib/eac_config/node_uri.rb +38 -0
  89. data/vendor/eac_config/lib/eac_config/old_configs.rb +75 -0
  90. data/vendor/eac_config/lib/eac_config/old_configs/base.rb +43 -0
  91. data/vendor/eac_config/lib/eac_config/old_configs/file.rb +47 -0
  92. data/vendor/eac_config/lib/eac_config/paths_hash.rb +56 -0
  93. data/vendor/eac_config/lib/eac_config/paths_hash/entry_key_error.rb +8 -0
  94. data/vendor/eac_config/lib/eac_config/paths_hash/node.rb +67 -0
  95. data/vendor/eac_config/lib/eac_config/paths_hash/path_search.rb +39 -0
  96. data/vendor/eac_config/lib/eac_config/version.rb +5 -0
  97. data/vendor/eac_config/lib/eac_config/yaml_file_node.rb +48 -0
  98. data/vendor/eac_config/lib/eac_config/yaml_file_node/entry.rb +37 -0
  99. data/vendor/eac_config/spec/lib/eac_config/entry_path_spec.rb +30 -0
  100. data/vendor/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +14 -0
  101. data/vendor/eac_config/spec/lib/eac_config/envvars_node_spec.rb +40 -0
  102. data/vendor/eac_config/spec/lib/eac_config/old_configs_spec.rb +46 -0
  103. data/vendor/eac_config/spec/lib/eac_config/paths_hash_spec.rb +88 -0
  104. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +52 -0
  105. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +6 -0
  106. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +2 -0
  107. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +4 -0
  108. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +2 -0
  109. data/vendor/eac_config/spec/rubocop_spec.rb +3 -0
  110. data/vendor/eac_config/spec/spec_helper.rb +4 -0
  111. data/vendor/eac_docker/eac_docker.gemspec +2 -2
  112. data/vendor/eac_docker/lib/eac_docker/container.rb +7 -3
  113. data/vendor/eac_docker/lib/eac_docker/debug.rb +15 -0
  114. data/vendor/eac_docker/lib/eac_docker/images/coded.rb +4 -0
  115. data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +16 -2
  116. data/vendor/eac_docker/lib/eac_docker/rspec.rb +2 -10
  117. data/vendor/eac_docker/lib/eac_docker/rspec/setup_include.rb +23 -0
  118. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  119. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -1
  120. data/vendor/eac_docker/spec/spec_helper.rb +2 -104
  121. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
  122. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +23 -9
  123. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb +34 -0
  124. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +2 -2
  125. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +19 -7
  126. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +8 -1
  127. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  128. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -1
  129. data/vendor/eac_ruby_base0/spec/spec_helper.rb +2 -101
  130. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  131. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb +1 -1
  132. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/context.rb +31 -0
  133. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb +12 -7
  134. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +15 -3
  135. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +36 -0
  136. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +39 -0
  137. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/context.rb +11 -0
  138. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb +9 -0
  139. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb +11 -0
  140. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/default_setup.rb +18 -0
  141. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb +45 -0
  142. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +10 -2
  143. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb +16 -0
  144. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +57 -0
  145. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb +32 -0
  146. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  147. data/vendor/{eac_cli/spec/lib → eac_ruby_utils/spec/lib/eac_ruby_utils/patches}/module/speaker_spec.rb +2 -2
  148. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb +33 -0
  149. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +18 -0
  150. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -1
  151. data/vendor/eac_ruby_utils/spec/spec_helper.rb +6 -6
  152. data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +4 -2
  153. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/finances/bb_browser/docker_image.rb +18 -0
  154. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/patches/object/template.rb +6 -0
  155. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
  156. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +11 -1
  157. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec.rb +13 -0
  158. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.source.yaml +28 -0
  159. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_attachment.target.yaml +7 -0
  160. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.source.yaml +49 -0
  161. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_audio.target.yaml +7 -0
  162. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.source.yaml +43 -0
  163. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_subtitle.target.yaml +7 -0
  164. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.source.yaml +59 -0
  165. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/stream_spec_files/menina_ovo_video.target.yaml +7 -0
  166. data/vendor/ehbrs_ruby_utils/spec/rubocop_check_spec.rb +1 -5
  167. data/vendor/ehbrs_ruby_utils/spec/spec_helper.rb +2 -98
  168. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Dockerfile +44 -0
  169. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Makefile +35 -0
  170. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/README.md +16 -0
  171. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/firefox.service +8 -0
  172. data/vendor/ehbrs_ruby_utils/template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/startbrowser.sh +9 -0
  173. metadata +115 -52
  174. data/lib/ehbrs/runner.rb +0 -19
  175. data/lib/ehbrs/runner/cooking_book.rb +0 -30
  176. data/lib/ehbrs/runner/cooking_book/build.rb +0 -50
  177. data/lib/ehbrs/runner/finances.rb +0 -16
  178. data/lib/ehbrs/runner/finances/bb_browser.rb +0 -35
  179. data/lib/ehbrs/runner/fs.rb +0 -16
  180. data/lib/ehbrs/runner/fs/used_space.rb +0 -160
  181. data/lib/ehbrs/runner/google.rb +0 -16
  182. data/lib/ehbrs/runner/google/translate.rb +0 -87
  183. data/lib/ehbrs/runner/music.rb +0 -16
  184. data/lib/ehbrs/runner/music/selected.rb +0 -63
  185. data/lib/ehbrs/runner/self.rb +0 -16
  186. data/lib/ehbrs/runner/self/test.rb +0 -25
  187. data/lib/ehbrs/runner/telegram.rb +0 -26
  188. data/lib/ehbrs/runner/telegram/send_message.rb +0 -29
  189. data/lib/ehbrs/runner/vg.rb +0 -16
  190. data/lib/ehbrs/runner/vg/ips.rb +0 -132
  191. data/lib/ehbrs/runner/vg/wii.rb +0 -72
  192. data/lib/ehbrs/runner/videos.rb +0 -16
  193. data/lib/ehbrs/runner/videos/extract.rb +0 -68
  194. data/lib/ehbrs/runner/videos/probe.rb +0 -32
  195. data/lib/ehbrs/runner/videos/series/rename.rb +0 -72
  196. data/lib/ehbrs/runner/videos/unsupported.rb +0 -59
  197. data/lib/ehbrs/runner/web_utils.rb +0 -24
  198. data/lib/ehbrs/runner/web_utils/videos/download.rb +0 -63
  199. data/lib/ehbrs/runner/web_utils/videos/upload.rb +0 -75
  200. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +0 -71
  201. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +0 -50
  202. data/vendor/eac_cli/lib/eac_cli/docopt/runner_context_replacement.rb +0 -15
  203. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +0 -51
  204. data/vendor/eac_cli/lib/eac_cli/docopt_runner.rb +0 -43
  205. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_class_methods.rb +0 -16
  206. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_doc.rb +0 -23
  207. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_settings.rb +0 -17
  208. data/vendor/eac_cli/lib/eac_cli/docopt_runner/_subcommands.rb +0 -152
  209. data/vendor/eac_cli/lib/eac_cli/patches/module/speaker.rb +0 -10
  210. data/vendor/eac_cli/lib/eac_cli/speaker/_class_methods.rb +0 -37
  211. data/vendor/eac_cli/lib/eac_cli/speaker/node.rb +0 -24
  212. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +0 -35
  213. data/vendor/eac_cli/spec/lib/eac_cli/docopt_runner_spec.rb +0 -136
@@ -12,6 +12,7 @@ module EacRubyBase0
12
12
  common_concern do
13
13
  include ::EacCli::Runner
14
14
  enable_settings_provider
15
+ enable_simple_cache
15
16
  runner_definition do
16
17
  bool_opt '--no', 'Deny confirmation without question.'
17
18
  bool_opt '--yes', 'Accept confirmation without question.'
@@ -22,7 +23,7 @@ module EacRubyBase0
22
23
  return false if parsed.no?
23
24
  return true if parsed.yes?
24
25
 
25
- request_input(
26
+ input(
26
27
  message || setting_value(:confirm_question_text, default: DEFAULT_CONFIRM_QUESTION_TEXT),
27
28
  bool: true
28
29
  )
@@ -31,6 +32,12 @@ module EacRubyBase0
31
32
  def run_confirm(message = nil)
32
33
  yield if confirm?(message)
33
34
  end
35
+
36
+ private
37
+
38
+ def cached_confirm_uncached?(message = nil)
39
+ confirm?(message)
40
+ end
34
41
  end
35
42
  end
36
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.7.3'
4
+ VERSION = '0.10.1'
5
5
  end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- ::EacRubyGemSupport::Rspec.default.describe_rubocop
3
+ ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,103 +1,4 @@
1
1
  # frozen_string_literal: true
2
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
-
101
- require 'eac_ruby_gem_support/rspec'
102
- ::EacRubyGemSupport::Rspec.setup(::File.expand_path('..', __dir__), config)
103
- end
3
+ require 'eac_ruby_utils/rspec/default_setup'
4
+ ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency 'addressable', '~> 2.6'
20
20
  s.add_dependency 'filesize'
21
21
  s.add_dependency 'net-ssh', '~> 4.2'
22
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
22
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.3'
23
23
  end
@@ -6,7 +6,7 @@ module EacRubyUtils
6
6
  def parse(value)
7
7
  return parse_string(value) if value.is_a?(::String)
8
8
  return parse_string(value.to_s) if value.is_a?(::Symbol)
9
- return parse_number(value) if value.is_a?(::Number)
9
+ return parse_number(value) if value.is_a?(::Numeric)
10
10
 
11
11
  value ? true : false
12
12
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRubyUtils
4
+ class Context
5
+ def current
6
+ optional_current || raise('No elements in context')
7
+ end
8
+
9
+ def optional_current
10
+ stack.last
11
+ end
12
+
13
+ delegate :pop, to: :stack
14
+ delegate :push, to: :stack
15
+
16
+ def on(obj)
17
+ push(obj)
18
+ begin
19
+ yield
20
+ ensure
21
+ pop
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def stack
28
+ @stack ||= []
29
+ end
30
+ end
31
+ end
@@ -1,16 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/context'
4
+
3
5
  module EacRubyUtils
4
- # Provides the method context which search and call a method in self and ancestor objects.
5
6
  module Contextualizable
6
- def context(method)
7
- current = self
8
- while current
9
- return current.send(method) if current.respond_to?(method)
7
+ common_concern
8
+
9
+ module ClassMethods
10
+ def context
11
+ @context ||= ::EacRubyUtils::Context.new
12
+ end
13
+ end
10
14
 
11
- current = current.respond_to?(:parent) ? current.parent : nil
15
+ module InstanceMethods
16
+ def context
17
+ self.class.context
12
18
  end
13
- raise "Context method \"#{method}\" not found for #{self.class}"
14
19
  end
15
20
  end
16
21
  end
@@ -22,7 +22,7 @@ module EacRubyUtils
22
22
  def validate
23
23
  return nil if exist?
24
24
 
25
- "Program \"#{name}\" not found in environment #{env}"
25
+ "Program \"#{::Shellwords.join(executable_args)}\" not found in environment #{env}"
26
26
  end
27
27
 
28
28
  def validate!
@@ -33,13 +33,25 @@ module EacRubyUtils
33
33
 
34
34
  def command(*command_args)
35
35
  validate!
36
- env.command(name, *command_args)
36
+ env.command(*executable_args, *command_args)
37
+ end
38
+
39
+ def executable_args
40
+ executable_args_from_envvar || [name]
41
+ end
42
+
43
+ def executable_args_envvar
44
+ "#{name}_command".variableize.upcase
45
+ end
46
+
47
+ def executable_args_from_envvar
48
+ ENV[executable_args_envvar].if_present { |v| ::Shellwords.split(v) }
37
49
  end
38
50
 
39
51
  private
40
52
 
41
53
  def exist_uncached
42
- env.command(name, *check_args).execute!
54
+ env.command(*executable_args, *check_args).execute!
43
55
  true
44
56
  rescue Errno::ENOENT
45
57
  false
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubygems'
4
+ require 'eac_ruby_utils/gems_registry/gem'
5
+
6
+ module EacRubyUtils
7
+ # Search in each gem for a class determined by registry and run the method "register" on each
8
+ # found.
9
+ #
10
+ # Example:
11
+ # * The module suffix is `TheClass`;
12
+ # * A gem with name "my-lib" is being analyzed
13
+ # * If a require for "my/lib/the_class" is succesful the class/module `My::Lib::TheClass` will
14
+ # be collected.
15
+ class GemsRegistry
16
+ attr_reader :module_suffix
17
+
18
+ def initialize(module_suffix)
19
+ @module_suffix = module_suffix
20
+ end
21
+
22
+ # @return [Array<EacRubyUtils::GemsRegistry::Gem>]
23
+ def registered
24
+ @registered ||= all_gems.select(&:found?)
25
+ end
26
+
27
+ private
28
+
29
+ # @return [Array<EacRubyUtils::GemsRegistry::Gem>]
30
+ def all_gems
31
+ ::Gem::Specification.map do |gemspec|
32
+ ::EacRubyUtils::GemsRegistry::Gem.new(self, gemspec)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/string/inflections'
4
+
5
+ module EacRubyUtils
6
+ class GemsRegistry
7
+ class Gem
8
+ attr_reader :registry, :gemspec
9
+
10
+ def initialize(registry, gemspec)
11
+ @registry = registry
12
+ @gemspec = gemspec
13
+ end
14
+
15
+ def found?
16
+ lib_file_found? && registered_module.is_a?(::Module)
17
+ end
18
+
19
+ def lib_file_found?
20
+ gemspec.require_paths.any? do |require_path|
21
+ ::Pathname.new(require_path).expand_path(gemspec.gem_dir).join(path_to_require + '.rb')
22
+ .file?
23
+ end
24
+ end
25
+
26
+ def registered_module
27
+ return nil unless lib_file_found?
28
+
29
+ require path_to_require
30
+ path_to_require.classify.constantize
31
+ end
32
+
33
+ # @return [String]
34
+ def path_to_require
35
+ gemspec.name.gsub('-', '/') + '/' + registry.module_suffix.underscore
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/patch'
4
+ require 'eac_ruby_utils/contextualizable'
5
+
6
+ class Module
7
+ # Patches module with [EacRubyUtils::Contextualizable].
8
+ def enable_context
9
+ ::EacRubyUtils.patch(self, ::EacRubyUtils::Contextualizable)
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/speaker/sender'
4
+
5
+ class Module
6
+ def enable_speaker
7
+ include ::EacRubyUtils::Speaker::Sender
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ class Pathname
6
+ # Apply .parent n times.
7
+ # @return [Pathname]
8
+ def parent_n(n) # rubocop:disable Naming/MethodParameterName
9
+ n.times.inject(self) { |a, _e| a.parent }
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/rspec/setup'
4
+
5
+ module EacRubyUtils
6
+ module Rspec
7
+ class << self
8
+ def default_setup
9
+ @default_setup ||
10
+ raise("Default instance was not set. Use #{self.class.name}.default_setup_create")
11
+ end
12
+
13
+ def default_setup_create(app_root_path, rspec_config = nil)
14
+ @default_setup = ::EacRubyUtils::Rspec::Setup.create(app_root_path, rspec_config)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/gems_registry'
4
+ require 'eac_ruby_utils/patches/object/if_respond'
5
+ require 'eac_ruby_utils/patches/object/to_pathname'
6
+
7
+ module EacRubyUtils
8
+ module Rspec
9
+ class Setup
10
+ GEMS_REGISTRY_SUFFIX = 'Rspec::SetupInclude'
11
+
12
+ class << self
13
+ def create(app_root_path, rspec_config = nil)
14
+ if rspec_config
15
+ new(app_root_path, rspec_config)
16
+ else
17
+ ::RSpec.configure { |new_rspec_config| new(app_root_path, new_rspec_config) }
18
+ end
19
+ end
20
+ end
21
+
22
+ attr_reader :app_root_path, :rspec_config
23
+
24
+ def initialize(app_root_path, rspec_config)
25
+ @app_root_path = app_root_path.to_pathname
26
+ @rspec_config = rspec_config
27
+ include_registry
28
+ end
29
+
30
+ # @return [EacRubyUtils::GemsRegistry]
31
+ def gems_registry
32
+ @gems_registry ||= ::EacRubyUtils::GemsRegistry.new(GEMS_REGISTRY_SUFFIX)
33
+ end
34
+
35
+ protected
36
+
37
+ def include_registry
38
+ gems_registry.registered.each do |gem|
39
+ singleton_class.include(gem.registered_module)
40
+ gem.registered_module.setup(self) if gem.registered_module.respond_to?(:setup)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end