Sha256: e083d5d7bac48a5ffaf6ed0bcb474359fb5b5499c564ccd105be0fda2014192f

Contents?: true

Size: 1.08 KB

Versions: 88

Compression:

Stored size: 1.08 KB

Contents

require 'semantic/dependency'

module Semantic
  module Dependency
    class ModuleRelease
      include GraphNode

      attr_reader :name, :version

      # Create a new instance of a module release.
      #
      # @param source [Semantic::Dependency::Source]
      # @param name [String]
      # @param version [Semantic::Version]
      # @param dependencies [{String => Semantic::VersionRange}]
      def initialize(source, name, version, dependencies = {})
        @source      = source
        @name        = name.freeze
        @version     = version.freeze

        dependencies.each do |name, range|
          add_constraint('initialize', name, range.to_s) do |node|
            range === node.version
          end

          add_dependency(name)
        end
      end

      def priority
        @source.priority
      end

      def <=>(oth)
        our_key   = [ priority, name, version ]
        their_key = [ oth.priority, oth.name, oth.version ]

        return our_key <=> their_key
      end

      def to_s
        "#<#{self.class} #{name}@#{version}>"
      end
    end
  end
end

Version data entries

88 entries across 88 versions & 2 rubygems

Version Path
puppet-4.3.0-x64-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-3.8.4 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-3.8.4-x86-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-3.8.4-x64-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-4.2.3 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-4.2.3-x86-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-4.2.3-x64-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-3.8.3 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-3.8.3-x86-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-3.8.3-x64-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-4.2.2 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-4.2.2-x86-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-4.2.2-x64-mingw32 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-retrospec-0.8.0 vendor/gems/puppet-3.7.3/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb
puppet-3.8.2 lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb