本文整理汇总了PHP中OS::run方法的典型用法代码示例。如果您正苦于以下问题:PHP OS::run方法的具体用法?PHP OS::run怎么用?PHP OS::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OS
的用法示例。
在下文中一共展示了OS::run方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
if (isset($this->config['build'])) {
OS::run('cd ' . OS::bashize($this->directory) . ';git pull');
$this->readConfig();
}
}
示例2: run
public function run(array $arguments)
{
foreach ($arguments as $dep) {
echo "* Removing {$dep}...\n";
$dir = $this->deps->getPackageDirectory($dep);
OS::run("rm -rf {$dir}");
}
return true;
}
示例3: run
public function run(array $arguments)
{
$json = $this->deps->nearestJson();
$linkDir = dirname($json);
$package = new Package(dirname($json));
$name = $package->getName();
if (!$name) {
echo "Error: no name for package\n";
} else {
echo "* Linking package {$name} to {$linkDir}...\n";
$dir = $this->deps->getPackageDirectory($package->getName());
if (is_dir($dir)) {
OS::run("rm -rf {$dir}");
}
OS::run("ln -s {$linkDir} {$dir}");
}
}
示例4: run
public function run(array $arguments)
{
$json = $this->deps->nearestJson();
$linkDir = dirname($json);
$package = new Package(dirname($json));
$name = $package->getName();
if (!$name) {
echo "Error: no name for package\n";
} else {
echo "Do you want to create symlink from {$name} to {$linkDir}? (yes/no)\n";
$l = readline();
if (trim($l) == 'yes') {
echo "* Linking package {$name} to {$linkDir}...\n";
$dir = $this->deps->getPackageDirectory($package->getName());
if (is_dir($dir)) {
OS::run("rm -rf {$dir}");
}
OS::run("ln -s {$linkDir} {$dir}");
} else {
echo "Aborting.\n";
}
}
}
示例5: install
public function install($dep, $rebuildDeps = true)
{
if (isset($this->installed[$dep])) {
return;
}
$this->installed[$dep] = true;
if (!$this->hasPackage($dep)) {
Terminal::info("* Installing {$dep}...\n");
$target = $this->getPackageDirectory($dep);
if (is_dir($target)) {
OS::run("rm -rf {$target}");
}
$btarget = OS::bashize($target);
$remotes = $this->remotes->getRemotes();
$addr = $remotes[$this->remotes->getCurrent()];
$addr = sprintf($addr, $dep);
$return = OS::run("git clone --depth=1 {$addr} {$btarget}");
if ($return != 0) {
OS::run("rm -rf {$target}");
throw new \Exception("Unable to install package {$dep}");
}
$package = new Package($target);
if (!$package->hasConfig()) {
OS::run("rm -rf {$btarget}");
throw new \Exception("{$dep} doesn't look like a deps package (no deps.json)");
}
$package->updateRemotes($this->remotes, true);
$this->packages[$package->getName()] = $package;
} else {
$this->update($dep);
$package = $this->getPackage($dep);
}
$package->readConfig();
foreach ($package->getDependencies() as $sdep) {
if ($rebuildDeps) {
$this->install($sdep);
} else {
if (!$this->hasPackage($sdep)) {
$this->install($sdep);
}
}
}
$this->build($dep);
}
示例6: run
public function run(array $arguments)
{
Terminal::info("* Updating deps from git...\n");
$dir = $this->deps->getDirectory();
OS::run("cd {$dir}; git pull");
}
示例7: update
public function update(Remotes $remotes)
{
$branch = $this->getBranch();
$this->updateRemotes($remotes);
$current = $remotes->getCurrent();
if (OS::run('cd ' . OS::bashize($this->directory) . ";git pull {$current} {$branch}") != 0) {
throw new \Exception('Update of ' . $this->getName() . ' failed');
} else {
Terminal::success('Updated ' . $this->getName() . "\n");
}
OS::run('cd ' . OS::bashize($this->directory) . ";git branch -u {$current}/{$branch}");
$this->readConfig();
}
示例8: install
public function install($dep)
{
if (!$this->hasPackage($dep)) {
echo "* Installing {$dep}...\n";
$target = $this->getPackageDirectory($dep);
if (is_dir($target)) {
OS::run("rm -rf {$target}");
}
$btarget = OS::bashize($target);
$return = OS::run("git clone --depth=1 https://github.com/{$dep} {$btarget}");
if ($return != 0) {
OS::run("rm -rf {$target}");
throw new \Exception("Unable to install package {$dep}");
}
$package = new Package($target);
$this->packages[$package->getName()] = $package;
} else {
$this->update($dep);
$package = $this->getPackage($dep);
}
$package->readConfig();
foreach ($package->getDependencies() as $sdep) {
$this->install($sdep);
}
$this->build($dep);
}