|
19 | 19 | class Snapshot {
|
20 | 20 |
|
21 | 21 | /**
|
22 |
| - * Set-up a default var |
| 22 | + * Set-up default vars |
23 | 23 | */
|
24 | 24 | public function __construct($config) {
|
25 |
| - $this->publicDir = __DIR__."/../../../".$config["publicDir"]; |
26 |
| - $this->sourceDir = "/../../../".$config["sourceDir"]."/_patterns".DIRECTORY_SEPARATOR; |
| 25 | + $this->publicDir = __DIR__."/../../../".Config::$options["sourceDir"]; |
| 26 | + $this->sourceDir = "/../../../".Config::$options["sourceDir"]."/_patterns".DIRECTORY_SEPARATOR; |
27 | 27 | $this->snapshotsBase = $this->publicDir."/snapshots/";
|
28 | 28 | }
|
29 | 29 |
|
30 | 30 | /**
|
31 |
| - * Get the arguments that have been passed to the script via the commmand line |
| 31 | + * Take a snap shot of the public dir |
| 32 | + * @param {String} the directory where we wil be writing the snapshot |
32 | 33 | */
|
33 | 34 | public function takeSnapshot($dir) {
|
34 | 35 |
|
@@ -80,7 +81,7 @@ public function takeSnapshot($dir) {
|
80 | 81 |
|
81 | 82 | // iterate over all of the other files in the source directory
|
82 | 83 | $directoryIterator = new \RecursiveDirectoryIterator($this->publicDir);
|
83 |
| - $filteredIterator = new SnapshotFilterIterator($directoryIterator); |
| 84 | + $filteredIterator = new FilterIterator($directoryIterator); |
84 | 85 | $objects = new \RecursiveIteratorIterator($filteredIterator, \RecursiveIteratorIterator::SELF_FIRST);
|
85 | 86 |
|
86 | 87 | // make sure dots are skipped
|
@@ -123,17 +124,14 @@ public function takeSnapshot($dir) {
|
123 | 124 |
|
124 | 125 | $d = array("html" => $html);
|
125 | 126 |
|
126 |
| - $templateLoader = new TemplateLoader(); |
127 |
| - $templateHelper = new TemplateHelper($this->sourceDir); |
| 127 | + TemplateHelper::setup(); |
128 | 128 |
|
129 | 129 | // render the viewall template
|
130 |
| - $v = $templateLoader->vanilla(); |
131 |
| - $h = $v->render($templateHelper->mainPageHead); |
132 |
| - $f = $v->render($templateHelper->mainPageFoot); |
| 130 | + $h = Helper::$htmlLoader->render(Helper::$mainPageHead); |
| 131 | + $f = Helper::$htmlLoader->render(Helper::$mainPageFoot); |
133 | 132 |
|
134 | 133 | // render the snapshot page
|
135 |
| - $m = $templateLoader->fileSystem(); |
136 |
| - $r = $m->render('snapshot', $d); |
| 134 | + $r = Helper::$filesystemLoader->render("snapshot", $d); |
137 | 135 | $r = $h.$r.$f;
|
138 | 136 |
|
139 | 137 | file_put_contents($this->snapshotsBase."index.html",$r);
|
|
0 commit comments