ehbrs-tools 0.17.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (244) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs/cooking_book/project.rb +8 -2
  3. data/lib/ehbrs/core_ext.rb +4 -0
  4. data/lib/ehbrs/music.rb +9 -0
  5. data/lib/ehbrs/music/album.rb +44 -0
  6. data/lib/ehbrs/observers/base.rb +1 -1
  7. data/lib/ehbrs/observers/with_persistence.rb +1 -1
  8. data/lib/ehbrs/patches.rb +4 -0
  9. data/lib/ehbrs/patches/object/template.rb +2 -2
  10. data/lib/ehbrs/runner/cooking_book/build.rb +20 -2
  11. data/lib/ehbrs/runner/fs/selected.rb +79 -0
  12. data/lib/ehbrs/runner/fs/used_space.rb +2 -3
  13. data/lib/ehbrs/runner/music.rb +16 -0
  14. data/lib/ehbrs/runner/music/selected.rb +26 -0
  15. data/lib/ehbrs/runner/telegram.rb +26 -0
  16. data/lib/ehbrs/runner/telegram/send_message.rb +29 -0
  17. data/lib/ehbrs/runner/videos/probe.rb +2 -2
  18. data/lib/ehbrs/runner/videos/unsupported.rb +1 -1
  19. data/lib/ehbrs/runner/web_utils/videos/upload.rb +1 -1
  20. data/lib/ehbrs/telegram.rb +9 -0
  21. data/lib/ehbrs/telegram/message_sending.rb +32 -0
  22. data/lib/ehbrs/tools/instance.rb +16 -0
  23. data/lib/ehbrs/tools/version.rb +1 -1
  24. data/lib/ehbrs/videos/convert_job.rb +1 -1
  25. data/lib/ehbrs/videos/series/rename/line_result.rb +1 -1
  26. data/lib/ehbrs/videos/unsupported/check_support.rb +13 -8
  27. data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +1 -1
  28. data/lib/ehbrs/videos/unsupported/profiles/aoc.rb +27 -0
  29. data/lib/ehbrs/videos/unsupported/search.rb +1 -1
  30. data/lib/ehbrs/videos/unsupported/track.rb +1 -1
  31. data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/base.rb +8 -0
  32. data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/chrome.rb +10 -5
  33. data/vendor/aranha-selenium/lib/aranha/selenium/driver_factory/firefox.rb +25 -11
  34. data/vendor/aranha-selenium/lib/aranha/selenium/version.rb +1 -1
  35. data/vendor/avm-apps/Gemfile +5 -0
  36. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  37. data/vendor/avm-apps/lib/avm/apps.rb +9 -0
  38. data/vendor/avm-apps/lib/avm/apps/config.rb +19 -0
  39. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  40. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  41. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  42. data/vendor/avm-apps/lib/avm/apps/sources/configuration.rb +57 -0
  43. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_locale.rb +18 -0
  44. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_rubocop.rb +26 -0
  45. data/vendor/avm-apps/lib/avm/apps/sources/configuration/_tests.rb +29 -0
  46. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  47. data/vendor/avm-apps/spec/rubocop_spec.rb +3 -0
  48. data/vendor/avm-apps/spec/spec_helper.rb +103 -0
  49. data/vendor/eac_cli/eac_cli.gemspec +4 -2
  50. data/vendor/eac_cli/lib/eac_cli/config.rb +16 -0
  51. data/vendor/eac_cli/lib/eac_cli/config/entry.rb +48 -0
  52. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb → eac_cli/lib/eac_cli/config/entry/options.rb} +20 -9
  53. data/vendor/eac_cli/lib/eac_cli/config/entry/undefined.rb +26 -0
  54. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
  55. data/vendor/eac_cli/lib/eac_cli/default_runner.rb +1 -1
  56. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
  57. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
  58. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +26 -10
  59. data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
  60. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
  61. data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +3 -2
  62. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +18 -1
  63. data/vendor/eac_cli/lib/eac_cli/old_configs.rb +35 -0
  64. data/vendor/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +80 -0
  65. data/vendor/eac_cli/lib/eac_cli/old_configs/password_entry_reader.rb +16 -0
  66. data/vendor/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +44 -0
  67. data/vendor/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +25 -0
  68. data/vendor/eac_cli/lib/eac_cli/old_configs_bridge.rb +39 -0
  69. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +4 -4
  70. data/vendor/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +37 -0
  71. data/vendor/eac_cli/lib/eac_cli/parser/alternative/option_argument.rb +29 -0
  72. data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +7 -36
  73. data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +47 -0
  74. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
  75. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +3 -2
  76. data/vendor/eac_cli/lib/eac_cli/runner.rb +0 -50
  77. data/vendor/eac_cli/lib/eac_cli/runner/after_class_methods.rb +46 -0
  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 +42 -0
  80. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +9 -4
  81. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder.rb +73 -0
  82. data/vendor/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +56 -0
  83. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +22 -4
  84. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +10 -0
  85. data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
  86. data/vendor/eac_cli/lib/eac_cli/speaker.rb +127 -0
  87. data/vendor/eac_cli/lib/eac_cli/speaker/_constants.rb +12 -0
  88. data/vendor/eac_cli/lib/eac_cli/speaker/list.rb +61 -0
  89. data/vendor/eac_cli/lib/eac_cli/speaker/options.rb +38 -0
  90. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  91. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
  92. data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/console/configs_spec.rb → eac_cli/spec/lib/eac_cli/old_configs_spec.rb} +2 -2
  93. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +1 -1
  94. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +43 -5
  95. data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/console → eac_cli/spec/lib/eac_cli}/speaker_spec.rb +7 -11
  96. data/vendor/eac_cli/spec/rubocop_spec.rb +1 -5
  97. data/vendor/eac_cli/spec/spec_helper.rb +3 -0
  98. data/vendor/eac_config/Gemfile +5 -0
  99. data/vendor/eac_config/eac_config.gemspec +19 -0
  100. data/vendor/eac_config/lib/eac_config.rb +7 -0
  101. data/vendor/eac_config/lib/eac_config/entry.rb +49 -0
  102. data/vendor/eac_config/lib/eac_config/entry_path.rb +41 -0
  103. data/vendor/eac_config/lib/eac_config/envvars_node.rb +25 -0
  104. data/vendor/eac_config/lib/eac_config/envvars_node/entry.rb +54 -0
  105. data/vendor/eac_config/lib/eac_config/load_nodes_search.rb +39 -0
  106. data/vendor/eac_config/lib/eac_config/load_path.rb +28 -0
  107. data/vendor/eac_config/lib/eac_config/node.rb +67 -0
  108. data/vendor/eac_config/lib/eac_config/node_entry.rb +18 -0
  109. data/vendor/eac_config/lib/eac_config/node_uri.rb +38 -0
  110. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/configs.rb → eac_config/lib/eac_config/old_configs.rb} +6 -5
  111. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/configs → eac_config/lib/eac_config/old_configs}/base.rb +5 -5
  112. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils/configs → eac_config/lib/eac_config/old_configs}/file.rb +4 -4
  113. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash.rb +8 -8
  114. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash/entry_key_error.rb +1 -1
  115. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash/node.rb +2 -2
  116. data/vendor/{eac_ruby_utils/lib/eac_ruby_utils → eac_config/lib/eac_config}/paths_hash/path_search.rb +4 -4
  117. data/vendor/eac_config/lib/eac_config/version.rb +5 -0
  118. data/vendor/eac_config/lib/eac_config/yaml_file_node.rb +48 -0
  119. data/vendor/eac_config/lib/eac_config/yaml_file_node/entry.rb +37 -0
  120. data/vendor/eac_config/spec/lib/eac_config/entry_path_spec.rb +30 -0
  121. data/vendor/eac_config/spec/lib/eac_config/envvars_node/entry_spec.rb +14 -0
  122. data/vendor/eac_config/spec/lib/eac_config/envvars_node_spec.rb +40 -0
  123. data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb → eac_config/spec/lib/eac_config/old_configs_spec.rb} +2 -2
  124. data/vendor/{eac_ruby_utils/spec/lib/eac_ruby_utils → eac_config/spec/lib/eac_config}/paths_hash_spec.rb +6 -6
  125. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec.rb +52 -0
  126. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1.yaml +6 -0
  127. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_1.yaml +2 -0
  128. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2.yaml +4 -0
  129. data/vendor/eac_config/spec/lib/eac_config/yaml_file_node_spec_files/storage1_2/storage1_2_1.yaml +2 -0
  130. data/vendor/eac_config/spec/rubocop_spec.rb +3 -0
  131. data/vendor/eac_config/spec/spec_helper.rb +17 -0
  132. data/vendor/eac_docker/eac_docker.gemspec +3 -2
  133. data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +1 -0
  134. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  135. data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +2 -1
  136. data/vendor/eac_docker/spec/rubocop_spec.rb +1 -5
  137. data/vendor/eac_docker/spec/spec_helper.rb +3 -0
  138. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +4 -4
  139. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +23 -9
  140. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb +34 -0
  141. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
  142. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
  143. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
  144. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
  145. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
  146. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
  147. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
  148. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +22 -12
  149. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +4 -9
  150. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
  151. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +43 -0
  152. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
  153. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +36 -0
  154. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
  155. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  156. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
  157. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
  158. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +1 -5
  159. data/vendor/eac_ruby_base0/spec/spec_helper.rb +3 -0
  160. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +2 -3
  161. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/context.rb +31 -0
  162. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb +12 -7
  163. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +10 -5
  164. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +6 -0
  165. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
  166. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/traverser.rb +0 -2
  167. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +13 -2
  168. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
  169. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +48 -0
  170. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
  171. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel.rb +4 -0
  172. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +10 -0
  173. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb +0 -1
  174. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/context.rb +11 -0
  175. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/speaker.rb +9 -0
  176. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
  177. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/regexp/to_parser.rb +10 -0
  178. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
  179. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
  180. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +34 -0
  181. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb +1 -4
  182. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
  183. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
  184. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +26 -5
  185. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker.rb +16 -0
  186. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +57 -0
  187. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/speaker/sender.rb +32 -0
  188. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  189. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +2 -1
  190. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/local_time_zone_spec.rb +17 -0
  191. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/speaker_spec.rb +13 -0
  192. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
  193. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +27 -0
  194. data/vendor/eac_ruby_utils/spec/rubocop_check_spec.rb +1 -5
  195. data/vendor/eac_ruby_utils/spec/spec_helper.rb +3 -0
  196. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb +1 -1
  197. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb +1 -1
  198. metadata +157 -67
  199. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +0 -55
  200. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +0 -50
  201. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +0 -46
  202. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
  203. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +0 -35
  204. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
  205. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console.rb +0 -5
  206. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +0 -38
  207. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +0 -81
  208. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +0 -18
  209. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +0 -27
  210. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +0 -45
  211. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +0 -18
  212. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_doc.rb +0 -25
  213. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_settings.rb +0 -19
  214. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +0 -154
  215. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker.rb +0 -133
  216. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_class_methods.rb +0 -39
  217. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_constants.rb +0 -14
  218. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/list.rb +0 -63
  219. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/node.rb +0 -26
  220. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/console_speaker.rb +0 -10
  221. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +0 -10
  222. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +0 -9
  223. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -5
  224. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/local_time_zone.rb +0 -25
  225. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates.rb +0 -9
  226. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/directory.rb +0 -110
  227. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/file.rb +0 -50
  228. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/searcher.rb +0 -55
  229. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_not_found_error.rb +0 -7
  230. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers.rb +0 -25
  231. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/base.rb +0 -23
  232. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/entries_reader.rb +0 -25
  233. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/generic.rb +0 -25
  234. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/hash.rb +0 -29
  235. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/docopt_runner_spec.rb +0 -136
  236. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/console_speaker_spec.rb +0 -13
  237. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec.rb +0 -23
  238. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec.rb +0 -35
  239. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/expected_content +0 -2
  240. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/source.template +0 -2
  241. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec.rb +0 -30
  242. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file1.template +0 -1
  243. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file2 +0 -1
  244. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path2/subdir1/file3.template +0 -1
