Sha256: cf3a4e1fb6b27c01e32f91f6fcac6be354f8877ef170de98b366dcdcfdd67696

Contents?: true

Size: 1.24 KB

Versions: 8

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

require 'eac_cli/core_ext'
require 'ehbrs_ruby_utils/cooking_book/build'
require 'os'

module Ehbrs
  module Tools
    class Runner
      class CookingBook
        class Build
          runner_with :help, :subcommands do
            desc 'Operações para livros de receitas.'
            arg_opt '-d', '--target-dir', 'Caminho para o diretório destino da construção.'
            bool_opt '--open', 'Show the result.'
          end

          def run
            start_banner
            build.run
            open
            success 'Done'
          end

          private

          def build_uncached
            ::EhbrsRubyUtils::CookingBook::Build.new(
              runner_context.call(:project), target_dir: parsed.target_dir
            )
          end

          def open
            return unless parsed.open?

            infom "Opening \"#{open_path}\"..."
            ::EacRubyUtils::Envs.local.command(OS.open_file_command, open_path).system!
          end

          def open_path
            build.index_page.target_path
          end

          def start_banner
            infov 'Project', build.project
            infov 'Target directory', build.target_dir
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ehbrs-tools-0.43.1 lib/ehbrs/tools/runner/cooking_book/build.rb
ehbrs-tools-0.43.0 lib/ehbrs/tools/runner/cooking_book/build.rb
ehbrs-tools-0.42.0 lib/ehbrs/tools/runner/cooking_book/build.rb
ehbrs-tools-0.39.1 lib/ehbrs/tools/runner/cooking_book/build.rb
ehbrs-tools-0.39.0 lib/ehbrs/tools/runner/cooking_book/build.rb
ehbrs-tools-0.38.0 lib/ehbrs/tools/runner/cooking_book/build.rb
ehbrs-tools-0.37.0 lib/ehbrs/tools/runner/cooking_book/build.rb
ehbrs-tools-0.36.0 lib/ehbrs/tools/runner/cooking_book/build.rb