Package com.puppetlabs.geppetto.forge.v1.model

Examples of com.puppetlabs.geppetto.forge.v1.model.Release


  }

  @Override
  protected void configure() {
    bind(ForgeClient.class).to(ForgeHttpClient.class);
    install(new V1Module());
    install(new V2Module());
    install(new V3Module());
    bind(MetadataRepository.class).to(MetadataRepositoryImpl.class);
  }
View Full Code Here


    List<Release> releases = moduleService.getReleases(moduleName.getOwner(), moduleName.getName(), null);
    if(releases.isEmpty())
      throw new FileNotFoundException("No releases found for module '" + moduleName + '\'');

    Release best = null;
    for(Release release : releases)
      if((best == null || release.getVersion().compareTo(best.getVersion()) > 0) &&
          (range == null || range.isIncluded(release.getVersion())))
        best = release;

    if(best == null)
      throw new FileNotFoundException("No releases matching '" + range + "' found for module '" + moduleName +
          '\'');

    if(!destinationIncludesTopFolder)
      // Use module name as the default
      destination = new File(destination, moduleName.getName());

    if(destination.exists()) {
      if(!force)
        throw new IOException("Destination folder is not empty: " + destination.getAbsolutePath());

      // Don't remove .project, .settings, .git, .svn, etc. if they are present.
      FileUtils.rmR(destination, FileUtils.DEFAULT_EXCLUDES);
    }

    File moduleFile = cache.retrieve(best.getFullName(), best.getVersion());

    // Unpack closes its input.
    TarUtils.unpack(new GZIPInputStream(new FileInputStream(moduleFile)), destination, true, null);
    return forgeUtil.loadJSONMetadata(new File(destination, METADATA_JSON_NAME));
  }
View Full Code Here

public class ReleaseTestCreate extends ForgeAPITestBase {
  @Test
  public void testCreate() throws IOException {
    ReleaseService service = getTestUserForge().createReleaseService();
    byte[] releaseFile = TestDataProvider.getTestData(TEST_GZIPPED_RELEASE);
    Release newRelease = service.create(
      TEST_USER, TEST_MODULE, "Some notes about this release", new ByteArrayInputStream(releaseFile),
      releaseFile.length);
    assertNotNull("Null Release", newRelease);
    assertEquals("Incorrect release version", newRelease.getVersion(), TEST_RELEASE_VERSION);
  }
View Full Code Here

  */

  @Test
  public void testReleaseDetail() throws IOException {
    ReleaseService service = getTestUserForge().createReleaseService();
    Release release = service.get(TEST_USER, TEST_MODULE, TEST_RELEASE_VERSION);
    assertNotNull("Null release", release);
  }
View Full Code Here

      List<AnnotatedLink> releases = module.getReleases();
      assertNotNull("Null module releases list", releases);
      for(AnnotatedLink release : releases) {
        assertNotNull("Null module release slug", release.getSlug());
        assertNotNull("Null module release link", release.getLink());
        Release resolved = service.resolveLink(release.getLink(), Release.class);
        assertNotNull("Null resolved release", resolved);
        assertEquals("Resolved release version mismatch", resolved.getVersion().toString(), release.getKey());
        someReleaseLinkTested = true;
      }
    }
    assertTrue("No release links found", someReleaseLinkTested);
  }
View Full Code Here

    }
    return null;
  }

  public static Version getModuleVersion(Module module) {
    Release release = module.getCurrentRelease();
    return release == null
        ? null
        : release.getVersion();
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.forge.v1.model.Release

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.