Sha256: 2992235a524a3172496d6fe0ee34062fd064fc94e153bce0cd0ae598bf925c27

Contents?: true

Size: 864 Bytes

Versions: 9

Compression:

Stored size: 864 Bytes

Contents

# frozen_string_literal: true

module PuppetfileResolver
  module Models
    class PuppetDependency
      attr_reader :name
      attr_accessor :version_requirement

      def initialize(version_requirement)
        @name = 'Puppet' # This name is special as modules cannot start with an uppercase letter

        @version_requirement = version_requirement
      end

      def to_s
        "#{name} #{version_requirement}"
      end

      def satisified_by?(spec)
        # A Puppet spec with a nil version will always be satisified by a Puppet Dependency
        return true if spec.version.nil?
        semantic_requirement.include?(spec.version)
      end

      private

      def semantic_requirement
        require 'semantic_puppet'

        @semantic_requirement ||= ::SemanticPuppet::VersionRange.parse(@version_requirement)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
puppetfile-resolver-0.6.3 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.6.2 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.6.1 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.6.0 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.5.0 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.4.0 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.3.0 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.2.0 lib/puppetfile-resolver/models/puppet_dependency.rb
puppetfile-resolver-0.1.0 lib/puppetfile-resolver/models/puppet_dependency.rb