    private void generate(File dir) throws Exception {
        final File readme = new File(dir, "README.md");
        final PrintStream out = new PrintStream(IO.write(readme));
        out.print("Title: ");
        out.println(title(dir));
        out.println();
        out.println("*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/" + dir.getName() + ") or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/" + dir.getName() + "). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*");
        final File main = Files.file(dir, "src", "main");
        final File test = Files.file(dir, "src", "test");
        printJavaFiles(out, collect(main, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(main, Pattern.compile(".*\\.xml")));
        printJavaFiles(out, collect(test, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(test, Pattern.compile(".*\\.xml")));
        printBuildOutput(out, new File("/Users/dblevins/examples/"+dir.getName()+"/build.log"));
        out.close();
    }

    private void generate(File dir) throws Exception {
        final File readme = new File(dir, "README.md");
        final PrintStream out = new PrintStream(IO.write(readme));
        out.print("Title: ");
        out.println(title(dir));
        out.println();
        String path = dir.getAbsolutePath();
        path = path.substring(0, path.indexOf("examples/") + 10);
        out.println("*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/" + path + ") or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/" + path + "). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*");
        final File main = Files.file(dir, "src", "main");
        final File test = Files.file(dir, "src", "test");
        printJavaFiles(out, collect(main, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(main, Pattern.compile(".*\\.xml")));
        printJavaFiles(out, collect(test, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(test, Pattern.compile(".*\\.xml")));
        printBuildOutput(out, new File("/Users/dblevins/examples/"+dir.getName()+"/build.log"));
        out.close();
    }
