Package com.puppetlabs.geppetto.forge.model

Examples of com.puppetlabs.geppetto.forge.model.ModuleName$JsonAdapter


            break;
          case license:
            md.setLicense(arg);
            break;
          case name: {
            ModuleName name = createModuleName(arg, false, pos);
            md.setName(name);
            setNameSeen();
            setFullName(name);
            break;
          }
View Full Code Here


   * @param out
   *            The stream that will receive the Modulefile content
   * @throws IOException
   */
  public static void printModulefile(Metadata md, PrintWriter out) throws IOException {
    ModuleName name = md.getName();
    if(name != null)
      addKeyValueNode(out, "name", name.toString());
    if(md.getVersion() != null)
      addKeyValueNode(out, "version", md.getVersion().toString());
    out.println();
    if(md.getAuthor() != null)
      addKeyValueNode(out, "author", md.getAuthor());
View Full Code Here

      section.setClient(client);
    }

    private void addDependencyIfNotPresent(Metadata metadata, Map<String, VersionedName> moduleInfos,
        ModuleName toBeEdited) throws IOException {
      ModuleName moduleName = metadata.getName();
      if(toBeEdited == null || !toBeEdited.equals(moduleName))
        for(MetadataModel.Dependency dependency : getModel().getDependencies())
          if(moduleName.toString().equals(nameWithDashSeparator(dependency.getModuleName())))
            return;

      VersionedName vn = new VersionedName(moduleName, metadata.getVersion());
      moduleInfos.put(vn.toString(), vn);
    }
View Full Code Here

      Forge forge = getEditor().getForge();

      Map<String, VersionedName> modules = new HashMap<String, VersionedName>();
      IProject current = getCurrentProject();
      Diagnostic chain = new Diagnostic();
      ModuleName always = null;
      if(toBeEdited != null)
        try {
          always = ModuleName.fromString(toBeEdited);
        }
        catch(IllegalArgumentException e) {
View Full Code Here

    // if a dependency appears more than once, use the first (skip the rest with same name)
    for(MetadataInfo mi : moduleData.values()) {
      final ModuleNodeData a = moduleNodeData.get(mi);
      Set<ModuleName> processed = Sets.newHashSet();
      for(Dependency d : mi.getUnresolvedDependencies()) {
        final ModuleName name = d.getName();
        if(!processed.add(name))
          continue;
        Collection<MetadataInfo> existingVersions = moduleData.get(name);
        ModuleNodeData b = null;
        if(existingVersions == null || existingVersions.size() < 1) {
View Full Code Here

     * @param root
     * @return
     */
    public static ModuleNodeData root(File root) {
      File parent = root.getParentFile();
      ModuleName moduleName;
      if(parent != null)
        moduleName = ModuleName.create(safeOwner(parent.getName()), safeName(root.getName(), false), false);
      else
        moduleName = ModuleName.create("root", ModuleName.safeName(root.getName(), false), false);
      return new ModuleNodeData(moduleName, null, ModuleType.ROOT, "");
View Full Code Here

    }
  }

  @Test
  public void attributes() {
    ModuleName name = ModuleName.fromString("some-name");
    assertEquals("Full name qualifier not set correctly", "some", name.getOwner());
    assertEquals("Full name name, not set correctly", "name", name.getName());
  }
View Full Code Here

    assertEquals("Full name name, not set correctly", "name", name.getName());
  }

  @Test
  public void compareCaseInsensitive() {
    ModuleName name = ModuleName.fromString("some-name");
    assertEquals("Qualifier not case insensitive", 0, ModuleName.fromString("Some-name").compareTo(name));
    assertEquals("Name not case insensitive", 0, ModuleName.fromString("some-Name").compareTo(name));
    assertEquals("Combo not case insensitive", 0, ModuleName.fromString("SOME-NAME").compareTo(name));

    assertTrue("bad order", ModuleName.fromString("good-name").compareTo(name) < 0);
View Full Code Here

    assertTrue("compare not case insensitive", ModuleName.fromString("Xtra-Name").compareTo(name) > 0);
  }

  @Test
  public void equalsCaseInsensitive() {
    ModuleName name = ModuleName.fromString("some-name");
    assertEquals("Qualifier not case insensitive", ModuleName.fromString("Some-name"), name);
    assertEquals("Name not case insensitive", ModuleName.fromString("some-Name"), name);
    assertEquals("Combo not case insensitive", ModuleName.fromString("SOME-NAME"), name);
  }
View Full Code Here

    assertEquals("Combo not case insensitive", ModuleName.fromString("SOME-NAME"), name);
  }

  @Test
  public void equalsSeparatorInsensitive() {
    ModuleName name = ModuleName.fromString("some-name");
    assertEquals("ModuleName should not consider separator when comparing", ModuleName.fromString("some/name"), name);
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.forge.model.ModuleName$JsonAdapter

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.