Sha256: 9a5c19516c79f79d4f5242204b24f73cbe2c82179bfb02a9b0b8f6a975e3557c
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true module SmtpMock module Dependency BINARY_SHORTCUT = 'smtpmock' SYMLINK = "/usr/local/bin/#{BINARY_SHORTCUT}" VERSION_REGEX_PATTERN = /#{BINARY_SHORTCUT}: (.+)/.freeze 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? current_version = version raise SmtpMock::Error::Dependency, SmtpMock::Error::Dependency::SMTPMOCK_MIN_VERSION unless minimal_version?(current_version) current_version end def compose_command(command_line_args) "#{SmtpMock::Dependency::BINARY_SHORTCUT} #{command_line_args}".strip end private def version ::Kernel.public_send( :`, "#{SmtpMock::Dependency::BINARY_SHORTCUT} -v" )[SmtpMock::Dependency::VERSION_REGEX_PATTERN, 1] end def minimal_version?(current_version) !!current_version && current_version >= SmtpMock::SMTPMOCK_MIN_VERSION end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
smtp_mock-1.0.1 | lib/smtp_mock/dependency.rb |
smtp_mock-1.0.0 | lib/smtp_mock/dependency.rb |