當前位置: 首頁>>代碼示例>>PHP>>正文


PHP runLocally函數代碼示例

本文整理匯總了PHP中runLocally函數的典型用法代碼示例。如果您正苦於以下問題:PHP runLocally函數的具體用法?PHP runLocally怎麽用?PHP runLocally使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了runLocally函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: kill

 public function kill()
 {
     if ($this->exists()) {
         writeln("<comment>Kill elasticsearch container {$this->container}</comment>");
         $command = Env::evalDocker() . "docker rm -f {$this->container}";
         runLocally($command);
     }
 }
開發者ID:ekandreas,項目名稱:docker-bedrock,代碼行數:8,代碼來源:Elasticsearch.php

示例2: postToSlack

function postToSlack($message)
{
    $slackHookUrl = env('SLACK_HOOK_URL');
    if (!empty($slackHookUrl)) {
        runLocally('curl -s -S -X POST --data-urlencode payload="{\\"channel\\": \\"#' . env('SLACK_CHANNEL_NAME') . '\\", \\"username\\": \\"Release Bot\\", \\"text\\": \\"' . $message . '\\"}"' . env('SLACK_HOOK_URL'));
    } else {
        write('Configure the SLACK_HOOK_URL to post to slack');
    }
}
開發者ID:cottacush,項目名稱:yii2-base-project,代碼行數:9,代碼來源:deploy.php

示例3: stop

 public function stop()
 {
     try {
         writeln("Stop docker-machine {$this->name}");
         $output = runLocally("docker-machine stop {$this->name}");
         writeln("<comment>Docker-machine {$this->name} stopped</comment>");
     } catch (Exception $ex) {
     }
 }
開發者ID:ekandreas,項目名稱:docker-laravel,代碼行數:9,代碼來源:Machine.php

示例4: exists

 public function exists()
 {
     $command = Env::evalDocker() . "docker inspect {$this->container}";
     try {
         $output = runLocally($command);
         return true;
     } catch (\Exception $ex) {
         return false;
     }
 }
開發者ID:ekandreas,項目名稱:docker-bedrock,代碼行數:10,代碼來源:Mysql.php

示例5: task

<?php

if (!class_exists('EkAndreas\\DockerBedrock\\Helpers')) {
    include_once 'src/DockerBedrock/Helpers.php';
}
use EkAndreas\DockerBedrock\Helpers;
$dir = Helpers::getProjectDir();
require_once $dir . '/vendor/autoload.php';
task('docker:start', function () {
    Helpers::start();
}, 999);
task('docker:up', function () {
    Helpers::start();
}, 999);
task('docker:stop', function () {
    Helpers::stop();
});
task('docker:halt', function () {
    Helpers::stop();
});
task('docker:kill', function () {
    Helpers::kill();
});
task('wpinit', function () {
    $server = env('server');
    runLocally("wp core install --url='{$server['name']}' --title='{$server['name']}' --admin_user='admin' --admin_password='admin' --admin_email='admin@{$server['name']}'");
});
開發者ID:ekandreas,項目名稱:docker-bedrock,代碼行數:27,代碼來源:recipe.php

