Sha256: 7d494888579cd88df5d2c4d25fc9c9a7c0fadbae65e33ae875668b298a12872e

Contents?: true

Size: 669 Bytes

Versions: 3

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

module SmtpMock
  module Dependency
    BINARY_SHORTCUT = 'smtpmock'
    SYMLINK = "/usr/local/bin/#{BINARY_SHORTCUT}"

    class << self
      def smtpmock_path_by_symlink
        ::Kernel.public_send(:`, "readlink #{SmtpMock::Dependency::SYMLINK}")
      end

      def smtpmock?
        !smtpmock_path_by_symlink.empty?
      end

      def verify_dependencies
        raise SmtpMock::Error::Dependency, SmtpMock::Error::Dependency::SMTPMOCK_NOT_INSTALLED unless smtpmock?
      end

      def compose_command(command_line_args)
        "#{SmtpMock::Dependency::BINARY_SHORTCUT} #{command_line_args}".strip
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smtp_mock-0.1.2 lib/smtp_mock/dependency.rb
smtp_mock-0.1.1 lib/smtp_mock/dependency.rb
smtp_mock-0.1.0 lib/smtp_mock/dependency.rb