@@ -39,16 +39,15 @@ class ProjectTask extends Shell {
39
39
*
40
40
* @param string $project Project path
41
41
*/
42
- public function execute ($ project = null ) {
43
- if ($ project === null ) {
44
- if (isset ($ this ->args [0 ])) {
45
- $ project = $ this ->args [0 ];
46
- }
42
+ public function execute () {
43
+ $ project = null ;
44
+ if (isset ($ this ->args [0 ])) {
45
+ $ project = $ this ->args [0 ];
47
46
}
48
47
49
48
if ($ project ) {
50
49
$ this ->Dispatch ->parseParams (array ('-app ' , $ project ));
51
- $ project = $ this ->params ['working ' ];
50
+ $ project = $ this ->Dispatch -> params ['working ' ];
52
51
}
53
52
54
53
if (empty ($ this ->params ['skel ' ])) {
@@ -60,14 +59,14 @@ public function execute($project = null) {
60
59
61
60
while (!$ project ) {
62
61
$ prompt = __ ("What is the full path for this app including the app directory name? \n Example: " );
63
- $ default = $ this ->params ['working ' ] . DS . 'myapp ' ;
62
+ $ default = $ this ->Dispatch -> params ['working ' ] . DS . 'myapp ' ;
64
63
$ project = $ this ->in ($ prompt . $ default , null , $ default );
65
64
}
66
65
67
66
if ($ project ) {
68
67
$ response = false ;
69
68
while ($ response == false && is_dir ($ project ) === true && file_exists ($ project . 'config ' . 'core.php ' )) {
70
- $ prompt = sprintf (__ ('A project already exists in this location: %s Overwrite? ' ), $ project );
69
+ $ prompt = sprintf (__ ('<warning> A project already exists in this location:</warning> %s Overwrite? ' ), $ project );
71
70
$ response = $ this ->in ($ prompt , array ('y ' ,'n ' ), 'n ' );
72
71
if (strtolower ($ response ) === 'n ' ) {
73
72
$ response = $ project = false ;
@@ -80,7 +79,7 @@ public function execute($project = null) {
80
79
if ($ this ->createHome ($ path )) {
81
80
$ this ->out (__ ('Welcome page created ' ));
82
81
} else {
83
- $ this ->out (__ ('The Welcome page was NOT created ' ));
82
+ $ this ->out (__ ('The Welcome page was <error> NOT</error> created ' ));
84
83
}
85
84
86
85
if ($ this ->securitySalt ($ path ) === true ) {
@@ -109,8 +108,8 @@ public function execute($project = null) {
109
108
$ this ->out (sprintf (__ ('chmod -R 0777 %s ' ), $ path . DS .'tmp ' ));
110
109
}
111
110
112
- $ this ->params ['working ' ] = $ path ;
113
- $ this ->params ['app ' ] = basename ($ path );
111
+ $ this ->Dispatch -> params ['working ' ] = $ path ;
112
+ $ this ->Dispatch -> params ['app ' ] = basename ($ path );
114
113
return true ;
115
114
}
116
115
}
@@ -133,7 +132,7 @@ function bake($path, $skel = null, $skip = array('empty')) {
133
132
while (!$ skel ) {
134
133
$ skel = $ this ->in (sprintf (__ ("What is the path to the directory layout you wish to copy? \nExample: %s " ), APP , null , ROOT . DS . 'myapp ' . DS ));
135
134
if ($ skel == '' ) {
136
- $ this ->out (__ ('The directory path you supplied was empty. Please try again. ' ));
135
+ $ this ->err (__ ('The directory path you supplied was empty. Please try again. ' ));
137
136
} else {
138
137
while (is_dir ($ skel ) === false ) {
139
138
$ skel = $ this ->in (__ ('Directory path does not exist please choose another: ' ));
@@ -151,25 +150,21 @@ function bake($path, $skel = null, $skip = array('empty')) {
151
150
$ looksGood = $ this ->in (__ ('Look okay? ' ), array ('y ' , 'n ' , 'q ' ), 'y ' );
152
151
153
152
if (strtolower ($ looksGood ) == 'y ' ) {
154
- $ verbose = $ this ->in (__ ('Do you want verbose output? ' ), array ('y ' , 'n ' ), 'n ' );
155
-
156
153
$ Folder = new Folder ($ skel );
157
154
if (!empty ($ this ->params ['empty ' ])) {
158
155
$ skip = array ();
159
156
}
160
157
if ($ Folder ->copy (array ('to ' => $ path , 'skip ' => $ skip ))) {
161
158
$ this ->hr ();
162
- $ this ->out (sprintf (__ ('Created: %s in %s ' ), $ app , $ path ));
159
+ $ this ->out (sprintf (__ ('<success> Created:</success> %s in %s ' ), $ app , $ path ));
163
160
$ this ->hr ();
164
161
} else {
165
162
$ this ->err (sprintf (__ (" '%s' could not be created properly " ), $ app ));
166
163
return false ;
167
164
}
168
165
169
- if (strtolower ($ verbose ) == 'y ' ) {
170
- foreach ($ Folder ->messages () as $ message ) {
171
- $ this ->out ($ message );
172
- }
166
+ foreach ($ Folder ->messages () as $ message ) {
167
+ $ this ->out ($ message , 1 , Shell::VERBOSE );
173
168
}
174
169
175
170
return true ;
0 commit comments