lib/puppet/module.rb
def unmet_dependencies
    unmet_dependencies = []
    return unmet_dependencies unless dependencies

    dependencies.each do |dependency|
      name = dependency['name']
      version_string = dependency['version_requirement'] || '>= 0.0.0'

      dep_mod = begin
        environment.module_by_forge_name(name)
      rescue
        nil
      end

      error_details = {
        :name => name,
        :version_constraint => version_string.gsub(/^(?=\d)/, "v"),
        :parent => {
          :name => self.forge_name,
          :version => self.version.gsub(/^(?=\d)/, "v")
        },
        :mod_details => {
          :installed_version => dep_mod.nil? ? nil : dep_mod.version
        }
      }

      unless dep_mod
        error_details[:reason] = :missing
        unmet_dependencies << error_details
        next
      end

      if version_string
        begin
          required_version_semver_range = self.class.parse_range(version_string, @strict_semver)
          actual_version_semver = SemanticPuppet::Version.parse(dep_mod.version)
        rescue ArgumentError
          error_details[:reason] = :non_semantic_version
          unmet_dependencies << error_details
          next
        end

        unless required_version_semver_range.include? actual_version_semver
          error_details[:reason] = :version_mismatch
          unmet_dependencies << error_details
          next
        end
      end
    end

    unmet_dependencies
  end
# Identify and mark unmet dependencies.  A dependency will be marked unmet
# for the following reasons:
#
#   * not installed and is thus considered missing
#   * installed and does not meet the version requirements for this module
#   * installed and doesn't use semantic versioning
#
# Returns a list of hashes representing the details of an unmet dependency.
#
# Example:
#
#   [
#     {
#       :reason => :missing,
#       :name   => 'puppetlabs-mysql',
#       :version_constraint => 'v0.0.1',
#       :mod_details => {
#         :installed_version => '0.0.1'
#       }
#       :parent => {
#         :name    => 'puppetlabs-bacula',
#         :version => 'v1.0.0'
#       }
#     }
#   ]
#
Identify and mark unmet dependencies.  A dependency will be marked unmet
for the following reasons.

not installed and is thus considered missing
installed and does not meet the version requirements for this module
installed and doesn't use semantic versioning

Returns a list of hashes representing the details of an unmet dependency.




Identify and mark unmet dependencies . A dependency will be marked unmet for the following reasons . not installed and is thus considered missing installed and does not meet the version requirements for this module installed and doesn ' t use semantic versioning Returns a list of hashes representing the details of an unmet dependency .
def unmet_dependencies
    unmet_dependencies = []
    return unmet_dependencies unless dependencies
    dependencies.each do |dependency|
      name = dependency['name']
      version_string = dependency['version_requirement'] || '>= 0.0.0'
      dep_mod = begin
        environment.module_by_forge_name(name)
      rescue
        nil
      end
      error_details = {
        :name => name,
        :version_constraint => version_string.gsub(/^(?=\d)/, "v"),
        :parent => {
          :name => self.forge_name,
          :version => self.version.gsub(/^(?=\d)/, "v")
        },
        :mod_details => {
          :installed_version => dep_mod.nil? ? nil : dep_mod.version
        }
      }
      unless dep_mod
        error_details[:reason] = :missing
        unmet_dependencies << error_details
        next
      end
      if version_string
        begin
          required_version_semver_range = self.class.parse_range(version_string, @strict_semver)
          actual_version_semver = SemanticPuppet::Version.parse(dep_mod.version)
        rescue ArgumentError
          error_details[:reason] = :non_semantic_version
          unmet_dependencies << error_details
          next
        end
        unless required_version_semver_range.include? actual_version_semver
          error_details[:reason] = :version_mismatch
          unmet_dependencies << error_details
          next
        end
      end
    end
    unmet_dependencies
  end
def unmet_dependencies unmet_dependencies = [ ] return unmet_dependencies unless dependencies dependencies . each do | dependency | name = dependency [ 'name' ] version_string = dependency [ 'version_requirement' ] || '>= 0.0.0' dep_mod = begin environment . module_by_forge_name ( name ) rescue nil end error_details = { :name => name , :version_constraint => version_string . gsub ( / ^(?= \d ) / , "v" ) , :parent => { :name => self . forge_name , :version => self . version . gsub ( / ^(?= \d ) / , "v" ) } , :mod_details => { :installed_version => dep_mod . nil? ? nil : dep_mod . version } } unless dep_mod error_details [ :reason ] = :missing unmet_dependencies << error_details next end if version_string begin required_version_semver_range = self . class . parse_range ( version_string , @strict_semver ) actual_version_semver = SemanticPuppet :: Version . parse ( dep_mod . version ) rescue ArgumentError error_details [ :reason ] = :non_semantic_version unmet_dependencies << error_details next end unless required_version_semver_range . include? actual_version_semver error_details [ :reason ] = :version_mismatch unmet_dependencies << error_details next end end end unmet_dependencies end
Identify and mark unmet dependencies.
Identify and mark unmet dependencies .