@@ -6,8 +6,18 @@ require 'eac_ruby_utils/core_ext'
6
6
  module EacCli
7
7
  module RunnerWith
8
8
  module Subcommands
9
+ require_sub __FILE__
10
+
11
+ class << self
12
+ def runner?(object)
13
+ ::EacCli::Runner.runner?(object)
14
+ end
15
+ end
16
+
9
17
  common_concern do
10
18
  include ::EacCli::Runner
19
+ runner_definition.singleton_class
20
+ .include(::EacCli::RunnerWith::Subcommands::DefinitionConcern)
11
21
  end
12
22
 
13
23
  EXTRA_AVAILABLE_SUBCOMMANDS_METHOD_NAME = :extra_available_subcommands
@@ -19,7 +29,7 @@ module EacCli
19
29
  def available_subcommands_auto
20
30
  self.class.constants
21
31
  .map { |name| [name.to_s.underscore.gsub('_', '-'), self.class.const_get(name)] }
22
- .select { |c| ::EacCli::Runner.runner?(c[1]) }
32
+ .select { |c| ::EacCli::RunnerWith::Subcommands.runner?(c[1]) }
23
33
  .to_h.with_indifferent_access
24
34
  end
25
35
 
@@ -32,7 +42,7 @@ module EacCli
32
42
  end
