Sha256: f7957c7eaade2ac2aeed27e51e12a7fb386cda71a6840ba5250ffa83cb401514

Contents?: true

Size: 1.33 KB

Versions: 14

Compression:

Stored size: 1.33 KB

Contents

# typed: strict
# frozen_string_literal: true

module Tapioca
  module Commands
    class Command
      extend T::Sig
      extend T::Helpers

      class FileWriter < Thor
        include Thor::Actions
      end

      include Thor::Base
      include CliHelper

      abstract!

      sig { void }
      def initialize
        @file_writer = T.let(FileWriter.new, Thor::Actions)
      end

      sig { abstract.void }
      def execute; end

      private

      sig { params(command: Symbol, args: String).returns(String) }
      def default_command(command, *args)
        [Tapioca::BINARY_FILE, command.to_s, *args].join(" ")
      end

      sig { returns(Thor::Actions) }
      attr_reader :file_writer

      sig do
        params(
          path: T.any(String, Pathname),
          content: String,
          force: T::Boolean,
          skip: T::Boolean,
          verbose: T::Boolean,
        ).void
      end
      def create_file(path, content, force: true, skip: false, verbose: true)
        file_writer.create_file(path, force: force, skip: skip, verbose: verbose) { content }
      end

      sig do
        params(
          path: T.any(String, Pathname),
          verbose: T::Boolean,
        ).void
      end
      def remove_file(path, verbose: true)
        file_writer.remove_file(path, verbose: verbose)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
tapioca-0.11.8 lib/tapioca/commands/command.rb
tapioca-0.11.7 lib/tapioca/commands/command.rb
tapioca-0.11.6 lib/tapioca/commands/command.rb
tapioca-0.11.5 lib/tapioca/commands/command.rb
tapioca-0.11.4 lib/tapioca/commands/command.rb
tapioca-0.11.3 lib/tapioca/commands/command.rb
tapioca-0.11.2 lib/tapioca/commands/command.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/tapioca-0.11.1/lib/tapioca/commands/command.rb
tapioca-0.11.1 lib/tapioca/commands/command.rb
tapioca-0.11.0 lib/tapioca/commands/command.rb
tapioca-0.10.5 lib/tapioca/commands/command.rb
tapioca-0.10.4 lib/tapioca/commands/command.rb
tapioca-0.10.3 lib/tapioca/commands/command.rb
tapioca-0.10.2 lib/tapioca/commands/command.rb