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);
 }
  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());
    }
  }