Package com.puppetlabs.geppetto.semver

Examples of com.puppetlabs.geppetto.semver.VersionRange


    releasesPerModule.put(fullName, releaseArray);
    return releaseArray;
  }

  public Metadata resolve(Dependency dependency) throws IOException {
    VersionRange vReq = dependency.getVersionRequirement();
    Metadata[] candidates = releasesPerModule.get(dependency.getName());
    if(candidates == null)
      candidates = refreshCache(dependency.getName());

    int idx = candidates.length;
    while(--idx >= 0) {
      Metadata release = candidates[idx];
      if(vReq == null || vReq.isIncluded(release.getVersion()))
        return release;
    }
    return null;
  }
View Full Code Here


      resolve(childDep, seen, resolutionCollector, unresolvedCollector);
  }

  @Override
  public Metadata resolve(ModuleName name, Version version) throws IOException {
    VersionRange vr = VersionRange.exact(version);
    Dependency dep = new Dependency();
    dep.setName(name);
    dep.setVersionRequirement(vr);
    return resolve(dep);
  }
View Full Code Here

    dep.setVersionRequirement(vr);
    return resolve(dep);
  }

  private Resolution resolveAll(Dependency dependency) throws IOException {
    VersionRange vReq = dependency.getVersionRequirement();
    Metadata[] candidates = releasesPerModule.get(dependency.getName());
    if(candidates == null)
      candidates = refreshCache(dependency.getName());
    int idx = candidates.length;
    ArrayList<Metadata> matchingReleases = null;
    while(--idx >= 0) {
      Metadata release = candidates[idx];
      if(vReq == null || vReq.isIncluded(release.getVersion())) {
        if(matchingReleases == null)
          matchingReleases = new ArrayList<Metadata>();
        matchingReleases.add(release);
      }
    }
View Full Code Here

      return;

    SubMonitor submon = SubMonitor.convert(monitor, "Generating project...", 100);
    try {
      Version v = getModuleVersion(module);
      VersionRange vr = v == null
          ? null
          : VersionRange.exact(v);

      File projectDir = project.getLocation().toFile();
      forgeService.install(getFullName(module), vr, projectDir, true, true);
View Full Code Here

    return dependencyErrors;
  }

  private boolean isResolved(Dependency dep) {
    ModuleName name;
    VersionRange range;
    try {
      name = ModuleName.create(dep.getModuleName(), false);
      range = VersionRange.create(dep.getVersionRequirement());
      return PPModuleMetadataBuilder.getBestMatchingProject(name, range) != null;
    }
View Full Code Here

    circularity.get(0).getMetadata().getName().toString(result);
  }

  private static void dependencyToString(Dependency dep, StringBuilder bld) {
    dep.getName().toString(bld);
    VersionRange vr = dep.getVersionRequirement();
    if(vr != null) {
      bld.append('(');
      vr.toString(bld);
      bld.append(')');
    }
  }
View Full Code Here

      IMarker m = r.createMarker(PUPPET_MODULE_PROBLEM_MARKER_TYPE);
      m.setAttribute(IMarker.MESSAGE, message);
      m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
      m.setAttribute(IMarker.SEVERITY, severity);
      if(d != null) {
        VersionRange vr = d.getVersionRequirement();
        m.setAttribute(IMarker.LOCATION, d.getName() + (vr == null
            ? ""
            : vr.toString()));
        if(d instanceof FilePosition)
          m.setAttribute(IMarker.LINE_NUMBER, ((FilePosition) d).getLine() + 1);
      }
      else
        m.setAttribute(IMarker.LOCATION, r.getName());
View Full Code Here

        if(best != null) {
          if(!result.contains(best))
            result.add(best);
        }
        else {
          VersionRange vr = d.getVersionRequirement();
          createErrorMarker(moduleMetadataFile, "Unresolved dependency :'" + d.getName() + (vr == null
              ? ""
              : ("' version: " + vr)), d);
        }
      }
View Full Code Here

      }
    }
    if(candidates.isEmpty())
      return null;

    VersionRange vr = d.getVersionRequirement();
    if(vr == null)
      vr = VersionRange.ALL_INCLUSIVE;
    Version best = vr.findBestMatch(candidates.values());
    return candidates.inverse().get(best);
  }
View Full Code Here

    if(md.getSummary() != null)
      addKeyValueNode(out, "summary", md.getSummary());
    if(md.getDescription() != null)
      addKeyValueNode(out, "description", md.getDescription());
    for(Dependency dep : md.getDependencies()) {
      VersionRange ver = dep.getVersionRequirement();
      if(ver != null)
        addKeyValueNode(out, "dependency", dep.getName().toString('/'), ver.toString());
      else
        addKeyValueNode(out, "dependency", dep.getName().toString('/'));
    }
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.semver.VersionRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.