1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.codehaus.gmavenplus.groovyworkarounds;
18
19 import org.codehaus.gmavenplus.model.internal.Version;
20
21 import static org.codehaus.gmavenplus.util.ClassWrangler.groovyAtLeast;
22
23
24
25
26
27
28
29 public class GroovyDocTemplateInfo {
30
31
32
33
34 protected static final Version GROOVY_2_5_0 = new Version(2, 5, 0);
35
36
37
38
39 protected static final Version GROOVY_1_6_2 = new Version(1, 6, 2);
40
41
42
43
44 protected static final Version GROOVY_1_6_0 = new Version(1, 6, 0);
45
46
47
48
49 protected static final Version GROOVY_1_6_0_RC2 = new Version(1, 6, 0, "RC-2");
50
51
52
53
54 protected final Version groovyVersion;
55
56
57
58
59 protected final String templateBaseDir;
60
61
62
63
64
65
66 public GroovyDocTemplateInfo(Version version) {
67 groovyVersion = version;
68 if (groovyAtLeast(groovyVersion, GROOVY_1_6_2)) {
69 templateBaseDir = "org/codehaus/groovy/tools/groovydoc/gstringTemplates/";
70 } else {
71 templateBaseDir = "org/codehaus/groovy/tools/groovydoc/gstring-templates/";
72 }
73 }
74
75 public String[] defaultDocTemplates() {
76 if (groovyAtLeast(groovyVersion, GROOVY_2_5_0)) {
77 return new String[]{
78 templateBaseDir + "topLevel/index.html",
79 templateBaseDir + "topLevel/overview-frame.html",
80 templateBaseDir + "topLevel/allclasses-frame.html",
81 templateBaseDir + "topLevel/overview-summary.html",
82 templateBaseDir + "topLevel/help-doc.html",
83 templateBaseDir + "topLevel/index-all.html",
84 templateBaseDir + "topLevel/deprecated-list.html",
85 templateBaseDir + "topLevel/stylesheet.css",
86 templateBaseDir + "topLevel/inherit.gif",
87 "org/apache/groovy/docgenerator/groovy.ico"
88 };
89 } else if (groovyAtLeast(groovyVersion, GROOVY_1_6_2)) {
90 return new String[]{
91 templateBaseDir + "topLevel/index.html",
92 templateBaseDir + "topLevel/overview-frame.html",
93 templateBaseDir + "topLevel/allclasses-frame.html",
94 templateBaseDir + "topLevel/overview-summary.html",
95 templateBaseDir + "topLevel/help-doc.html",
96 templateBaseDir + "topLevel/index-all.html",
97 templateBaseDir + "topLevel/deprecated-list.html",
98 templateBaseDir + "topLevel/stylesheet.css",
99 templateBaseDir + "topLevel/inherit.gif",
100 "org/codehaus/groovy/tools/groovy.ico"
101 };
102 } else if (groovyAtLeast(groovyVersion, GROOVY_1_6_0)) {
103 return new String[]{
104 templateBaseDir + "top-level/index.html",
105 templateBaseDir + "top-level/overview-frame.html",
106 templateBaseDir + "top-level/allclasses-frame.html",
107 templateBaseDir + "top-level/overview-summary.html",
108 templateBaseDir + "top-level/help-doc.html",
109 templateBaseDir + "top-level/index-all.html",
110 templateBaseDir + "top-level/deprecated-list.html",
111 templateBaseDir + "top-level/stylesheet.css",
112 templateBaseDir + "top-level/inherit.gif"
113 };
114 } else if (groovyAtLeast(groovyVersion, GROOVY_1_6_0_RC2)) {
115 return new String[]{
116 templateBaseDir + "top-level/index.html",
117 templateBaseDir + "top-level/overview-frame.html",
118 templateBaseDir + "top-level/allclasses-frame.html",
119 templateBaseDir + "top-level/overview-summary.html",
120 templateBaseDir + "top-level/stylesheet.css",
121 templateBaseDir + "top-level/inherit.gif"
122 };
123 } else {
124 return new String[]{
125 templateBaseDir + "top-level/index.html",
126 templateBaseDir + "top-level/overview-frame.html",
127 templateBaseDir + "top-level/allclasses-frame.html",
128 templateBaseDir + "top-level/overview-summary.html",
129 templateBaseDir + "top-level/stylesheet.css"
130 };
131 }
132 }
133
134 public String[] defaultPackageTemplates() {
135 if (groovyAtLeast(groovyVersion, GROOVY_1_6_2)) {
136 return new String[]{
137 templateBaseDir + "packageLevel/package-frame.html",
138 templateBaseDir + "packageLevel/package-summary.html"
139 };
140 } else {
141 return new String[]{
142 templateBaseDir + "package-level/package-frame.html",
143 templateBaseDir + "package-level/package-summary.html"
144 };
145 }
146 }
147
148 public String[] defaultClassTemplates() {
149 if (groovyAtLeast(groovyVersion, GROOVY_1_6_2)) {
150 return new String[]{
151 templateBaseDir + "classLevel/classDocName.html"
152 };
153 } else {
154 return new String[]{
155 templateBaseDir + "class-level/classDocName.html"
156 };
157 }
158 }
159
160 }