ehbrs-tools 0.16.1 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs/cooking_book.rb +9 -0
  3. data/lib/ehbrs/cooking_book/build.rb +45 -0
  4. data/lib/ehbrs/cooking_book/build/base_page.rb +43 -0
  5. data/lib/ehbrs/cooking_book/build/index_page.rb +26 -0
  6. data/lib/ehbrs/cooking_book/build/recipe_page.rb +27 -0
  7. data/lib/ehbrs/cooking_book/project.rb +25 -0
  8. data/lib/ehbrs/cooking_book/recipe.rb +37 -0
  9. data/lib/ehbrs/cooking_book/recipe/ingredient.rb +21 -0
  10. data/lib/ehbrs/cooking_book/recipe/measure.rb +60 -0
  11. data/lib/ehbrs/cooking_book/recipe/part.rb +32 -0
  12. data/lib/ehbrs/patches/module/erb_template.rb +11 -0
  13. data/lib/ehbrs/patches/object/erb_template.rb +9 -0
  14. data/lib/ehbrs/patches/object/template.rb +7 -0
  15. data/lib/ehbrs/runner.rb +6 -13
  16. data/lib/ehbrs/runner/cooking_book.rb +30 -0
  17. data/lib/ehbrs/runner/cooking_book/build.rb +32 -0
  18. data/lib/ehbrs/runner/videos/probe.rb +3 -3
  19. data/lib/ehbrs/tools/application.rb +13 -0
  20. data/lib/ehbrs/tools/version.rb +1 -1
  21. data/lib/ehbrs/videos/file.rb +4 -8
  22. data/lib/ehbrs/videos/track.rb +5 -13
  23. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +3 -1
  24. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +3 -1
  25. data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +4 -2
  26. data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +3 -1
  27. data/lib/ehbrs/videos/unsupported/checks/invalid_extension.rb +2 -0
  28. data/lib/ehbrs/videos/unsupported/fix_profile.rb +0 -13
  29. data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +10 -10
  30. data/lib/ehbrs/videos/unsupported/profiles/base.rb +17 -3
  31. data/lib/ehbrs/videos/unsupported/profiles/philco.rb +5 -4
  32. data/template/ehbrs/cooking_book/build/base_page/layout.html.erb +20 -0
  33. data/template/ehbrs/cooking_book/build/index_page/inner.html.erb +6 -0
  34. data/template/ehbrs/cooking_book/build/recipe_page/inner.html.erb +6 -0
  35. data/template/ehbrs/cooking_book/build/recipe_page/part.html.erb +27 -0
  36. data/vendor/aranha-parsers/lib/aranha/parsers/spec/source_target_fixtures_example.rb +10 -2
  37. data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
  38. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  39. data/vendor/eac_cli/lib/eac_cli/definition.rb +34 -39
  40. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
  41. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
  42. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
  43. data/vendor/eac_cli/lib/eac_cli/parser.rb +23 -3
  44. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +92 -0
  45. data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
  46. data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
  47. data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
  48. data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
  49. data/vendor/eac_cli/lib/eac_cli/runner.rb +12 -4
  50. data/vendor/eac_cli/lib/eac_cli/runner/exit.rb +13 -0
  51. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +18 -1
  52. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +5 -1
  53. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -1
  54. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  55. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
  56. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +10 -0
  57. data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
  58. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +17 -5
  59. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +42 -0
  60. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +53 -0
  61. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +29 -1
  62. data/vendor/eac_docker/lib/eac_docker/container.rb +24 -0
  63. data/vendor/eac_docker/lib/eac_docker/images/coded.rb +39 -0
  64. data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +26 -0
  65. data/vendor/eac_docker/lib/eac_docker/registry.rb +17 -0
  66. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  67. data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec.rb +12 -0
  68. data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +1 -0
  69. data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +17 -0
  70. data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +1 -0
  71. data/vendor/eac_ruby_base0/Gemfile +5 -0
  72. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +20 -0
  73. data/vendor/eac_ruby_base0/lib/eac_ruby_base0.rb +7 -0
  74. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +69 -0
  75. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +54 -0
  76. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +27 -0
  77. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +5 -0
  78. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +7 -0
  79. data/vendor/eac_ruby_base0/spec/spec_helper.rb +100 -0
  80. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +60 -0
  81. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +2 -50
  82. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb +52 -0
  83. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +41 -0
  84. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +6 -50
  85. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_initialize.rb +29 -0
  86. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +53 -0
  87. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/super_args.rb +54 -0
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +10 -1
  89. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +4 -6
  90. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb +33 -0
  91. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +24 -0
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -21
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +10 -0
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +10 -0
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +1 -8
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +2 -2
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +7 -1
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  99. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +11 -2
  100. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
  101. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +40 -17
  102. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +96 -8
  103. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +12 -1
  104. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
  105. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +30 -2
  106. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb +91 -0
  107. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +51 -0
  108. metadata +89 -13
  109. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +0 -68
  110. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -38
  111. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -77
  112. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/file.rb +0 -31
  113. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/info.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 802c81117166172af4ea59889f51ca8fa22e9619c3db5c3c6cea3facefd67816
