コード例 #1
0
  public static void main(String[] args) {
    Map<String, String> arguments = ArgumentsUtil.parseArguments(args);

    InitUtil.initWithSpring();

    try {
      new SampleSQLBuilder(arguments);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  public static void main(String[] args) throws Exception {
    Map<String, String> arguments = ArgumentsUtil.parseArguments(args);

    List<String> dirNames = new ArrayList<>();

    String dirName = GetterUtil.getString(arguments.get("sass.dir"), CSSBuilderArgs.DIR_NAME);

    if (Validator.isNotNull(dirName)) {
      dirNames.add(dirName);
    } else {
      for (int i = 0; ; i++) {
        dirName = arguments.get("sass.dir." + i);

        if (Validator.isNotNull(dirName)) {
          dirNames.add(dirName);
        } else {
          break;
        }
      }
    }

    String docrootDirName =
        GetterUtil.getString(arguments.get("sass.docroot.dir"), CSSBuilderArgs.DOCROOT_DIR_NAME);
    String portalCommonDirName = arguments.get("sass.portal.common.dir");
    String[] rtlExcludedPathRegexps =
        StringUtil.split(arguments.get("sass.rtl.excluded.path.regexps"));
    String sassCompilerClassName = arguments.get("sass.compiler.class.name");

    try {
      CSSBuilder cssBuilder =
          new CSSBuilder(
              docrootDirName, portalCommonDirName, rtlExcludedPathRegexps, sassCompilerClassName);

      cssBuilder.execute(dirNames);
    } catch (Exception e) {
      ArgumentsUtil.processMainException(arguments, e);
    }
  }
コード例 #3
0
  public static void main(String[] args) throws Exception {
    Map<String, String> arguments = ArgumentsUtil.parseArguments(args);

    try {
      SourceFormatterArgs sourceFormatterArgs = new SourceFormatterArgs();

      boolean autoFix =
          GetterUtil.getBoolean(arguments.get("source.auto.fix"), SourceFormatterArgs.AUTO_FIX);

      sourceFormatterArgs.setAutoFix(autoFix);

      String baseDirName =
          GetterUtil.getString(arguments.get("source.base.dir"), SourceFormatterArgs.BASE_DIR_NAME);

      sourceFormatterArgs.setBaseDirName(baseDirName);

      boolean formatCurrentBranch =
          GetterUtil.getBoolean(
              arguments.get("format.current.branch"), SourceFormatterArgs.FORMAT_CURRENT_BRANCH);

      sourceFormatterArgs.setFormatCurrentBranch(formatCurrentBranch);

      boolean formatLatestAuthor =
          GetterUtil.getBoolean(
              arguments.get("format.latest.author"), SourceFormatterArgs.FORMAT_LATEST_AUTHOR);

      sourceFormatterArgs.setFormatLatestAuthor(formatLatestAuthor);

      boolean formatLocalChanges =
          GetterUtil.getBoolean(
              arguments.get("format.local.changes"), SourceFormatterArgs.FORMAT_LOCAL_CHANGES);

      sourceFormatterArgs.setFormatLocalChanges(formatLocalChanges);

      if (formatCurrentBranch) {
        sourceFormatterArgs.setRecentChangesFileNames(
            GitUtil.getCurrentBranchFileNames(baseDirName));
      } else if (formatLatestAuthor) {
        sourceFormatterArgs.setRecentChangesFileNames(
            GitUtil.getLatestAuthorFileNames(baseDirName));
      } else if (formatLocalChanges) {
        sourceFormatterArgs.setRecentChangesFileNames(
            GitUtil.getLocalChangesFileNames(baseDirName));
      }

      String copyrightFileName =
          GetterUtil.getString(
              arguments.get("source.copyright.file"), SourceFormatterArgs.COPYRIGHT_FILE_NAME);

      sourceFormatterArgs.setCopyrightFileName(copyrightFileName);

      String[] fileNames = StringUtil.split(arguments.get("source.files"), StringPool.COMMA);

      if (ArrayUtil.isNotEmpty(fileNames)) {
        sourceFormatterArgs.setFileNames(Arrays.asList(fileNames));
      }

      boolean printErrors =
          GetterUtil.getBoolean(
              arguments.get("source.print.errors"), SourceFormatterArgs.PRINT_ERRORS);

      sourceFormatterArgs.setPrintErrors(printErrors);

      boolean throwException =
          GetterUtil.getBoolean(
              arguments.get("source.throw.exception"), SourceFormatterArgs.THROW_EXCEPTION);

      sourceFormatterArgs.setThrowException(throwException);

      boolean useProperties =
          GetterUtil.getBoolean(
              arguments.get("source.use.properties"), SourceFormatterArgs.USE_PROPERTIES);

      sourceFormatterArgs.setUseProperties(useProperties);

      SourceFormatter sourceFormatter = new SourceFormatter(sourceFormatterArgs);

      sourceFormatter.format();
    } catch (GitException ge) {
      System.out.println(ge.getMessage());

      System.exit(0);
    } catch (Exception e) {
      ArgumentsUtil.processMainException(arguments, e);
    }
  }