33
43
 
34
44
  def help_extra_text
35
- (['Subcommands:'] + available_subcommands.keys.map { |s| " #{s}" })
45
+ (['Subcommands:'] + available_subcommands.keys.sort.map { |s| " #{s}" })
36
46
  .map { |v| "#{v}\n" }.join
37
47
  end
38
48
 
@@ -48,8 +58,12 @@ module EacCli
48
58
  end
49
59
 
50
60
  def run_with_subcommand
51
- if subcommand_name
52
- subcommand_runner.run_run
61
+ if run_subcommand?
62
+ if subcommand_runner.respond_to?(:run_run)
63
+ subcommand_runner.run_run
64
+ else
65
+ subcommand_runner.run
66
+ end
53
67
  else
54
68
  run_without_subcommand
55
69
  end
@@ -63,6 +77,10 @@ module EacCli
63
77
  "Method #{__method__} should be overrided in #{self.class.name}"
64
78
  end
65
79
 
80
+ def run_subcommand?
81
+ subcommand_name.present?
82
+ end
83
+
66
84
  def subcommands?
67
85
  self.class.runner_definition.subcommands?
68
86
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ module RunnerWith
5
+ module Subcommands
6
+ module DefinitionConcern
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ class RunnerWithSet
5
+ class << self
6
+ def default
7
+ @default ||= new
8
+ end
9
+ end
10
+
11
+ def add_namespace(namespace)
12
+ namespace = sanitize_namespace(namespace)
13
+ raise "\"#{namespace}\" already was included" if namespace_set.include?(namespace)
14
+
15
+ namespace_set << namespace
16
+ self
17
+ end
18
+
19
+ def item_to_module(item)
20
+ item.is_a?(::Module) ? item : key_to_module(item)
21
+ end
22
+
23
+ def namespaces
24
+ namespace_set.dup
25
+ end
26
+
27
+ private
28
+
29
+ def namespace_set
30
+ @namespace_set ||= ::Array.new
31
+ end
32
+
33
+ def key_to_module(key)
34
+ namespace_set.lazy
35
+ .map { |namespace| key_to_module_in_namespace(namespace, key) }
36
+ .find(&:present?) ||
37
+ raise("Not module found with key \"#{key}\" (Namespaces: #{namespace_set})")
38
+ end
39
+
40
+ def key_to_module_in_namespace(namespace, key)
41
+ namespace.const_get(key.to_s.camelize)
42
+ rescue ::NameError
43
+ nil
44
+ end
45
+
46
+ def sanitize_namespace(source)
47
+ source.is_a?(::Module) ? source : source.to_s.constantize
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,127 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'colorize'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'eac_ruby_utils/speaker/receiver'
6
+
7
+ module EacCli
8
+ class Speaker
9
+ require_sub __FILE__, include_modules: true
10
+ include ::EacRubyUtils::Speaker::Receiver
11
+
12
+ common_constructor :options, default: [{}] do
13
+ self.options = self.class.lists.option.hash_keys_validate!(options)
14
+ end
15
+
16
+ def puts(string = '')
17
+ string.to_s.each_line do |line|
18
+ err_out.puts(err_line_prefix.to_s + line)
19
+ end
20
+ end
21
+
22
+ def out(string = '')
23
+ out_out.write(string.to_s)
24
+ end
25
+
26
+ def fatal_error(string)
27
+ puts "ERROR: #{string}".white.on_red
28
+ Kernel.exit 1
29
+ end
30
+
31
+ def title(string)
32
+ string = string.to_s
33
+ puts(('-' * (8 + string.length)).green)
34
+ puts("--- #{string} ---".green)
35
+ puts(('-' * (8 + string.length)).green)
36
+ puts
37
+ end
38
+
39
+ def info(string)
40
+ puts string.to_s.white
41
+ end
42
+
43
+ def infom(string)
44
+ puts string.to_s.light_yellow
45
+ end
46
+
47
+ def warn(string)
48
+ puts string.to_s.yellow
49
+ end
50
+
51
+ # Options:
52
+ # +bool+ ([Boolean], default: +false+): requires a answer "yes" or "no".
53
+ # +list+ ([Hash] or [Array], default: +nil+): requires a answer from a list.
54
+ # +noecho+ ([Boolean], default: +false+): does not output answer.
55
+ def input(question, options = {})
56
+ bool, list, noecho = options.to_options_consumer.consume_all(:bool, :list, :noecho)
57
+ if list
58
+ request_from_list(question, list, noecho)
59
+ elsif bool
60
+ request_from_bool(question, noecho)
61
+ else
62
+ request_string(question, noecho)
63
+ end
64
+ end
65
+
66
+ def infov(*args)
67
+ r = []
68
+ args.each_with_index do |v, i|
69
+ if i.even?
70
+ r << "#{v}: ".cyan
71
+ else
72
+ r.last << v.to_s
73
+ end
74
+ end
75
+ puts r.join(', ')
76
+ end
77
+
78
+ def success(string)
79
+ puts string.to_s.green
80
+ end
81
+
82
+ private
83
+
84
+ def list_value(list, input)
85
+ values = list_values(list)
86
+ return input, true unless values
87
+ return input, false unless values.include?(input)
88
+ end
89
+
90
+ def list_values(list)
91
+ if list.is_a?(::Hash)
92
+ list.keys.map(&:to_s)
93
+ elsif list.is_a?(::Array)
94
+ list.map(&:to_s)
95
+ end
96
+ end
97
+
98
+ def request_from_bool(question, noecho)
99
+ request_from_list(question, { yes: true, y: true, no: false, n: false }, noecho)
100
+ end
101
+
102
+ def request_from_list(question, list, noecho)
103
+ list = ::EacCli::Speaker::List.build(list)
104
+ loop do
105
+ input = request_string("#{question} [#{list.valid_labels.join('/')}]", noecho)
106
+ return list.build_value(input) if list.valid_value?(input)
107
+
108
+ warn "Invalid input: \"#{input}\" (Valid: #{list.valid_labels.join(', ')})"
109
+ end
110
+ end
111
+
112
+ def request_string(question, noecho)
113
+ err_out.write "#{question}: ".to_s.yellow
114
+ noecho ? request_string_noecho : request_string_echo
115
+ end
116
+
117
+ def request_string_noecho
118
+ r = in_in.noecho(&:gets).chomp.strip
119
+ err_out.write("\n")
120
+ r
121
+ end
122
+
123
+ def request_string_echo
124
+ in_in.gets.chomp.strip
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/by_reference'
4
+
5
+ module EacCli
6
+ # https://github.com/fazibear/colorize
7
+ class Speaker
8
+ STDERR = ::EacRubyUtils::ByReference.new { $stderr }
9
+ STDIN = ::EacRubyUtils::ByReference.new { $stdin }
10
+ STDOUT = ::EacRubyUtils::ByReference.new { $stdout }
11
+ end
12
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/hash_with_indifferent_access'
4
+ require 'ostruct'
5
+
6
+ module EacCli
7
+ class Speaker
8
+ class List
9
+ class << self
10
+ def build(list)
11
+ return List.new(hash_to_values(list)) if list.is_a?(::Hash)
12
+ return List.new(array_to_values(list)) if list.is_a?(::Array)
13
+
14
+ raise "Invalid list: #{list} (#{list.class})"
15
+ end
16
+
17
+ private
18
+
19
+ def hash_to_values(list)
20
+ list.map { |key, value| ::OpenStruct.new(key: key, label: key, value: value) }
21
+ end
22
+
23
+ def array_to_values(list)
24
+ list.map { |value| ::OpenStruct.new(key: value, label: value, value: value) }
25
+ end
26
+ end
27
+
28
+ attr_reader :values
29
+
30
+ def initialize(values)
31
+ @values = values.map do |v|
32
+ ::OpenStruct.new(key: to_key(v.key), label: to_label(v.label), value: v.value)
33
+ end
34
+ end
35
+
36
+ def valid_labels
37
+ values.map(&:label)
38
+ end
39
+
40
+ def valid_value?(value)
41
+ values.any? { |v| v.key == to_key(value) }
42
+ end
43
+
44
+ def to_key(value)
45
+ to_label(value).downcase
46
+ end
47
+
48
+ def to_label(value)
49
+ value.to_s.strip
50
+ end
51
+
52
+ def build_value(value)
53
+ key = to_key(value)
54
+ values.each do |v| # rubocop:disable Style/HashEachMethods
55
+ return v.value if v.key == key
56
+ end
57
+ raise "Value not found: \"#{value}\" (#{values})"
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacCli
6
+ class Speaker
7
+ module Options
8
+ common_concern do
9
+ enable_listable
10
+ lists.add_symbol :option, :out_out, :err_out, :in_in, :parent, :err_line_prefix
11
+ end
12
+
13
+ def err_out
14
+ option(OPTION_ERR_OUT, ::EacCli::Speaker::STDERR)
15
+ end
16
+
17
+ def out_out
18
+ option(OPTION_OUT_OUT, ::EacCli::Speaker::STDOUT)
19
+ end
20
+
21
+ def in_in
22
+ option(OPTION_IN_IN, ::EacCli::Speaker::STDIN)
23
+ end
24
+
25
+ def err_line_prefix
26
+ option(OPTION_ERR_LINE_PREFIX, '')
27
+ end
28
+
29
+ def parent
30
+ options[OPTION_PARENT]
31
+ end
32
+
33
+ def option(key, default)
34
+ options[key] || parent.if_present(default) { |v| v.send(__METHOD__) }
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.12.4'
4
+ VERSION = '0.21.1'
5
5
  end
