Exemplo n.º 1
0
  /** Returns a list of all the executable Gant scripts available to this application. */
  public List<File> getAvailableScripts() {
    List<File> scripts = new ArrayList<File>();
    if (settings.getGrailsHome() != null) {
      addCommandScripts(new File(settings.getGrailsHome(), "scripts"), scripts);
      addCommandScripts(
          new File(settings.getGrailsHome(), "grails-scripts/src/main/scripts"), scripts);
    }
    addCommandScripts(new File(settings.getBaseDir(), "scripts"), scripts);
    addCommandScripts(new File(settings.getUserHome(), ".grails/scripts"), scripts);

    for (File dir : pluginPathSupport.listKnownPluginDirs()) {
      addPluginScripts(dir, scripts);
    }

    PathMatchingResourcePatternResolver resolver =
        new PathMatchingResourcePatternResolver(settings.getRootLoader());
    try {
      final Resource[] resources = resolver.getResources("classpath*:META-INF/scripts/*.groovy");
      for (Resource resource : resources) {
        scripts.add(resource.getFile());
      }
    } catch (IOException e) {
      // ignore
    }
    return scripts;
  }
Exemplo n.º 2
0
 public Resource[] resolveResources(String pattern) {
   try {
     return resolver.getResources(pattern);
   } catch (Exception e) {
     return NO_RESOURCES;
   }
 }