@@ -14,10 +14,10 @@ public static function freshInit(Connection $connection, $stage)
1414 {
1515 // Init fresh remote repo
1616 $ connection ->define ('init ' , [
17- 'cd ' . config ('laravel-deploy-helper.stages. ' . $ stage . '.remote.root ' ),
17+ 'cd ' . config ('laravel-deploy-helper.stages. ' . $ stage. '.remote.root ' ),
1818 'mkdir releases ' ,
1919 'mkdir shared ' ,
20- 'touch ldh.json '
20+ 'touch ldh.json ' ,
2121 ]);
2222 $ connection ->task ('init ' );
2323 }
@@ -34,11 +34,11 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
3434 {
3535 // Some stuff that does not change in runtime
3636 $ releaseName = time ();
37- $ home = config ('laravel-deploy-helper.stages. ' . $ stage . '.remote.root ' );
38- $ shared = config ('laravel-deploy-helper.stages. ' . $ stage . '.shared ' );
39- $ commands = config ('laravel-deploy-helper.stages. ' . $ stage . '.commands ' );
40- $ versions = config ('laravel-deploy-helper.stages. ' . $ stage . '.config.dependencies ' );
41- $ keep = config ('laravel-deploy-helper.stages. ' . $ stage . '.config.keep ' );
37+ $ home = config ('laravel-deploy-helper.stages. ' . $ stage. '.remote.root ' );
38+ $ shared = config ('laravel-deploy-helper.stages. ' . $ stage. '.shared ' );
39+ $ commands = config ('laravel-deploy-helper.stages. ' . $ stage. '.commands ' );
40+ $ versions = config ('laravel-deploy-helper.stages. ' . $ stage. '.config.dependencies ' );
41+ $ keep = config ('laravel-deploy-helper.stages. ' . $ stage. '.config.keep ' );
4242
4343 // Check what releases are old and can be removed
4444 ksort ($ ldh );
@@ -48,35 +48,35 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
4848
4949 // Check versions
5050 // Operators: http://php.net/manual/en/function.version-compare.php
51- verbose ('[ ' . $ stage . '] Checking dependencies. Migth take a minute. ' );
51+ verbose ('[ ' . $ stage. '] Checking dependencies. Migth take a minute. ' );
5252 foreach ($ versions as $ app => $ version ) {
5353 SSH ::checkAppVersion ($ connection , $ app , $ version );
5454 }
5555
5656 // Define the deploy
5757 $ connection ->define ('deploy ' , [
58- 'mkdir ' . $ home . '/releases/ ' . $ releaseName ,
59- 'cd ' . $ home . '/releases/ ' . $ releaseName ,
60- 'git clone -b ' . $ branch . ' ' . config ('laravel-deploy-helper.stages. ' . $ stage . '.git.http ' ) . ' . '
58+ 'mkdir ' . $ home. '/releases/ ' . $ releaseName ,
59+ 'cd ' . $ home. '/releases/ ' . $ releaseName ,
60+ 'git clone -b ' . $ branch. ' ' . config ('laravel-deploy-helper.stages. ' . $ stage. '.git.http ' ). ' . ' ,
6161 ]);
6262
6363 // Pre-flight for shared stuff
6464 $ items ['directories ' ] = [];
6565 foreach ($ shared ['directories ' ] as $ share ) {
66- verbose ('[ ' . $ stage . '] About to share direcroty " ' . $ home . '/current/ ' . $ share . '" ' );
67- $ items ['directories ' ][] = '[ -e ' . $ home . '/current/ ' . $ share . ' ] && cp -R -p ' . $ home . '/current/ '
68- . $ share . ' ' . $ home . '/shared/ ' . $ share ;
69- $ items ['directories ' ][] = '[ -e ' . $ home . '/shared/ ' . $ share . ' ] && cp -R -p ' . $ home . '/shared/ ' .
70- $ share . ' ' . $ home . '/releases/ ' . $ releaseName ;
66+ verbose ('[ ' . $ stage. '] About to share direcroty " ' . $ home. '/current/ ' . $ share. '" ' );
67+ $ items ['directories ' ][] = '[ -e ' . $ home. '/current/ ' . $ share. ' ] && cp -R -p ' . $ home. '/current/ '
68+ .$ share. ' ' . $ home. '/shared/ ' . $ share ;
69+ $ items ['directories ' ][] = '[ -e ' . $ home. '/shared/ ' . $ share. ' ] && cp -R -p ' . $ home. '/shared/ ' .
70+ $ share. ' ' . $ home. '/releases/ ' . $ releaseName ;
7171 }
7272 // Pre-flight for shared stuff
7373 $ items ['files ' ] = [];
7474 foreach ($ shared ['files ' ] as $ share ) {
75- verbose ('[ ' . $ stage . '] About to share file " ' . $ home . '/current/ ' . $ share . '" ' );
76- $ items ['files ' ][] = '[ -e ' . $ home . '/current/ ' . $ share . ' ] && cp -p ' . $ home . '/current/ ' . $ share
77- . ' ' . $ home . '/shared/ ' . $ share ;
78- $ items ['files ' ][] = '[ -e ' . $ home . '/shared/ ' . $ share . ' ] && cp -p ' . $ home . '/shared/ ' . $ share .
79- ' ' . $ home . '/releases/ ' . $ releaseName . '/ ' . $ share ;
75+ verbose ('[ ' . $ stage. '] About to share file " ' . $ home. '/current/ ' . $ share. '" ' );
76+ $ items ['files ' ][] = '[ -e ' . $ home. '/current/ ' . $ share. ' ] && cp -p ' . $ home. '/current/ ' . $ share
77+ .' ' . $ home. '/shared/ ' . $ share ;
78+ $ items ['files ' ][] = '[ -e ' . $ home. '/shared/ ' . $ share. ' ] && cp -p ' . $ home. '/shared/ ' . $ share .
79+ ' ' . $ home. '/releases/ ' . $ releaseName. '/ ' . $ share ;
8080 }
8181
8282 // Define shared files
@@ -87,36 +87,36 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
8787
8888 $ items = [];
8989 foreach ($ commands as $ command ) {
90- $ items [] = 'cd ' . $ home . '/releases/ ' . $ releaseName . ' && ' . $ command ;
90+ $ items [] = 'cd ' . $ home. '/releases/ ' . $ releaseName. ' && ' . $ command ;
9191 }
9292 // Define commands
9393 $ connection ->define ('definedCommands ' , $ items );
9494
9595 // Define post deploy actions
9696 $ connection ->define ('postDeploy ' , [
97- 'ln -sfn ' . $ home . '/releases/ ' . $ releaseName . ' ' . $ home . '/current ' ,
98- 'rm -rf ' . $ home . '/shared/* '
97+ 'ln -sfn ' . $ home. '/releases/ ' . $ releaseName. ' ' . $ home. '/current ' ,
98+ 'rm -rf ' . $ home. '/shared/* ' ,
9999 ]);
100100
101101 // Remove old deploys
102102 $ items = [];
103103 foreach ($ toRemove as $ dir => $ val ) {
104- $ items [] = 'echo "Removing release ' . $ dir . '" && rm -rf ' . $ home . '/releases/ ' . $ dir ;
104+ $ items [] = 'echo "Removing release ' . $ dir. '" && rm -rf ' . $ home. '/releases/ ' . $ dir ;
105105 }
106106 $ connection ->define ('removeOld ' , $ items );
107107
108108 // Execute them!
109- verbose ('[ ' . $ stage . '] Deploying ' . $ branch . ' to server ' );
109+ verbose ('[ ' . $ stage. '] Deploying ' . $ branch. ' to server ' );
110110 $ connection ->task ('deploy ' );
111- verbose ('[ ' . $ stage . '] Handling shared files ' );
111+ verbose ('[ ' . $ stage. '] Handling shared files ' );
112112 $ connection ->task ('getSharedFiles ' );
113- verbose ('[ ' . $ stage . '] Handling shared directories ' );
113+ verbose ('[ ' . $ stage. '] Handling shared directories ' );
114114 $ connection ->task ('getSharedDirectories ' );
115- verbose ('[ ' . $ stage . '] Handling commands ' );
115+ verbose ('[ ' . $ stage. '] Handling commands ' );
116116 $ connection ->task ('definedCommands ' );
117- verbose ('[ ' . $ stage . '] Clean up and linking new instance ' );
117+ verbose ('[ ' . $ stage. '] Clean up and linking new instance ' );
118118 $ connection ->task ('postDeploy ' );
119- verbose ('[ ' . $ stage . '] Remove old deploys ' );
119+ verbose ('[ ' . $ stage. '] Remove old deploys ' );
120120 $ connection ->task ('removeOld ' );
121121
122122 $ ldh [$ releaseName ] = true ;
@@ -126,15 +126,15 @@ public static function doDeploy(Connection $connection, $stage, $branch, $ldh)
126126
127127 public static function doRollback (Connection $ connection , $ stage , $ ldh , $ dirs )
128128 {
129- $ home = config ('laravel-deploy-helper.stages. ' . $ stage . '.remote.root ' );
129+ $ home = config ('laravel-deploy-helper.stages. ' . $ stage. '.remote.root ' );
130130
131131 // Define post deploy actions
132132 $ connection ->define ('preformRollback ' , [
133- 'ln -sfn ' . $ home . '/releases/ ' . $ dirs [1 ] . ' ' . $ home . '/current ' ,
134- 'rm -rf ' . $ home . '/releases/ ' . $ dirs [0 ],
133+ 'ln -sfn ' . $ home. '/releases/ ' . $ dirs [1 ]. ' ' . $ home. '/current ' ,
134+ 'rm -rf ' . $ home. '/releases/ ' . $ dirs [0 ],
135135 ]);
136136
137- verbose ("\t" . 'Hold my beer, We \'re rolling back ' );
137+ verbose ("\t" . 'Hold my beer, We \'re rolling back ' );
138138 $ connection ->task ('preformRollback ' );
139139
140140 unset($ dirs [0 ]);
0 commit comments