Sha256: 387431c7c61f258ea5a53a9d654b6b7635c05781240a022615633e037769c15e

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module NeetoCompliance
  class GemVersionVerifier
    attr_reader :current_version, :latest_version, :gem_name

    def initialize(current_version, latest_version, gem_name)
      @latest_version = latest_version
      @current_version = current_version
      @gem_name = gem_name
    end

    def gem_not_installed?
      current_version.nil?
    end

    def latest_version_installed?
      current_version == latest_version
    end

    def equal_app_and_gem_name?
      app_name == gem_name
    end

    def valid?
      equal_app_and_gem_name? || gem_not_installed? || latest_version_installed?
    end

    def app_name
      @_app_name ||= `git config --get remote.origin.url`.split("/").last.strip.split(".git").first
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neeto-compliance-1.0.58 lib/neeto_compliance/verifiers/gem_version_verifier.rb