@@ -7,6 +7,10 @@ RSpec.describe ::EacCli::Definition::Alternative do
7
7
 
8
8
  it { expect { instance.arg_opt '-a', '--opt2', 'A argument option' }.not_to raise_error }
9
9
  it { expect { instance.bool_opt '-b', '--opt1', 'A boolean option' }.not_to raise_error }
10
+ it { expect { instance.bool_opt '-b', '--no-description' }.not_to raise_error }
11
+ it { expect { instance.bool_opt '--opt1', 'A option without short' }.not_to raise_error }
12
+ it { expect { instance.bool_opt '-b', 'A option without long' }.not_to raise_error }
13
+ it { expect { instance.bool_opt 'A option without selectors' }.to raise_error(::StandardError) }
10
14
  it { expect { instance.options_argument(true) }.not_to raise_error }
11
15
  it { expect { instance.pos_arg :pos1 }.not_to raise_error }
12
16
  it { expect { instance.pos_arg :pos2, optional: true, repeat: true }.not_to raise_error }
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/configs'
3
+ require 'eac_cli/old_configs'
4
4
 
5
- RSpec.describe ::EacRubyUtils::Console::Configs do
5
+ RSpec.describe ::EacCli::OldConfigs do
6
6
  describe '#entry_key_to_envvar_name' do
