Package org.jboss.forge.shell

Examples of org.jboss.forge.shell.PluginJar


      {
         RES: for (Resource<?> res : list)
         {
            try
            {
               PluginJar jar = new PluginJar(res.getName());

               for (PluginJar p : installed)
               {
                  if (p.isSamePlugin(jar))
                  {
                     if (p.getVersion() < jar.getVersion())
                     {
                        installed.remove(p);
                        installed.add(jar);
                     }
                     continue RES;
                  }
               }
               installed.add(jar);
            }
            catch (IllegalNameException e)
            {
               untracked.add(res);
            }
         }

         if (!installed.isEmpty())
         {
            writer.println();
            writer.println(ShellColor.RED, "[installed plugins]");
            for (PluginJar jar : installed)
            {
               writer.print(ShellColor.ITALIC, jar.getDependency().getGroupId());
               writer.print(" : ");
               writer.print(ShellColor.BOLD, jar.getDependency().getArtifactId());
               writer.print(" : ");
               if (Strings.isNullOrEmpty(jar.getDependency().getVersion()))
               {
                  writer.print(ShellColor.RED, "unversioned");
               }
               else
               {
                  writer.print(ShellColor.YELLOW, jar.getDependency().getVersion());
               }

               if (showAll)
               {
                  writer.print(ShellColor.ITALIC,
                           " - " + environment.getPluginDirectory().getFullyQualifiedName() + "/" + jar.getFullName());
               }
               writer.println();
            }
         }
View Full Code Here


   }

   private FileResource<?> createIncrementedPluginJarFile(Dependency dep)
   {
      int version = 0;
      PluginJar pluginJar = new PluginJar(dep);
      DirectoryResource pluginDir = environment.getPluginDirectory();
      List<Resource<?>> list = pluginDir.listResources(new StartsWith(pluginJar.getName()));

      if (list.size() > 0 && !prompt.promptBoolean(
                        "An existing version of this plugin was found. Replace it?", true))
      {
         throw new RuntimeException("Aborted.");
      }

      for (Resource<?> res : list)
      {
         PluginJar jar = new PluginJar(res.getName());
         if (jar.getVersion() > version)
         {
            version = jar.getVersion();
         }
         if (res instanceof FileResource<?>)
            ((FileResource<?>) res).deleteOnExit();
      }

      String finalName = new PluginJar(dep, version + 1).getFullName();
      FileResource<?> jar = (FileResource<?>) pluginDir.getChild(finalName);
      jar.createNewFile();
      return jar;
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.shell.PluginJar

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.