static void generateGuidesPages()

in buildSrc/src/main/groovy/org/grails/gradle/GuidesTask.groovy [113:137]


    static void generateGuidesPages(ClassLoader classLoader, File pages, String url) {
        List<Guide> guides = GuidesFetcher.fetchGuides()
        Set<Tag> tags = TagUtils.populateTags(guides)
        File pageOutput = new File(pages.getAbsolutePath() + "/" + PAGE_NAME_GUIDES)
        pageOutput.createNewFile()
        pageOutput.text = "title: Guides | Grails Framework\nbody: guides\nJAVASCRIPT: ${url}/javascripts/search.js\n---\n" +
                GuidesPage.mainContent(classLoader, guides, tags)

        File tagsDir = new File(pages.getAbsolutePath() + "/" + TAGS)
        tagsDir.mkdir()
        for (Tag tag : tags) {
            String slug = "${tag.slug.toLowerCase()}.html"
            pageOutput = new File(tagsDir.getAbsolutePath() + "/" + slug)
            pageOutput.createNewFile()
            pageOutput.text = "---\ntitle: Guides with tag: ${tag} | Grails Framework\nbody: guides\n---\n" + GuidesPage.mainContent(classLoader, guides, tags, null, tag)
        }
        File categoriesDir = new File(pages.getAbsolutePath() + "/" + CATEGORIES)
        categoriesDir.mkdir()
        for (Category category : GuidesPage.categories().values() ) {
            String slug = "${category.slug.toLowerCase()}.html"
            pageOutput = new File(categoriesDir.getAbsolutePath() + "/" + slug)
            pageOutput.createNewFile()
            pageOutput.text = "---\ntitle: Guides at category ${category.name} | Grails Framework\nbody: guides\n---\n" + GuidesPage.mainContent(classLoader, guides, tags, category, null)
        }
    }