7
7
  {
8
8
  'a.entry.value' => 'A_ENTRY_VALUE',
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/docopt/runner_extension'
3
+ require 'eac_cli/parser/alternative'
4
4
 
5
5
  RSpec.describe ::EacCli::Parser::Alternative do
6
6
  let(:instance) { described_class.new(alternative, argv) }
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
3
  require 'eac_cli/runner'
5
4
 
6
5
  RSpec.describe ::EacCli::Runner do
@@ -11,7 +10,9 @@ RSpec.describe ::EacCli::Runner do
11
10
 
12
11
  runner_definition do
13
12
  arg_opt '-o', '--opt1', 'A arg option.'
14
- bool_opt '-o', '--opt2', 'A boolean option'
13
+ bool_opt '-p', '--opt2', 'A boolean option'
14
+ arg_opt '-q', '--opt4', 'A repeatable argument option.', repeat: true
15
+ bool_opt '-r', '--opt5', 'A repeatable boolean option', repeat: true
15
16
  pos_arg :pos1
16
17
  pos_arg :pos2, repeat: true, optional: true
17
18
  alt do
@@ -29,7 +30,7 @@ RSpec.describe ::EacCli::Runner do
29
30
  context 'when all args are supplied' do
30
31
  let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd] }
31
32
  let(:parsed_expected) do