4
- data.tar.gz: 524a0c12d36e164f7530653ace84b229d3c90b382bd148fc2dabdf51611881e4
3
+ metadata.gz: 22c8958278ed0b73c620d9dd9db824cd9afc3f5bb10ed9ceec52a9c994173bcf
4
+ data.tar.gz: 0b34372d1969e38768067c175d520d5e214cb2191e01b5bb63d4f878cff12a56
5
5
  SHA512:
6
- metadata.gz: 8704fd788c833ebd36f2c3bab048855993cba2fbe29555040027965195d698eba76d2e36d77ded10672bf50027b441af11d9732ce8bf8dde6fb821623155ea1e
7
- data.tar.gz: 45fa1972f370a98e24424a55ff81b964525799512e6d288fbde84996c5d36540cf368491de00423036f327cc5470889fae2ea0fcf52f40eb29fdfc736275a797
6
+ metadata.gz: 191c6230c49d4c080f56ae46b462785d598c00bf45c876fcbede25b3150e57a17160b4376b404137a6b1cc6de666e1a0480ebe9170927727a28d2633880752ba
7
+ data.tar.gz: 6357f4aabe4cf05c6414e49bd079c9fc3e1963cb44556af608a23f4708ca80ec64a42f9d1d8d420c52760a1b1581c9a4b91355e5edfc3c4d3935130a22959ad1
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Ehbrs
6
+ module CookingBook
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/fs/clearable_directory'
5
+
6
+ module Ehbrs
7
+ module CookingBook
8
+ class Build
9
+ require_sub __FILE__
10
+ enable_simple_cache
11
+ enable_listable
12
+ lists.add_symbol :option, :target_dir
13
+
14
+ common_constructor :project, :options, default: [{}] do
15
+ self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
16
+ end
17
+
18
+ def run
19
+ target_dir.clear
20
+ index_page.build
21
+ recipes_pages.each(&:build)
22
+ end
23
+
24
+ private
25
+
26
+ def index_page_uncached
27
+ ::Ehbrs::CookingBook::Build::IndexPage.new(self)
28
+ end
29
+
30
+ def recipes_pages_uncached
31
+ project.recipes.map do |recipe|
32
+ ::Ehbrs::CookingBook::Build::RecipePage.new(self, recipe)
33
+ end
34
+ end
35
+
36
+ def target_dir_uncached
37
+ ::EacRubyUtils::Fs::ClearableDirectory.new(options[OPTION_TARGET_DIR] || default_target_dir)
38
+ end
39
+
40
+ def default_target_dir
41
+ project.root.join('dist')
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs/patches/object/erb_template'
5
+
6
+ module Ehbrs
7
+ module CookingBook
8
+ class Build
9
+ class BasePage < SimpleDelegator
10
+ attr_reader :parent
11
+
12
+ def initialize(parent, source_object)
13
+ super(source_object)
14
+ @parent = parent
15
+ end
16
+
17
+ def build
18
+ target_path.write(target_content)
19
+ end
20
+
21
+ def href
22
+ "#{target_basename}.html"
23
+ end
24
+
25
+ def target_path
26
+ parent.target_dir.join(href)
27
+ end
28
+
29
+ def target_content
30
+ erb_result('layout', ::Ehbrs::CookingBook::Build::BasePage)
31
+ end
32
+
33
+ def inner_content
34
+ erb_result('inner', self.class)
35
+ end
36
+
37
+ def erb_result(template_basename, template_source = self)
38
+ template_source.erb_template("#{template_basename}.html.erb", self)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs/cooking_book/build/base_page'
5
+
6
+ module Ehbrs
7
+ module CookingBook
8
+ class Build
9
+ class IndexPage < ::Ehbrs::CookingBook::Build::BasePage
10
+ TITLE = 'Início'
11
+
12
+ def initialize(parent)
13
+ super(parent, nil)
14
+ end
15
+
16
+ def target_basename
17
+ 'index'
18
+ end
19
+
20
+ def title
21
+ TITLE
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs/cooking_book/build/base_page'
5
+ require 'ehbrs/patches/object/erb_template'
6
+
7
+ module Ehbrs
8
+ module CookingBook
9
+ class Build
10
+ class RecipePage < ::Ehbrs::CookingBook::Build::BasePage
11
+ def target_basename
12
+ title.variableize
13
+ end
14
+
15
+ def parts
16
+ @parts ||= super.map { |e| Part.new(e) }
17
+ end
18
+
19
+ class Part < SimpleDelegator
20
+ def content
21
+ ::Ehbrs::CookingBook::Build::RecipePage.erb_template('part.html.erb', self)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs/cooking_book/recipe'
5
+
6
+ module Ehbrs
7
+ module CookingBook
8
+ class Project
9
+ enable_simple_cache
10
+ common_constructor :root do
11
+ self.root = root.to_pathname
12
+ end
13
+
14
+ delegate :to_s, to: :root
15
+
16
+ private
17
+
18
+ def recipes_uncached
19
+ ::Dir.glob(File.join('**', '*.{yml,yaml}'), base: root.to_path).map do |subpath|
20
+ ::Ehbrs::CookingBook::Recipe.from_file(root.join(subpath))
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/yaml'
5
+
6
+ module Ehbrs
7
+ module CookingBook
8
+ class Recipe
9
+ enable_simple_cache
10
+ require_sub __FILE__
11
+
12
+ class << self
13
+ def from_file(path)
14
+ new(::EacRubyUtils::Yaml.load_file(path))
15
+ end
16
+ end
17
+
18
+ common_constructor :source_data do
19
+ self.source_data = source_data.deep_symbolize_keys
20
+ end
21
+
22
+ def title
23
+ source_data.fetch(:title)
24
+ end
25
+
26
+ def notes
27
+ source_data[:notes]
28
+ end
29
+
30
+ def parts
31
+ @parts ||= source_data.fetch(:parts).map do |k, v|
32
+ ::Ehbrs::CookingBook::Recipe::Part.new(k, v)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs/cooking_book/recipe/measure'
5
+
6
+ module Ehbrs
7
+ module CookingBook
8
+ class Recipe
9
+ class Ingredient
10
+ class << self
11
+ def build(label, value)
12
+ new(label, ::Ehbrs::CookingBook::Recipe::Measure.build(value))
13
+ end
14
+ end
15
+
16
+ enable_simple_cache
17
+ common_constructor :name, :measure
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/yaml'
5
+ require 'ehbrs/cooking_book/recipe/ingredient'
6
+
7
+ module Ehbrs
8
+ module CookingBook
9
+ class Recipe
10
+ class Measure
11
+ FLOAT_PATTERN = /\d+(?:\.\d+)?/.freeze
12
+ FRACTION_PATTERN = %r{(#{FLOAT_PATTERN})(?:\s*/\s*(#{FLOAT_PATTERN}))?}.freeze
13
+ QUANTITY_UNIT_PATTERN = /\A#{FRACTION_PATTERN}(?:\s*(\S+))?\z/.freeze
14
+ VARIABLE_PATTERN = /\A\~\z/.freeze
15
+ VARIABLE_TEXT = 'a gosto'
16
+
17
+ class << self
18
+ def build(value)
19
+ value = value.to_s.strip
20
+ build_from_variable(value) || build_from_pattern(value) || build_unknown(value)
21
+ end
22
+
23
+ private
24
+
25
+ def build_from_variable(value)
26
+ VARIABLE_PATTERN.if_match(value, false) do
27
+ new(nil, nil, nil)
28
+ end
29
+ end
30
+
31
+ def build_from_pattern(value)
32
+ QUANTITY_UNIT_PATTERN.if_match(value, false) do |m|
33
+ new(m[1].if_present(&:to_f), m[2].if_present(&:to_f), m[3])
34
+ end
35
+ end
36
+
37
+ def build_unknown(value)
38
+ new(nil, nil, "unknown format: |#{value}|")
39
+ end
40
+ end
41
+
42
+ common_constructor :numerator, :denominator, :unit
43
+
44
+ def to_s
45
+ return VARIABLE_TEXT if variable?
46
+
47
+ "#{quantity_to_s} #{unit}"
48
+ end
49
+
50
+ def quantity_to_s
51
+ numerator.to_s + (denominator.if_present('') { |v| "/ #{v}" })
52
+ end
53
+
54
+ def variable?
55
+ numerator.blank?
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/yaml'
5
+ require 'ehbrs/cooking_book/recipe/ingredient'
6
+
7
+ module Ehbrs
8
+ module CookingBook
9
+ class Recipe
10
+ class Part
11
+ enable_simple_cache
12
+ common_constructor :title, :source_data
13
+
14
+ def notes
15
+ source_data[:notes]
16
+ end
17
+
18
+ private
19
+
20
+ def ingredients_uncached
21
+ source_data.fetch(:ingredients).map do |label, value|
22
+ ::Ehbrs::CookingBook::Recipe::Ingredient.build(label, value)
23
+ end
24
+ end
25
+
26
+ def steps_uncached
27
+ source_data.fetch(:steps)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs/patches/object/template'
4
+ require 'erb'
5
+
6
+ class Module
7
+ def erb_template(subpath, binding_obj)
8
+ ::ERB.new(template.child(subpath).path.read)
9
+ .result binding_obj.binding
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs/patches/module/erb_template'
4
+
5
+ class Object
6
+ def erb_template(subpath, binding_obj = self)
7
+ self.class.erb_template(subpath, binding_obj)
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs/tools/application'
4
+ require 'eac_ruby_utils/patches/object/template'
5
+
6
+ ::EacRubyUtils::Templates::Searcher.default.included_paths <<
7
+ ::Ehbrs::Tools.application.gemspec_dir.join('template').to_path
@@ -1,26 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/core_ext'
4
- require 'ehbrs/tools/version'
3
+ require 'eac_ruby_base0/runner'
4
+ require 'ehbrs/tools/application'
5
5
 
6
6
  module Ehbrs
7
7
  class Runner
8
8
  require_sub __FILE__
9
+ include ::EacRubyBase0::Runner
9
10
 
10
- runner_with :help, :subcommands do
11
+ runner_definition do
11
12
  desc 'Tools for EHB/RS.'
12
- subcommands
13
- alt do
14
- bool_opt '-V', '--version', 'Show version.'
15
- end
16
13
  end
17
14
 
18
- def run
19
- if parsed[:version].present?
20
- out(::Ehbrs::Tools::VERSION + "\n")
21
- else
22
- run_with_subcommand
23
- end
15
+ def application
16
+ ::Ehbrs::Tools.application
24
17
  end
25
18
  end
26
19
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'ehbrs/cooking_book/project'
5
+
6
+ module Ehbrs
7
+ class Runner
8
+ class CookingBook
9
+ require_sub __FILE__
10
+
11
+ DEFAULT_SOURCE_DIR = '.'
12
+
13
+ runner_with :help, :subcommands do
14
+ desc 'Operações para livros de receitas.'
15
+ arg_opt '-C', '--source-dir', 'Caminho para o diretório do código-fonte.'
16
+ subcommands
17
+ end
18
+
19
+ private
20
+
21
+ def source_dir_uncached
22
+ (parsed.source_dir || DEFAULT_SOURCE_DIR).to_pathname.expand_path
23
+ end
24
+
25
+ def project_uncached
26
+ ::Ehbrs::CookingBook::Project.new(source_dir)
27
+ end
28
+ end
29
+ end
30
+ end