1
1
<?php
2
2
3
3
/*!
4
- * Pattern Lab StartKit Class - v0.7.12
4
+ * StarterKit Class
5
5
*
6
6
* Copyright (c) 2014 Dave Olsen, http://dmolsen.com
7
7
* Licensed under the MIT license
12
12
13
13
namespace PatternLab ;
14
14
15
+ use \Alchemy \Zippy \Zippy ;
16
+ use \PatternLab \Config ;
17
+
15
18
class StarterKit {
16
19
17
20
/**
18
21
* Set-up a default var
19
22
*/
20
- public function __construct ($ config ) {
21
- $ this ->sourceDir = __DIR__ ."/../../../ " .$ config ["sourceDir " ];
22
- if (!is_dir ($ this ->sourceDir )) {
23
+ public function __construct () {
24
+ if (!is_dir (Config::$ options ["sourceDir " ])) {
23
25
print "Check to make sure your source directory is configured properly... \n" ;
24
26
exit ;
25
27
}
@@ -60,7 +62,7 @@ public function fetch($starterKit) {
60
62
61
63
// see if the source directory is empty
62
64
$ emptyDir = true ;
63
- $ objects = new \DirectoryIterator ($ this -> sourceDir );
65
+ $ objects = new \DirectoryIterator (Config:: $ options [ " sourceDir " ] );
64
66
foreach ($ objects as $ object ) {
65
67
if (!$ object ->isDot () && ($ object ->getFilename () != "README " ) && ($ object ->getFilename () != ".DS_Store " )) {
66
68
$ emptyDir = false ;
@@ -79,7 +81,7 @@ public function fetch($starterKit) {
79
81
80
82
print "nuking everything in source/... \n" ;
81
83
82
- $ objects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ this -> sourceDir ), \RecursiveIteratorIterator::CHILD_FIRST );
84
+ $ objects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator (Config:: $ options [ " sourceDir " ] ), \RecursiveIteratorIterator::CHILD_FIRST );
83
85
84
86
// make sure dots are skipped
85
87
$ objects ->setFlags (\FilesystemIterator::SKIP_DOTS );
@@ -103,10 +105,10 @@ public function fetch($starterKit) {
103
105
}
104
106
105
107
// extract
106
- $ zippy = \ Alchemy \ Zippy \ Zippy::load ();
108
+ $ zippy = Zippy::load ();
107
109
$ zipAdapter = $ zippy ->getAdapterFor ('tar.gz ' );
108
110
$ archiveZip = $ zipAdapter ->open ($ tempFile );
109
- $ archiveZip = $ archiveZip ->extract ($ this -> sourceDir );
111
+ $ archiveZip = $ archiveZip ->extract (Config:: $ options [ " sourceDir " ] );
110
112
111
113
// remove the temp file
112
114
unlink ($ tempFile );
0 commit comments