Sha256: 396d782fab4161684c7e4a8ef3b76c33b62b5ce75b810e8f04749866cd86212d

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require 'forwardable'

module Railsdock
  class Command
    extend Forwardable

    def_delegators :command, :run

    # Execute this command
    #
    # @api public
    def execute(*)
      raise(
        NotImplementedError,
        "#{self.class}##{__method__} must be implemented"
      )
    end

    # The external commands runner
    #
    # @see http://www.rubydoc.info/gems/tty-command
    #
    # @api public
    def cmd(**options)
      require 'tty-command'
      TTY::Command.new(options)
    end

    # File manipulation utility methods.
    #
    # @see http://www.rubydoc.info/gems/tty-file
    #
    # @api public
    def file
      require 'tty-file'
      TTY::File
    end

    # Terminal platform and OS properties
    #
    # @see http://www.rubydoc.info/gems/tty-platform
    #
    # @api public
    def platform
      require 'tty-platform'
      TTY::Platform.new
    end

    # The interactive prompt
    #
    # @see http://www.rubydoc.info/gems/tty-prompt
    #
    # @api public
    def prompt(**options)
      require 'tty-prompt'
      TTY::Prompt.new(options)
    end

    def color
      require 'pastel'
      Pastel.new
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
railsdock-0.4.0 lib/railsdock/command.rb
railsdock-0.3.1 lib/railsdock/command.rb
railsdock-0.3.0 lib/railsdock/command.rb
railsdock-0.2.0 lib/railsdock/command.rb
railsdock-0.1.4 lib/railsdock/command.rb
railsdock-0.1.3 lib/railsdock/command.rb