Package de.matrixweb.smaller.common

Examples of de.matrixweb.smaller.common.SmallerException


      final ResourceResolver resolver, final Task task) {
    try {
      return execute(version, vfs, resolver,
          ResourceUtil.createResourceGroup(version, resolver, task), task);
    } catch (final IOException e) {
      throw new SmallerException("Failed to run processor chain", e);
    }
  }
View Full Code Here


      final Field binaryTypes = DataURIGenerator.class
          .getDeclaredField("binaryTypes");
      binaryTypes.setAccessible(true);
      ((Map) binaryTypes.get(null)).put("svg", "image/svg+xml");
    } catch (final NoSuchFieldException e) {
      throw new SmallerException("Failed to patch cssembed", e);
    } catch (final IllegalAccessException e) {
      throw new SmallerException("Failed to patch cssembed", e);
    }
  }
View Full Code Here

      }

      LOGGER.info("Finished executing pipeline");
      return prepareResult(vfs, resolver, task);
    } catch (final IOException e) {
      throw new SmallerException("Failed to run processor chain", e);
    }
  }
View Full Code Here

          @Override
          public boolean evaluate(final Object object) {
            return ((Integer) object).intValue() > 1;
          }
        })) {
      throw new SmallerException("Each output type must exist only once");
    }

    final String[] processors = task.getProcessor().toLowerCase().split(",");
    boolean cssembedFound = false;
    for (final String processor : processors) {
      if (processor.equals("cssembed")) {
        cssembedFound = true;
      } else if (processor.equals("yuicompressor") && cssembedFound) {
        throw new SmallerException("yuiCompressor must run before cssembed");
      }
    }

    return true;
  }
View Full Code Here

      LOGGER.info("Found {} processors matching '{}'", refs.size(), filter);
      if (!refs.isEmpty()) {
        processor = this.context.getService(selectProcessor(refs));
      }
      if (processor == null) {
        throw new SmallerException("Failed to create processor " + name + "@"
            + version);
      }
    } catch (final InvalidSyntaxException e) {
      LOGGER.error("Failed to create processor " + name + "@" + version, e);
    }
View Full Code Here

        this.node = new NodeJsExecutor();
        this.node.setModule(getClass(), "browserify-" + this.version,
            "browserify.js");
      } catch (final IOException e) {
        this.node = null;
        throw new SmallerException("Failed to setup node for browserify", e);
      }
    }
    final String outfile = this.node.run(vfs,
        resource != null ? resource.getPath() : null, options);
    if (outfile != null) {
      final VFile file = vfs.find('/' + outfile);
      if (!file.exists()) {
        throw new SmallerException("BrowserifyProcessor result does not exists");
      }
    }
    return resource == null || outfile == null ? resource : resource
        .getResolver().resolve('/' + outfile);
  }
View Full Code Here

      try {
        this.node = new NodeJsExecutor();
        this.node.setModule(getClass(), "jshint-" + this.version, "jshint.js");
      } catch (final IOException e) {
        this.node = null;
        throw new SmallerException("Failed to setup node for jshint", e);
      }
    }
    final String result = this.node.run(vfs, null, options);
    final String content = VFSUtils.readToString(vfs.find(result)).trim();
    if (content.length() > 0) {
View Full Code Here

      try {
        this.node = new NodeJsExecutor();
        this.node.setModule(getClass(), "uglifyjs-" + this.version);
      } catch (final IOException e) {
        this.node = null;
        throw new SmallerException("Failed to setup node for uglify", e);
      }
    }

    final VFile infile = vfs.find(resource.getPath());
    if (!infile.exists()) {
      throw new SmallerException("Uglify input '" + infile
          + "' does not exists");
    }

    final String resultPath = this.node.run(vfs, resource.getPath(), options);
    final VFile outfile = vfs.find('/' + resultPath);
    if (!outfile.exists()) {
      throw new SmallerException("Uglify result '" + outfile
          + "' does not exists");
    }
    return resource.getResolver().resolve(outfile.getPath());
  }
View Full Code Here

   *      de.matrixweb.smaller.resource.Resource, java.util.Map)
   */
  @Override
  public Resource execute(final VFS vfs, final Resource resource,
      final Map<String, Object> options) throws IOException {
    throw new SmallerException("JpegTran currently unsupported");
  }
View Full Code Here

      public String call(final String require) {
        final String module = "/" + name + "/" + require + ".js";
        try {
          final InputStream in = clazz.getResourceAsStream(module);
          if (in == null) {
            throw new SmallerException("Failed to find required module: "
                + module);
          }
          try {
            return IOUtils.toString(in);
          } finally {
            in.close();
          }
        } catch (final IOException e) {
          throw new SmallerException("Failed to find required module: "
              + module, e);
        }
      }
    });
    addGlobalFunction("print", LOGGER, "info");
View Full Code Here

TOP

Related Classes of de.matrixweb.smaller.common.SmallerException

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.