-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployeer
executable file
·48 lines (37 loc) · 1.46 KB
/
deployeer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env php
<?php
error_reporting(E_ERROR);
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/env-init.php';
//WRITE paths to directories what you want synchronize (relative to ROOT PROJECT (where is assets-deployeer folder) directory)
define('DIRECTORIES', explode(',', env('DEPLOY_DIRECTORIES')));
define('DEPLOY_WAY', env('DEPLOY_WAY')); //or ftp
//for sftp
define('SFTP_HOST', env('SFTP_HOST'));
define('SFTP_PORT', env('SFTP_PORT'));
define('SFTP_LOGIN', env('SFTP_LOGIN'));
define('SFTP_PASSWORD', env('SFTP_PASSWORD'));
define('SFTP_BASEPATH', env('SFTP_BASEPATH'));
//for ftp
define('FTP_HOST', env('FTP_HOST'));
define('FTP_PORT', env('FTP_PORT'));
define('FTP_LOGIN', env('FTP_LOGIN'));
define('FTP_PASSWORD', env('FTP_PASSWORD'));
define('FTP_BASEPATH', env('FTP_BASEPATH'));
define('FTP_PASSIVE_MODE', env('FTP_PASSIVE_MODE'));
define('ROOT', env('ROOT'));
define('STORE_PATH', __DIR__ . '/store'); //path to cache directory, may no change
try {
spl_autoload_register(function ($class) {
if(!preg_match('/^AssetsDeployeer/', $class))
return;
$class = str_replace('AssetsDeployeer\\', '', $class);
include 'lib/' . str_replace('\\', '/', $class) . '.php';
});
} catch (Exception $e) {
exit('Autoload error' . PHP_EOL);
}
$args = array_slice($argv, 1);
if(!in_array($args[0], ['push', 'clear-cache', 'refresh-cache']))
exit('Please send correct command' . PHP_EOL);
require_once("commands/$args[0].php");