Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a 'migrate-docs' command.

  • Loading branch information...
commit cd10d48bf011ced7fe700379a674de490937ad66 1 parent 28be238
@pledbrook pledbrook authored
Showing with 44 additions and 0 deletions.
  1. +30 −0 scripts/MigrateDocs.groovy
  2. +14 −0 scripts/_GrailsDocs.groovy
View
30 scripts/MigrateDocs.groovy
@@ -0,0 +1,30 @@
+/*
+* Copyright 2004-2005 the original author or authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/**
+ * @author Peter Ledbrook
+ * @since 2.0
+ */
+
+includeTargets << grailsScript("_GrailsDocs")
+
+USAGE = """
+ migrate-docs
+"""
+
+target(default: "Migrates an old-style user guide to the YAML TOC based one.") {
+ depends parseArguments, migrateDocs
+}
View
14 scripts/_GrailsDocs.groovy
@@ -21,6 +21,7 @@ import org.codehaus.groovy.grails.resolve.IvyDependencyManager
import grails.util.GrailsNameUtils
import grails.doc.DocPublisher
+import grails.doc.LegacyDocMigrator
import grails.doc.PdfBuilder
/**
@@ -326,6 +327,19 @@ target(createIndex: "Produces an index.html page in the root directory") {
}
}
+target(migrateDocs: "Migrates an old-style gdoc user guide to the current approach using a YAML TOC file.") {
+ depends createConfig
+
+ def guideDir = new File(grailsSettings.baseDir, "src/docs/guide")
+ if (guideDir.exists()) {
+ def outDir = new File(guideDir.parentFile, "migratedGuide")
+ def migrator = new LegacyDocMigrator(guideDir, outDir, config.grails.doc.alias)
+ migrator.migrate()
+
+ grailsConsole.updateStatus "Migrated user guide at ${outDir.path}"
+ }
+}
+
def readPluginMetadataForDocs(DocPublisher publisher) {
def basePlugin = loadBasePlugin()?.instance
if (basePlugin) {
Please sign in to comment.
Something went wrong with that request. Please try again.