示例6: input

        $sourceServerKey = input()->getOption('source-server');
    }
    $sourceServer = $serverList[$sourceServerKey];
    $destServer = $serverList[env('server.name')];
    runLocally("ssh {$sourceServer['user']}@{$sourceServer['host']} 'mysqldump -h {$sourceServer['app']['mysql']['host']} -u {$sourceServer['app']['mysql']['username']} -p{$sourceServer['app']['mysql']['password']} {$sourceServer['app']['mysql']['dbname']}  --skip-lock-tables --add-drop-table' | mysql -h {$destServer['app']['mysql']['host']} -u{$destServer['app']['mysql']['username']}  -p{$destServer['app']['mysql']['password']} {$destServer['app']['mysql']['dbname']}", 0);
})->onlyOn('dev');
task("sync:dirs", function () {
    $serverList = $serverInfo = Yaml::parse(file_get_contents(__DIR__ . '/stage/servers.yml'));
    $sourceServerKey = null;
    if (input()->hasOption('source-server')) {
        $sourceServerKey = input()->getOption('source-server');
    }
    $destPath = null;
    if (input()->hasOption('dest-path')) {
        $destPath = input()->getOption('dest-path');
    }
    $sourceServer = $serverList[$sourceServerKey];
    $destServer = $serverList[env('server.name')];
    foreach (get('sync_dirs') as $dir) {
        $excludeString = '';
        foreach (get('sync_excludes') as $exclude) {
            $excludeString .= " --exclude={$exclude} ";
        }
        writeln("rsync -avz --delete {$sourceServer['user']}@{$sourceServer['host']}:{$sourceServer['webroot']}/{$dir}/ {$destPath}/{$dir} {$excludeString}");
        runLocally("rsync -avz --delete {$sourceServer['user']}@{$sourceServer['host']}:{$sourceServer['webroot']}/{$dir}/ {$destPath}/{$dir} {$excludeString}", 0);
    }
});
task('sync', ['sync:dirs', 'sync:db']);
task('deploy', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:configure', 'deploy:vendors', 'deploy:symlink', 'deploy:clean', 'cleanup'])->desc('Deploy your project');
after('deploy', 'success');
serverList(__DIR__ . '/stage/servers.yml');
開發者ID:vkryukov76,項目名稱:bitrix-project-stub,代碼行數:31,代碼來源:deploy.php

示例7: testrunner_restart_mysql

function testrunner_restart_mysql()
{
    $ip = env('testrunner_docker_ip');
    testrunner_kill_container('testrunner_mysql');
    runLocally("{{docker}} && \\\n        docker run \\\n        -d --env 'MYSQL_ROOT_PASSWORD=root' --env 'MYSQL_DATABASE=wp' \\\n        --name='testrunner_mysql' -p {$ip}:3306:3306 \\\n        mysql:5.6", 999);
    testrunner_wait_port('Waiting for mysql to start', '3306');
}
開發者ID:ekandreas,項目名稱:testrunner,代碼行數:7,代碼來源:recipe.php

示例8: doLocal

 public static function doLocal($command, $timeout = 999)
 {
     writeln('===================================================');
     writeln('Running command:');
     writeln($command);
     writeln('===================================================');
     return runLocally(Env::evalDocker() . $command, $timeout);
 }
開發者ID:ekandreas,項目名稱:docker-bedrock,代碼行數:8,代碼來源:Helpers.php

示例9: set

 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Deployer;

/**
 * Get local username
 */
set('local_user', function () {
    return trim(run("whoami"));
});
desc('Notifying Rollbar of deployment');
task('deploy:rollbar', function () {
    global $php_errormsg;
    $defaultConfig = ['access_token' => null, 'environment' => get('stages')[0], 'revision' => trim(runLocally('git log -n 1 --format="%h"')), 'local_username' => trim(runLocally('git config user.name')), 'rollbar_username' => null, 'comment' => "Deployment to `{{host}}` on *{{stage}}* was successful\n({{release_path}})"];
    $config = array_merge($defaultConfig, (array) get('rollbar', []));
    if (!is_array($config) || !isset($config['access_token'])) {
        throw new \RuntimeException("Please configure new rollbar: set('rollbar', ['access_token' => 'c09a3...', 'revision' => 'v4.3', 'rollbar_username' => 'John Doe', 'comment' => 'Brand new version']);");
    }
    $server = \Deployer\Task\Context::get()->getServer();
    if ($server instanceof \Deployer\Server\Local) {
        $user = get('local_user');
    } else {
        $user = $server->getConfiguration()->getUser() ?: null;
    }
    $commentPlaceHolders = ['{{release_path}}' => get('release_path'), '{{host}}' => get('server.host'), '{{stage}}' => get('stages')[0], '{{user}}' => $user, '{{branch}}' => get('branch')];
    $config['comment'] = strtr($config['comment'], $commentPlaceHolders);
    $urlParams = ['access_token' => $config['access_token'], 'environment' => $config['environment'], 'revision' => $config['revision'], 'local_username' => $config['local_username'], 'rollbar_username' => $config['rollbar_username'], 'comment' => $config['comment']];
    $options = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => http_build_query($urlParams)));
    $context = stream_context_create($options);
開發者ID:deployphp,項目名稱:recipes,代碼行數:31,代碼來源:rollbar.php

示例10: task

/**
 * recipe for http://deployer.org/
 */
/**
 * Update project code
 */
task('package:create', function () {
    $basePath = env('deploy_path');
    $packageSourcePath = __DIR__ . '/../../';
    $packageName = 'deploy_package_' . date('Ymd') . '_' . time() . '.tar.gz';
    $packageLocation = $packageSourcePath . '../deployer-dashboard/' . $packageName;
    $excludes = " --exclude=build/var --exclude=build/pub";
    foreach (get('not_packaged') as $exclude) {
        $excludes .= " --exclude={$exclude} ";
    }
    runLocally("tar --exclude-vcs --exclude=vendor {$excludes} -czf {$packageLocation}  -C {$packageSourcePath} ./");
    //runLocally("tar --exclude-vcs {$excludes} -czf {$packageLocation}  -C {$packageSourcePath} ./");
    env()->set('packageLocation', $packageLocation);
    env()->set('packageName', $packageName);
})->desc('create package');
/**
 * Update project code
 */
task('package:upload', function () {
    $basePath = env('deploy_path');
    $release = date('Ymd') . substr((string) time(), -5);
    $releasePath = "{$basePath}/releases/{$release}";
    $releasePath = env('release_path');
    $packageLocation = env()->get('packageLocation');
    $packageName = env()->get('packageName');
    upload($packageLocation, $packageName);
開發者ID:Cotya,項目名稱:DashboardProject,代碼行數:31,代碼來源:package.php

示例11: desc

<?php

/* (c) Tim Robertson <funkjedi@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Deployer;

desc('Notifying Bugsnag of deployment');
task('deploy:bugsnag', function () {
    global $php_errormsg;
    $defaultConfig = ['api_key' => null, 'release_stage' => get('stages')[0], 'repository' => get('repository'), 'provider' => null, 'branch' => get('branch'), 'revision' => trim(runLocally('git log -n 1 --format="%h"')), 'app_version' => null];
    $config = array_merge($defaultConfig, (array) get('bugsnag'));
    if (!is_array($config) || !isset($config['api_key'])) {
        throw new \RuntimeException("Please configure new bugsnag: set('bugsnag', ['api_key' => 'c09a3...', 'release_stage' => 'production']);");
    }
    $postdata = ['apiKey' => $config['api_key'], 'releaseStage' => $config['release_stage'], 'repository' => $config['repository'], 'provider' => $config['provider'], 'branch' => $config['branch'], 'revision' => $config['revision'], 'appVersion' => $config['app_version']];
    $options = array('http' => array('method' => 'POST', 'header' => "Content-type: application/json\r\n", 'content' => json_encode($postdata)));
    $context = stream_context_create($options);
    $result = @file_get_contents('https://notify.bugsnag.com/deploy', false, $context);
    if (!$result) {
        throw new \RuntimeException($php_errormsg);
    }
});
開發者ID:deployphp,項目名稱:recipes,代碼行數:25,代碼來源:bugsnag.php

示例12: task

<?php

task('pull:dump', function () {
    writeln('Creating a new database dump (approx. 60s)');
    run('mysqldump nordiciron > /tmp/nordiciron.sql');
});
task('pull:fetch_dump', function () {
    writeln('Getting database dump (approx. 60s)');
    runLocally('scp root@andreasek.se:/tmp/nordiciron.sql nordiciron.sql', 999);
});
task('pull:resolve_dump', function () {
    writeln('Restore database inside vagrant (approx. 60s)');
    runLocally('vagrant ssh -c "mysql -u root -proot nordiciron < /home/vagrant/www/nordiciron/nordiciron.sql"', 999);
});
task('pull:set_vagrant_wp', function () {
    writeln('Restore wp after pull (approx. 60s)');
    runLocally('vagrant ssh -c "cd /home/vagrant/www/nordiciron/web && wp search-replace "nordiciron.com" "nordiciron.dev" && wp rewrite flush"', 999);
    runLocally('vagrant ssh -c "cd /home/vagrant/www/nordiciron/web && wp search-replace "www.nordiciron.com" "nordiciron.dev" && wp rewrite flush"', 999);
});
task('pull:uploads', function () {
    writeln('Getting uploads, long duration first time! (approx. 60-999s)');
    runLocally('rsync -re ssh root@andreasek.se:/mnt/persist/www/nordiciron.com/shared/web/app/uploads web/app', 999);
});
task('pull:cleanup', function () {
    writeln('Cleaning up locally...');
    runLocally('rm nordiciron.sql');
});
task('pull', ['pull:dump', 'pull:fetch_dump', 'pull:resolve_dump', 'pull:set_vagrant_wp', 'pull:uploads', 'pull:cleanup']);
開發者ID:ekandreas,項目名稱:nordiciron,代碼行數:28,代碼來源:pull.php

示例13: env

env('remote.name', 'aekab');
env('remote.path', '/home/forge/www.aekab.se');
env('remote.ssh', 'forge@178.62.249.226');
env('remote.database', 'aekab');
env('remote.domain', 'aekab.se');
env('local.domain', 'aekab.dev');
env('local.is_elastic', false);
server('development', 'default', 22)->env('container', 'bedrock')->env('deploy_path', '/var/www/aekab');
server('production', '178.62.249.226', 22)->env('deploy_path', '/home/forge/www.aekab.se')->user('forge')->env('branch', 'master')->stage('production')->identityFile();
set('repository', 'git@github.com:ekandreas/aekab.git');
// Symlink the .env file for Bedrock
set('env', 'prod');
set('keep_releases', 10);
set('shared_dirs', ['web/app/uploads', 'web/app/themes/aekab/.cache']);
set('shared_files', ['.env', 'web/.htaccess', 'web/robots.txt']);
set('env_vars', '/usr/bin/env');
//set('writable_dirs', ['web/app/uploads']);
task('deploy:restart', function () {
    writeln('Purge cache...');
    run('rm -Rf web/app/themes/aekab/.cache && mkdir -p shared/web/app/themes/aekab/.cache');
})->desc('Restarting apache2 and varnish');
task('deploy', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:vendors', 'deploy:shared', 'deploy:writable', 'deploy:symlink', 'cleanup', 'deploy:restart', 'success'])->desc('Deploy your Bedrock project, eg dep deploy production');
task('pull:files', function () {
    writeln('Getting uploads, long duration first time! (approx. 60s)');
    runLocally('rsync --exclude .cache -re ssh {{remote.ssh}}:{{remote.path}}/web/app/uploads web/app', 999);
});
task('pull:deactivate', function () {
    writeln('Deactivate SEO');
    runLocally('cd web && wp plugin deactivate wordpress-seo', 999);
});
task('pull', ['pull:create_database_dump', 'pull:get_database_dump', 'pull:restore_database', 'pull:search_and_replace_database', 'pull:files', 'pull:elastic', 'pull:deactivate', 'pull:cleanup']);
開發者ID:ekandreas,項目名稱:aekab,代碼行數:31,代碼來源:deploy.php

示例14: writeln

        writeln('working with env files');
        $tmp_dir = dirname(__DIR__) . '/../.tmp/';
        $local_env = '.local.env';
        $remote_env = '.remote.env';
        runLocally('mkdir -p ' . $tmp_dir);
        runLocally('cp .env ' . $tmp_dir . $local_env);
        download($tmp_dir . $remote_env, $config['shared_dir'] . '/.env');
        $dotenvremote = new Dotenv\Dotenv($tmp_dir, $remote_env);
        if (file_exists($tmp_dir . $remote_env)) {
            $dotenvremote->overload();
            $dotenvremote->required(['WP_HOME']);
            set('remote_url', getenv('WP_HOME'));
        }
        $dotenvlocal = new Dotenv\Dotenv($tmp_dir, $local_env);
        if (file_exists($tmp_dir . $local_env)) {
            $dotenvlocal->overload();
            $dotenvlocal->required(['WP_HOME']);
            set('local_url', getenv('WP_HOME'));
        }
        runLocally('rm -rf .tmp');
    } else {
        writeln('working with config');
        set('local_url', $config['local_wp_url']);
        set('remote_url', $config['remote_wp_url']);
    }
})->desc('Download backup database');
/* --------------------- */
/*       DB TASKS         */
/* --------------------- */
task('db:push', ['db:local:backup', 'db:cmd:push']);
task('db:pull', ['db:remote:backup', 'db:cmd:pull']);
開發者ID:cstaelen,項目名稱:deployer-wp-recipes,代碼行數:31,代碼來源:db.php

示例15: env

*  It is used to create the Git tags before deployment
*/
env('code_path', '/var/www/YOUR_OCTOBERCMS_CODE_PATH_HERE');
/**
* Instruct OctoberCMS to create a mirror folder in the web/ dir
*/
task('deploy:symlink:web', function () {
    $deployPath = env('deploy_path');
    cd($deployPath);
    run('cd {{release_path}} && php artisan october:mirror web/');
});
/**
*  After OctoberCMS finishes creating the mirror folder copy the .htaccess as well
*/
task('deploy:cp-htaccess', function () {
    run('cp {{release_path}}/.htaccess {{release_path}}/web');
});
/**
* Instruct deployer to create a Git tag before deployment
*/
task('deploy:tag-deployment', function () {
    $codePath = env('code_path');
    $time = date('d/m/YTH-i-s');
    cd($codePath);
    runLocally("git tag -a -m 'Deployment of version {$time}' '{$time}'  && git push origin --tags");
});
/**
*  Main deployment task which creates the deployment scenario
*/
task('deploy-test', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:vendors', 'deploy:writable', 'deploy:symlink', 'deploy:symlink:web', 'deploy:cp-htaccess', 'cleanup'])->desc('Deploy your project');
after('deploy-test', 'success');
開發者ID:rendler-denis,項目名稱:octobercms-deployment-with-deployer,代碼行數:31,代碼來源:deploy.php


注:本文中的runLocally函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。