@@ -214,7 +214,12 @@ protected function generateMainPages() {
214
214
$ styleGuideHead = $ this ->mv ->render ($ this ->mainPageHead ,$ sd );
215
215
$ styleGuideFoot = $ this ->mv ->render ($ this ->mainPageFoot ,$ sd );
216
216
$ styleGuidePage = $ styleGuideHead .$ this ->mfs ->render ('viewall ' ,$ sd ).$ styleGuideFoot ;
217
- file_put_contents ($ this ->pd ."/styleguide/html/styleguide.html " ,$ styleGuidePage );
217
+
218
+ if (!file_exists ($ this ->pd ."/styleguide/html/styleguide.html " )) {
219
+ print "ERROR: the main style guide wasn't written out. make sure public/styleguide exists. can copy core/styleguide \n" ;
220
+ } else {
221
+ file_put_contents ($ this ->pd ."/styleguide/html/styleguide.html " ,$ styleGuidePage );
222
+ }
218
223
219
224
}
220
225
@@ -223,6 +228,11 @@ protected function generateMainPages() {
223
228
*/
224
229
protected function generatePatterns () {
225
230
231
+ // make sure patterns exists
232
+ if (!is_dir ($ this ->pd ."/patterns " )) {
233
+ mkdir ($ this ->pd ."/patterns " );
234
+ }
235
+
226
236
// make sure the pattern header & footer are added
227
237
$ this ->addPatternHF = true ;
228
238
@@ -1172,21 +1182,25 @@ protected function updateChangeTime() {
1172
1182
*/
1173
1183
protected function cleanPublic () {
1174
1184
1175
- // find all of the patterns in public/. sort by the children first
1176
- $ objects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ this ->pd ."/patterns/ " ), \RecursiveIteratorIterator::CHILD_FIRST );
1177
-
1178
- // make sure dots are skipped
1179
- $ objects ->setFlags (\FilesystemIterator::SKIP_DOTS );
1180
-
1181
- // for each file figure out what to do with it
1182
- foreach ($ objects as $ name => $ object ) {
1185
+ // make sure patterns exists before trying to clean it
1186
+ if (is_dir ($ this ->pd ."/patterns " )) {
1187
+
1188
+ $ objects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ this ->pd ."/patterns/ " ), \RecursiveIteratorIterator::CHILD_FIRST );
1189
+
1190
+ // make sure dots are skipped
1191
+ $ objects ->setFlags (\FilesystemIterator::SKIP_DOTS );
1183
1192
1184
- if ($ object ->isDir ()) {
1185
- // if this is a directory remove it
1186
- rmdir ($ name );
1187
- } else if ($ object ->isFile () && ($ object ->getFilename () != "README " )) {
1188
- // if this is a file remove it
1189
- unlink ($ name );
1193
+ // for each file figure out what to do with it
1194
+ foreach ($ objects as $ name => $ object ) {
1195
+
1196
+ if ($ object ->isDir ()) {
1197
+ // if this is a directory remove it
1198
+ rmdir ($ name );
1199
+ } else if ($ object ->isFile () && ($ object ->getFilename () != "README " )) {
1200
+ // if this is a file remove it
1201
+ unlink ($ name );
1202
+ }
1203
+
1190
1204
}
1191
1205
1192
1206
}
0 commit comments