@@ -14,7 +14,7 @@ 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 patches ' ,
2020 'mkdir shared ' ,
@@ -36,11 +36,11 @@ public static function doDeploy($stage, $branch, $ldh)
3636 {
3737 // Some stuff that does not change in runtime
3838 $ releaseName = time ();
39- $ home = config ('laravel-deploy-helper.stages. ' . $ stage . '.remote.root ' );
40- $ shared = config ('laravel-deploy-helper.stages. ' . $ stage . '.shared ' );
41- $ commands = config ('laravel-deploy-helper.stages. ' . $ stage . '.commands ' );
42- $ versions = config ('laravel-deploy-helper.stages. ' . $ stage . '.config.dependencies ' );
43- $ keep = config ('laravel-deploy-helper.stages. ' . $ stage . '.config.keep ' );
39+ $ home = config ('laravel-deploy-helper.stages. ' . $ stage. '.remote.root ' );
40+ $ shared = config ('laravel-deploy-helper.stages. ' . $ stage. '.shared ' );
41+ $ commands = config ('laravel-deploy-helper.stages. ' . $ stage. '.commands ' );
42+ $ versions = config ('laravel-deploy-helper.stages. ' . $ stage. '.config.dependencies ' );
43+ $ keep = config ('laravel-deploy-helper.stages. ' . $ stage. '.config.keep ' );
4444
4545 // Check what releases are old and can be removed
4646 // Adding the array fixed #1
@@ -56,74 +56,74 @@ public static function doDeploy($stage, $branch, $ldh)
5656
5757 // Check versions
5858 // Operators: http://php.net/manual/en/function.version-compare.php
59- verbose ('[ ' . $ stage . '] Checking dependencies. Might take a minute. ' );
59+ verbose ('[ ' . $ stage. '] Checking dependencies. Might take a minute. ' );
6060 foreach ($ versions as $ app => $ version ) {
61- // if (SSH::checkAppVersion($connection, $app, $version) == '-1') {
61+ // if (SSH::checkAppVersion($connection, $app, $version) == '-1') {
6262// Locker::unlock($connection, $stage);
6363// throw new \Exception('Version of ' . $app . ' does not match your requirements');
6464// }
6565 SSH ::checkAppVersion ($ connection , $ app , $ version );
6666 }
6767
6868 // Define the deploy
69- verbose ('[ ' . $ stage . '] Creating new release directory and pulling from remote ' );
69+ verbose ('[ ' . $ stage. '] Creating new release directory and pulling from remote ' );
7070 // Fixes https://github.com/DALTCORE/laravel-deploy-helper/issues/6#issuecomment-315124310
71- $ url = config ('laravel-deploy-helper.stages. ' . $ stage . '.git.http ' );
71+ $ url = config ('laravel-deploy-helper.stages. ' . $ stage. '.git.http ' );
7272 if ($ url === null ) {
73- $ url = config ('laravel-deploy-helper.stages. ' . $ stage . '.git ' );
73+ $ url = config ('laravel-deploy-helper.stages. ' . $ stage. '.git ' );
7474 }
7575
76- SSH ::execute ($ stage , ['mkdir ' . $ home . '/releases/ ' . $ releaseName ]);
76+ SSH ::execute ($ stage , ['mkdir ' . $ home. '/releases/ ' . $ releaseName ]);
7777 SSH ::execute (
7878 $ stage ,
7979 [
80- 'cd ' . $ home . '/releases/ ' . $ releaseName . '; ' .
81- 'git clone -b ' . $ branch . ' ' . "' " . $ url . "' " . ' . '
80+ 'cd ' . $ home. '/releases/ ' . $ releaseName. '; ' .
81+ 'git clone -b ' . $ branch. ' ' . "' " . $ url. "' " . ' . ' ,
8282 ]
8383 );
8484
8585 // Pre-flight for shared stuff
8686 $ items ['directories ' ] = [];
8787 foreach ($ shared ['directories ' ] as $ share ) {
88- verbose ('[ ' . $ stage . '] About to share directory " ' . $ home . '/current/ ' . $ share . '" ' );
89- SSH ::execute ($ stage , ['[ -e ' . $ home . '/current/ ' . $ share . ' ] && cp -R -p ' . $ home . '/current/ '
90- . $ share . ' ' . $ home . '/shared/ ' . $ share ]);
88+ verbose ('[ ' . $ stage. '] About to share directory " ' . $ home. '/current/ ' . $ share. '" ' );
89+ SSH ::execute ($ stage , ['[ -e ' . $ home. '/current/ ' . $ share. ' ] && cp -R -p ' . $ home. '/current/ '
90+ .$ share. ' ' . $ home. '/shared/ ' . $ share, ]);
9191 SSH ::execute (
9292 $ stage ,
93- [$ items ['directories ' ][] = '[ -e ' . $ home . '/shared/ ' . $ share . ' ] && cp -R -p ' . $ home .
94- '/shared/ ' . $ share . ' ' . $ home . '/releases/ ' . $ releaseName ]
93+ [$ items ['directories ' ][] = '[ -e ' . $ home. '/shared/ ' . $ share. ' ] && cp -R -p ' . $ home .
94+ '/shared/ ' . $ share. ' ' . $ home. '/releases/ ' . $ releaseName, ]
9595 );
9696 }
9797 // Pre-flight for shared stuff
9898 $ items ['files ' ] = [];
9999 foreach ($ shared ['files ' ] as $ share ) {
100- verbose ('[ ' . $ stage . '] About to share file " ' . $ home . '/current/ ' . $ share . '" ' );
101- SSH ::execute ($ stage , ['[ -e ' . $ home . '/current/ ' . $ share . ' ] && cp -p ' . $ home . '/current/ ' . $ share
102- . ' ' . $ home . '/shared/ ' . $ share ]);
103- SSH ::execute ($ stage , ['[ -e ' . $ home . '/shared/ ' . $ share . ' ] && cp -p ' . $ home . '/shared/ ' . $ share .
104- ' ' . $ home . '/releases/ ' . $ releaseName . '/ ' . $ share ]);
100+ verbose ('[ ' . $ stage. '] About to share file " ' . $ home. '/current/ ' . $ share. '" ' );
101+ SSH ::execute ($ stage , ['[ -e ' . $ home. '/current/ ' . $ share. ' ] && cp -p ' . $ home. '/current/ ' . $ share
102+ .' ' . $ home. '/shared/ ' . $ share, ]);
103+ SSH ::execute ($ stage , ['[ -e ' . $ home. '/shared/ ' . $ share. ' ] && cp -p ' . $ home. '/shared/ ' . $ share .
104+ ' ' . $ home. '/releases/ ' . $ releaseName. '/ ' . $ share, ]);
105105 }
106106
107107 // Define commands
108- verbose ('[ ' . $ stage . '] Executing custom commands ' );
108+ verbose ('[ ' . $ stage. '] Executing custom commands ' );
109109 $ items = [];
110110 foreach ($ commands as $ command ) {
111- SSH ::execute ($ stage , ['cd ' . $ home . '/releases/ ' . $ releaseName . ' && ' . $ command ]);
111+ SSH ::execute ($ stage , ['cd ' . $ home. '/releases/ ' . $ releaseName. ' && ' . $ command ]);
112112 }
113113
114114 // Define post deploy actions
115- verbose ('[ ' . $ stage . '] Linking new release to /current directory and removing temp ' );
115+ verbose ('[ ' . $ stage. '] Linking new release to /current directory and removing temp ' );
116116 SSH ::execute ($ stage , [
117- 'ln -sfn ' . $ home . '/releases/ ' . $ releaseName . ' ' . $ home . '/current ' ,
118- 'rm -rf ' . $ home . '/shared/* ' ,
117+ 'ln -sfn ' . $ home. '/releases/ ' . $ releaseName. ' ' . $ home. '/current ' ,
118+ 'rm -rf ' . $ home. '/shared/* ' ,
119119 ]);
120120
121121 // Remove old deploys
122122 if (isset ($ toRemove ) && is_array ($ toRemove )) {
123123 $ items = [];
124- verbose ('[ ' . $ stage . '] Cleaning up old releases ' );
124+ verbose ('[ ' . $ stage. '] Cleaning up old releases ' );
125125 foreach ($ toRemove as $ dir => $ val ) {
126- SSH ::execute ($ stage , ['echo "Removing release ' . $ dir . '" && rm -rf ' . $ home . '/releases/ ' . $ dir ]);
126+ SSH ::execute ($ stage , ['echo "Removing release ' . $ dir. '" && rm -rf ' . $ home. '/releases/ ' . $ dir ]);
127127 }
128128 }
129129
@@ -137,15 +137,15 @@ public static function doDeploy($stage, $branch, $ldh)
137137 */
138138 public static function doRollback (Connection $ connection , $ stage , $ ldh , $ dirs )
139139 {
140- $ home = config ('laravel-deploy-helper.stages. ' . $ stage . '.remote.root ' );
140+ $ home = config ('laravel-deploy-helper.stages. ' . $ stage. '.remote.root ' );
141141
142142 // Define post deploy actions
143143 $ connection ->define ('preformRollback ' , [
144- 'ln -sfn ' . $ home . '/releases/ ' . $ dirs [1 ] . ' ' . $ home . '/current ' ,
145- 'rm -rf ' . $ home . '/releases/ ' . $ dirs [0 ],
144+ 'ln -sfn ' . $ home. '/releases/ ' . $ dirs [1 ]. ' ' . $ home. '/current ' ,
145+ 'rm -rf ' . $ home. '/releases/ ' . $ dirs [0 ],
146146 ]);
147147
148- verbose ("\t" . 'Hold my beer, We \'re rolling back ' );
148+ verbose ("\t" . 'Hold my beer, We \'re rolling back ' );
149149 $ connection ->task ('preformRollback ' );
150150
151151 unset($ dirs [0 ]);
@@ -165,26 +165,26 @@ public static function doRollback(Connection $connection, $stage, $ldh, $dirs)
165165 */
166166 public static function doPatch ($ stage , $ branch )
167167 {
168- $ home = config ('laravel-deploy-helper.stages. ' . $ stage . '.remote.root ' );
168+ $ home = config ('laravel-deploy-helper.stages. ' . $ stage. '.remote.root ' );
169169
170170 // setup ssh connection to remote
171171 $ connection = SSH ::instance ()->into ($ stage );
172172
173173 $ connection ->define ('preformPatch ' , [
174- Command::builder ('cd ' , [$ home . '/current ' ]),
174+ Command::builder ('cd ' , [$ home. '/current ' ]),
175175 Command::builder ('ls ' , ['-haml ' ]),
176176
177177 Command::builder ('git ' , ['config ' , 'user.email ' , 'git+LDH@localhost.ext ' ]),
178178 Command::builder ('git ' , ['config ' , 'user.name ' , 'LDH ' ]),
179179
180180 Command::builder ('git ' , ['fetch ' ]),
181181 Command::builder ('git ' ,
182- ['format-patch ' , '-1 ' , 'origin/ ' . $ branch , 'FETCH_HEAD ' , '-o ' , $ home . '/patches ' ]),
183- 'git apply --reject --whitespace=fix ' . $ home . '/patches/* ' ,
184- Command::builder ('rm ' , ['-rf ' , $ home . '/patches ' ]),
182+ ['format-patch ' , '-1 ' , 'origin/ ' . $ branch , 'FETCH_HEAD ' , '-o ' , $ home. '/patches ' ]),
183+ 'git apply --reject --whitespace=fix ' . $ home. '/patches/* ' ,
184+ Command::builder ('rm ' , ['-rf ' , $ home. '/patches ' ]),
185185 ]);
186186
187- verbose ("\t" . 'Hold on tight, trying to patch! ' );
187+ verbose ("\t" . 'Hold on tight, trying to patch! ' );
188188 $ connection ->task ('preformPatch ' );
189189 }
190190}
0 commit comments