Exemplo n.º 1
0
  private static ScriptAndArgs processAndReturnArguments(CommandLine commandLine) {
    ScriptAndArgs info = new ScriptAndArgs();
    if (Environment.isSystemSet()) {
      info.env = Environment.getCurrent().getName();
    } else if (commandLine.getEnvironment() != null) {
      info.env = commandLine.getEnvironment();
    }

    info.inputName = commandLine.getCommandName();
    info.name = GrailsNameUtils.getNameFromScript(commandLine.getCommandName());
    return info;
  }
Exemplo n.º 2
0
  public int executeScriptWithCaching(CommandLine commandLine) {
    processSystemArguments(commandLine);

    System.setProperty("grails.cli.args", commandLine.getRemainingArgsLineSeparated());
    return executeScriptWithCaching(
        commandLine,
        GrailsNameUtils.getNameFromScript(commandLine.getCommandName()),
        commandLine.getEnvironment());
  }
Exemplo n.º 3
0
 private static void loadConfigEnvironment(CommandLine commandLine, BuildSettings build) {
   String env;
   if (commandLine.isEnvironmentSet()) {
     env = commandLine.getEnvironment();
   } else {
     env = commandLine.lookupEnvironmentForCommand();
   }
   build.setGrailsEnv(env);
   build.loadConfig(env);
 }
Exemplo n.º 4
0
  private void setRunningEnvironment(CommandLine commandLine, String env) {
    // Get the default environment if one hasn't been set.
    System.setProperty("base.dir", settings.getBaseDir().getPath());

    if (env != null) {
      // Add some extra binding variables that are now available.
      settings.setGrailsEnv(env);
      settings.setDefaultEnv(false);
    } else {
      // Add some extra binding variables that are now available.
      settings.setGrailsEnv(commandLine.getEnvironment());
      settings.setDefaultEnv(!commandLine.isEnvironmentSet());
    }
  }