Skip to content

Commit

Permalink
Squashed 'src/Pingpong/Modules/' changes from fca0fea..d71fd39
Browse files Browse the repository at this point in the history
d71fd39 use dev version
843b59a Update header
2a65ce1 Merge branch 2.0
49d1a50 Merge branch '2.0' into 2.1
690a5d6 set minimum stability to dev
b16615c Added support for Laravel 5.1 (develop version). Ref: pingpong-labs/modules#151
REVERT: fca0fea Fix pingpong-labs/modules#164
REVERT: 73fe515 wrap getter property
REVERT: c8fa2d8 fix typo
REVERT: 7815fc4 extract process logic to getProcess method
REVERT: 8eb218c Fix install module from repository class
REVERT: fac1d35 Added missing doc
REVERT: ea1433f Fix pingpong-labs/modules#160
REVERT: 0601e2e Fix pingpong-labs/modules#159
REVERT: 419481e update title

git-subtree-dir: src/Pingpong/Modules
git-subtree-split: d71fd39a0efdca45ee9e0ebb44a75bdef0361cf3
  • Loading branch information
Gravitano committed Jun 3, 2015
1 parent 47f83e0 commit cff4832
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 59 deletions.
3 changes: 1 addition & 2 deletions Commands/GenerateProviderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ protected function getTemplateContents()

return (new Stub('/'.$stub.'.stub', [
'NAMESPACE' => $this->getClassNamespace($module),
'CLASS' => $this->getClass(),
'LOWER_NAME' => $module->getLowerName()
'CLASS' => $this->getClass()
]))->render();
}

Expand Down
2 changes: 1 addition & 1 deletion Commands/ModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ private function getFillable()
*/
public function getDefaultNamespace()
{
return $this->laravel['modules']->config('paths.generator.model');
return 'Entities';
}
}
4 changes: 2 additions & 2 deletions Commands/stubs/scaffold/provider.stub
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace $NAMESPACE$;
<?php namespace $MODULE_NAMESPACE$\$MODULE$\Providers;

use Illuminate\Support\ServiceProvider;

class $CLASS$ extends ServiceProvider {
class $NAME$ extends ServiceProvider {

/**
* Indicates if loading of the provider is deferred.
Expand Down
64 changes: 33 additions & 31 deletions Process/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Installer
protected $path;

/**
* The process timeout.
* The proccess timeout.
*
* @var integer
*/
Expand Down Expand Up @@ -124,43 +124,21 @@ public function setTimeout($timeout)
* @return \Symfony\Component\Process\Process
*/
public function run()
{
$process = $this->getProcess();

$process->setTimeout($this->timeout);

if ($this->console instanceof Command) {
$process->run(function ($type, $line) {
$this->console->line($line);
});
}

return $process;
}

/**
* Get process instance.
*
* @return \Symfony\Component\Process\Process
*/
public function getProcess()
{
switch ($this->type) {
case 'github':
case 'bitbucket':
if ($this->tree) {
$process = $this->installViaSubtree();
return $this->installViaSubtree();
}

$process = $this->installViaGit();
return $this->installViaGit();
break;

default:
$process = $this->installViaComposer();
return $this->installViaComposer();
break;
}

return $process;
}

/**
Expand All @@ -186,11 +164,11 @@ public function getRepoUrl()
{
switch ($this->type) {
case 'github':
return "git@github.com:{$this->name}.git";
return "git@github.com:$this->name.git";
break;

case 'bitbucket':
return "git@bitbucket.org:{$this->name}.git";
return "git@bitbucket.org:$this->name.git";
break;

default:
Expand Down Expand Up @@ -242,13 +220,21 @@ public function getPackageName()
*/
public function installViaGit()
{
return new Process(sprintf(
$process = new Process(sprintf(
'cd %s && git clone %s %s && git checkout %s',
base_path(),
$this->getRepoUrl(),
$this->getDestinationPath(),
$this->getBranch()
));

$process->setTimeout($this->timeout);

$process->run(function ($type, $line) {
$this->console->line($line);
});

return $process;
}

/**
Expand All @@ -258,7 +244,7 @@ public function installViaGit()
*/
public function installViaSubtree()
{
return new Process(sprintf(
$process = new Process(sprintf(
'cd %s && git remote add %s %s && git subtree add --prefix=%s --squash %s %s',
base_path(),
$this->getModuleName(),
Expand All @@ -267,6 +253,14 @@ public function installViaSubtree()
$this->getModuleName(),
$this->getBranch()
));

$process->setTimeout($this->timeout);

$process->run(function ($type, $line) {
$this->console->line($line);
});

return $process;
}

/**
Expand All @@ -276,10 +270,18 @@ public function installViaSubtree()
*/
public function installViaComposer()
{
return new Process(sprintf(
$process = new Process(sprintf(
'cd %s && composer require %s',
base_path(),
$this->getPackageName()
));

$process->setTimeout($this->timeout);

$process->run(function ($type, $line) {
$this->console->line($line);
});

return $process;
}
}
27 changes: 8 additions & 19 deletions Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,11 @@ public function getAssetsPath()
* @param boolean $secure
* @return string
*/
public function asset($asset)
public function asset($asset, $secure = false)
{
list($name, $url) = explode(':', $asset);

$baseUrl = str_replace(public_path(), '', $this->getAssetsPath());

$url = $this->app['url']->asset($baseUrl . "/{$name}/" . $url);

return str_replace(['http://', 'https://'], '//', $url);
return $this->app['url']->asset(basename($this->getAssetsPath()) . "/{$name}/" . $url, $secure);
}

/**
Expand Down Expand Up @@ -548,22 +544,17 @@ public function update($module)
/**
* Install the specified module.
*
* @param string $name
* @param string $version
* @param string $type
* @param boolean $subtree
* @return \Symfony\Component\Process\Process
* @param string $name
* @param string $path
* @param bool $subtree
* @return void
*/
public function install($name, $version = 'dev-master', $type = 'composer', $subtree = false)
public function install($name, $path = null, $subtree = false)
{
$installer = new Installer($name, $version, $type, $subtree);

return $installer->run();
with(new Installer($this))->install($name, $path, $subtree);
}

/**
* Get stub path.
*
* @return string
*/
public function getStubPath()
Expand All @@ -580,8 +571,6 @@ public function getStubPath()
}

/**
* Set stub path.
*
* @param string $stubPath
* @return $this
*/
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
],
"require": {
"php": ">=5.4.0",
"laravel/framework": "5.0.*",
"pingpong/generators": "~2.0",
"pingpong/support": "~2.0",
"laravel/framework": "5.1.*@dev",
"pingpong/generators": "2.1.*@dev",
"pingpong/support": "2.1.*@dev",
"laravelcollective/html": "~5.0"
},
"require-dev": {
Expand All @@ -42,5 +42,5 @@
"dev-develop": "1.3-dev"
}
},
"minimum-stability": "stable"
"minimum-stability": "dev"
}

0 comments on commit cff4832

Please sign in to comment.