-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API partial implementation of translations task
- Loading branch information
Damian Mooyman
committed
Aug 19, 2015
1 parent
ba388a1
commit 120fd5e
Showing
8 changed files
with
346 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Cow\Commands\Module; | ||
|
||
use SilverStripe\Cow\Commands\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
/** | ||
* Abstract base command for all module commands | ||
* | ||
* @author dmooyman | ||
*/ | ||
abstract class Module extends Command { | ||
|
||
protected function configure() { | ||
parent::configure(); | ||
$this->addArgument( | ||
'modules', | ||
InputArgument::IS_ARRAY | InputArgument::OPTIONAL, | ||
'Optional list of modules to filter (separate by space)' | ||
); | ||
$this->addOption('directory', 'd', InputOption::VALUE_REQUIRED, 'Module directory'); | ||
} | ||
|
||
/** | ||
* Get the directory the project is, or will be in | ||
* | ||
* @return string | ||
*/ | ||
protected function getInputDirectory() { | ||
$directory = $this->input->getOption('directory'); | ||
if(!$directory) { | ||
$directory = getcwd(); | ||
} | ||
return $directory; | ||
} | ||
|
||
/** | ||
* Gets the list of module names to filter by (or empty if all modules) | ||
* | ||
* @return array | ||
*/ | ||
protected function getInputModules() { | ||
return $this->input->getArgument('modules') ?: array(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Cow\Commands\Module; | ||
|
||
use SilverStripe\Cow\Steps\Release\UpdateTranslations; | ||
|
||
/** | ||
* Description of Create | ||
* | ||
* @author dmooyman | ||
*/ | ||
class Translate extends Module { | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $name = 'module:translate'; | ||
|
||
protected $description = 'Translate your modules'; | ||
|
||
protected function fire() { | ||
$directory = $this->getInputDirectory(); | ||
$modules = $this->getInputModules(); | ||
|
||
$translate = new UpdateTranslations($this, $directory, $modules); | ||
$translate->run($this->input, $this->output); | ||
//$step->run($this->input, $this->output); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.