Пример #1
0
  public BaseSettingsApi(
      BuildSettings settings, GrailsBuildEventListener buildEventListener, boolean interactive) {
    buildSettings = settings;
    buildProps = buildSettings.getConfig().toProperties();
    grailsHome = buildSettings.getGrailsHome();

    metadataFile = new File(buildSettings.getBaseDir(), "application.properties");

    metadata = metadataFile.exists() ? Metadata.getInstance(metadataFile) : Metadata.getCurrent();

    metadataFile = metadata.getMetadataFile();
    enableProfile = Boolean.valueOf(getPropertyValue("grails.script.profile", false).toString());
    pluginsHome = buildSettings.getProjectPluginsDir().getPath();
    pluginSettings = GrailsPluginUtils.getPluginBuildSettings(settings);
    grailsAppName = metadata.getApplicationName();
    isInteractive = interactive;

    // If no app name property (upgraded/new/edited project) default to basedir.
    if (grailsAppName == null) {
      grailsAppName = buildSettings.getBaseDir().getName();
    }

    if (grailsAppName.indexOf('/') > -1) {
      appClassName =
          grailsAppName.substring(grailsAppName.lastIndexOf('/'), grailsAppName.length());
    } else {
      appClassName = GrailsNameUtils.getClassNameRepresentation(grailsAppName);
    }
    configSlurper = buildSettings.createConfigSlurper();
    configSlurper.setEnvironment(buildSettings.getGrailsEnv());
    this.buildEventListener = buildEventListener;
  }
 protected File getPluginDir() throws IOException {
   GrailsPluginInfo info =
       GrailsPluginUtils.getPluginBuildSettings().getPluginInfoForName("scaffolding");
   return info.getDescriptor().getFile().getParentFile();
 }