32
- { opt1: 'aaa', opt2: true, opt3: false, pos1: 'bbb',
33
+ { opt1: 'aaa', opt2: true, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
33
34
  pos2: %w[ccc ddd] }
34
35
  end
35
36
 
@@ -40,9 +41,33 @@ RSpec.describe ::EacCli::Runner do
40
41
  it { expect(instance.parsed.pos2).to eq(%w[ccc ddd]) }
41
42
  end
42
43
 
44
+ context 'with long option and argument in same position' do
45
+ let(:argv) { %w[--opt1=aaa pos1] }
46
+
47
+ it { expect(instance.parsed.opt1).to eq('aaa') }
48
+ end
49
+
50
+ context 'with valid grouped short options' do
51
+ let(:argv) { %w[-po aaa pos1] }
52
+
53
+ it { expect(instance.parsed.opt1).to eq('aaa') }
54
+ it { expect(instance.parsed.opt2?).to eq(true) }
55
+ end
56
+
57
+ context 'with invalid grouped short options' do
58
+ let(:argv) { %w[-op aaa pos1] }
59
+
60
+ it do
61
+ expect { instance.parsed }.to raise_error(::EacCli::Parser::Error)
62
+ end
63
+ end
64
+
43
65
  context 'when only required args are supplied' do
44
66
  let(:argv) { %w[bbb] }
45
- let(:parsed_expected) { { opt1: nil, opt2: false, opt3: false, pos1: 'bbb', pos2: [] } }
67
+ let(:parsed_expected) do
68
+ { opt1: nil, opt2: false, opt3: false, opt4: [], opt5: 0, pos1: 'bbb',
69
+ pos2: [] }
70
+ end
46
71
 
47
72
  it { expect(parsed_actual).to eq(parsed_expected) }
48
73
  it { expect(instance.parsed.opt1).to be_nil }
@@ -61,12 +86,25 @@ RSpec.describe ::EacCli::Runner do
61
86
 
62
87
  context 'when alternative args are supplied' do
63
88
  let(:argv) { %w[--opt3] }
64
- let(:parsed_expected) { { opt1: nil, opt2: false, opt3: true, pos1: nil, pos2: [] } }
89
+ let(:parsed_expected) do
90
+ { opt1: nil, opt2: false, opt3: true, opt4: [], opt5: 0, pos1: nil,
91
+ pos2: [] }
92
+ end
65
93
 
66
94
  it { expect(parsed_actual).to eq(parsed_expected) }
67
95
  it { expect(instance.parsed.opt3?).to eq(true) }
68
96
  end
69
97
 
98
+ context 'when repeated options are supplied' do
99
+ let(:argv) { %w[--opt5 -rrr --opt4=A -q B --opt4 C AAA] }
100
+ let(:parsed_expected) do
101
+ { opt1: nil, opt2: false, opt3: false, opt4: %w[A B C], opt5: 4, pos1: 'AAA',
102
+ pos2: [] }
103
+ end
104
+
105
+ it { expect(parsed_actual).to eq(parsed_expected) }
106
+ end
107
+
70
108
  context 'when extra args are not supplied' do
71
109
  let(:runner_class) do
72
110
  the_module = described_class