Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabea David committed Feb 26, 2016
2 parents e96f41b + 2ca69cd commit e2825fb
Show file tree
Hide file tree
Showing 14 changed files with 713 additions and 368 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
# wireshell
**ProcessWire command-line companion**

Version 0.5.2
Version 0.6.0

A command-line interface for CMS/CMF [ProcessWire](https://processwire.com) based on the Symfony Console component.
Can be easily extended through ProcessWire's ability of being bootstrapped into other applications, its great [API](https://processwire.com/api/) and
Expand Down
4 changes: 3 additions & 1 deletion app/wireshell.php
Expand Up @@ -24,6 +24,7 @@
use Wireshell\Commands\Module\ModuleEnableCommand;
use Wireshell\Commands\Module\ModuleDisableCommand;
use Wireshell\Commands\Module\ModuleGenerateCommand;
use Wireshell\Commands\Module\ModuleUpgradeCommand;
use Wireshell\Commands\Common\NewCommand;
use Wireshell\Commands\Common\UpgradeCommand;
use Wireshell\Commands\Common\StatusCommand;
Expand All @@ -43,7 +44,7 @@
require __DIR__.'/../vendor/autoload.php';
}

$app = new Application('wireshell - An extendable ProcessWire CLI', '0.5.2');
$app = new Application('wireshell - An extendable ProcessWire CLI', '0.6.0');

$app->add(new UserCreateCommand());
$app->add(new UserUpdateCommand());
Expand All @@ -67,6 +68,7 @@
$app->add(new ModuleEnableCommand());
$app->add(new ModuleDisableCommand());
$app->add(new ModuleGenerateCommand(new GuzzleHttp\Client()));
$app->add(new ModuleUpgradeCommand());
$app->add(new NewCommand());
$app->add(new UpgradeCommand(new \Symfony\Component\Filesystem\Filesystem()));
$app->add(new StatusCommand());
Expand Down
7 changes: 6 additions & 1 deletion docs/changelog.md
Expand Up @@ -2,7 +2,12 @@

Dates using [ISO 8601 Format](http://www.iso.org/iso/iso8601) (YYYY-MM-DD).

0.5.2 (2016-01-18)
**0.6.0 (2016-02-26)**

- Updates `new` command: introduces `-v` to increase the verbosity of messages, more detailed error messages, makes it possible to use no password during installation
- Adds `module:upgrade` command

**0.5.2 (2016-01-18)**

- Extends `field:list` command, adds filter `--tag=tagname` and `--unused`
- Extends `page:create` command, enables importing field data from json file (thanks @samuell)
Expand Down
1 change: 1 addition & 0 deletions docs/commands/common.md
Expand Up @@ -35,6 +35,7 @@ $ wireshell new {directory}*
--devns : Download devns branch (dev with namespace support)
--sha : Download specific commit
--no-install : Disable installation
--v : Increase the verbosity of messages
```

### Examples
Expand Down
50 changes: 48 additions & 2 deletions docs/commands/module.md
Expand Up @@ -19,7 +19,7 @@ $ wireshell module:download {module-class},{module-class}
### Examples
Download two modules at once.
Separate module names with commas to download two or more modules at once.
```sh
$ wireshell module:download FlagPages,ImageExtra
Expand Down Expand Up @@ -56,7 +56,7 @@ $ wireshell module:enable {module-class},{module-class}
### Examples
Enable two modules at once.
Separate module names with commas to enable two or more modules at once.
```sh
$ wireshell module:download FlagPages,ImageExtra
Expand Down Expand Up @@ -106,6 +106,52 @@ $ wireshell module:disable FlagPages,ImageExtra --rm
---
## Upgrade
Upgrades given module(s).
```sh
$ wireshell module:upgrade {class-name},{class-name}*
```
\* This argument is optional. If you want to check for module updates, just skip it.
### Available options:
```sh
--check : Just check for module upgrades.
```
### Examples
Check if module upgrades are available.
```sh
$ wireshell module:upgrade --check
An upgrade is available for:
- FlagPages: 0.0.8 -> 0.2.3
- ImageExtra: 0.0.1 -> 0.0.3
```
Download and upgrade existing module `ImageExtra`.
```sh
$ wireshell module:upgrade ImageExtra
An upgrade for ImageExtra is available: 0.0.3
Downloading module ImageExtra...
840.40 KB/840.40 KB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100%
Preparing module...
Module ImageExtra downloaded successfully.
Module `ImageExtra` was updated successfully.
```
---
## Generate
Generates a module via [modules.pw](http://modules.pw/).
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Expand Up @@ -2,7 +2,7 @@

**ProcessWire command-line companion**

Version 0.5.2
Version 0.6.0

A command-line interface for CMS/CMF [ProcessWire](https://processwire.com) based on the Symfony Console component.
Can be easily extended through ProcessWire's ability of being bootstrapped into other applications, its great [API](https://processwire.com/api/) and
Expand Down
56 changes: 42 additions & 14 deletions src/Commands/Common/NewCommand.php
Expand Up @@ -100,21 +100,34 @@ protected function configure()
->addOption('dev', null, InputOption::VALUE_NONE, 'Download dev branch')
->addOption('devns', null, InputOption::VALUE_NONE, 'Download devns branch (dev with namespace support)')
->addOption('sha', null, InputOption::VALUE_REQUIRED, 'Download specific commit')
->addOption('no-install', null, InputOption::VALUE_NONE, 'Disable installation');
->addOption('no-install', null, InputOption::VALUE_NONE, 'Disable installation')
->addOption('v', null, InputOption::VALUE_NONE, 'verbose');
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$this->fs = new Filesystem();
$directory = rtrim(trim($input->getArgument('directory')), DIRECTORY_SEPARATOR);

if ($d = $input->getArgument('directory')) {
$directory = rtrim(trim($d), DIRECTORY_SEPARATOR);
} else {
$directory = getcwd();
if (!$directory) {
$output->writeln("<error>No such file or directory,\nyou may have to refresh the current directory by executing for example `cd \$PWD`.</error>");
return;
}
chdir(dirname($directory));
}

$this->projectDir = $this->fs->isAbsolutePath($directory) ? $directory : getcwd() . DIRECTORY_SEPARATOR . $directory;
$this->projectName = basename($directory);
$this->projectName = basename($this->projectDir);
$v = $input->getOption('v') ? true : false;

$logger = new Logger('name');
$logger->pushHandler(new StreamHandler("php://output"));
$this->installer = new Installer($logger, $this->projectDir);
$this->installer = new Installer($logger, $this->projectDir, $v);

$this->version = '2.4.0';
$this->version = '2.7.2';
$this->output = $output;

$profile = $input->getOption('profile');
Expand Down Expand Up @@ -168,7 +181,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$dbPass = $input->getOption('dbPass');
if (!$dbPass) {
$question = new Question('Please enter the database password : ', 'dbPass');
$question = new Question('Please enter the database password : ', null);
$question->setHidden(true);
$question->setHiddenFallback(false);
$dbPass = $helper->ask($input, $output, $question);
Expand Down Expand Up @@ -260,6 +273,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$accountInfo['useremail'] = $useremail;
$this->installProcessWire($post, $accountInfo);
$this->cleanUpInstallation();
$this->output->writeln("\n<info>Congratulations, ProcessWire has been successfully installed.</info>");
}
} catch (\Exception $e) {
$this->cleanUp();
Expand All @@ -280,14 +294,28 @@ private function getZipURL($input) {

$branch = str_replace('{branch}', $targetBranch, PwConnector::zipURL);
$check = str_replace('{branch}', $targetBranch, PwConnector::versionURL);
$ch = curl_init($check);

try {
$ch = curl_init($check);
} catch (Exception $e) {
$messages = array(
'Curl request failed.',
'Please check whether the php curl extension is enabled, uncomment the following line in your php.ini:',
'`;extension=php_curl.dll` and restart the server. Check your phpinfo() to see whether curl has been properly enabled or not.'
);
throw new \RuntimeException(implode("\n", $messages));
}

curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$retcode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = (string)curl_error($ch);
curl_close($ch);

if ((int)$retcode !== 200) {
throw new \RuntimeException("Error loading sha `$targetBranch`.");
throw new \RuntimeException(
"Error loading sha `$targetBranch`, curl request failed (status code: $retcode, url: $check).\ncURL error: $curlError"
);
}

return $branch;
Expand Down Expand Up @@ -371,7 +399,7 @@ private function download($branch)
$client->getEmitter()->attach(new Progress(null, $downloadCallback));

// store the file in a temporary hidden directory with a random name
$this->compressedFilePath = getcwd() . DIRECTORY_SEPARATOR . '.' . uniqid(time()) . DIRECTORY_SEPARATOR . 'pw.' . pathinfo($pwArchiveFile,
$this->compressedFilePath = $this->projectDir . DIRECTORY_SEPARATOR . '.' . uniqid(time()) . DIRECTORY_SEPARATOR . 'pw.' . pathinfo($pwArchiveFile,
PATHINFO_EXTENSION);

try {
Expand Down Expand Up @@ -439,7 +467,7 @@ private function extract()
"permissions to uncompress and rename the package contents.\n" .
"To solve this issue, check the permissions of the %s directory and\n" .
"try installing ProcessWire again.\n%s",
getcwd(), $this->getExecutedCommand()
$this->projectDir, $this->getExecutedCommand()
));
} catch (\Exception $e) {
throw new \RuntimeException(sprintf(
Expand All @@ -448,7 +476,7 @@ private function extract()
"rename the package contents.\n" .
"To solve this issue, check the permissions of the %s directory and\n" .
"try installing ProcessWire again.\n%s",
getcwd(), $this->getExecutedCommand()
$this->projectDir, $this->getExecutedCommand()
));
}

Expand Down Expand Up @@ -509,7 +537,7 @@ private function cleanUpInstallation()
$installDir = array($this->projectDir . '/site/install');

$this->fs->remove(array_merge($siteDirs, $installDir));
$this->output->writeln("Remove ProcessWire-related files that don't make sense in a running project.");
if ($this->v) $this->output->writeln("Remove ProcessWire-related files that don't make sense in a running project.");
} catch (\Exception $e) {
// don't throw an exception in case any of the ProcessWire-related files cannot
// be removed, because this is just an enhancement, not something mandatory
Expand Down Expand Up @@ -623,7 +651,7 @@ private function extractProfile($profile)

try {
$distill = new Distill();
$extractPath = getcwd() . DIRECTORY_SEPARATOR . '.' . uniqid(time()) . DIRECTORY_SEPARATOR . 'pwprofile';
$extractPath = $this->projectDir . DIRECTORY_SEPARATOR . '.' . uniqid(time()) . DIRECTORY_SEPARATOR . 'pwprofile';
$extractionSucceeded = $distill->extractWithoutRootDirectory($profile, $extractPath);

foreach (new \DirectoryIterator($extractPath) as $fileInfo) {
Expand Down
4 changes: 4 additions & 0 deletions src/Commands/Common/UpgradeCommand.php
Expand Up @@ -40,12 +40,16 @@ class UpgradeCommand extends PwConnector
'2.4.0' => 'ae121ccc9c14a2cd5fa57e8786bdbb3f',
'2.5.0' => '9b20ce2898be505608d54a1e0dd81215',
'2.6.0' => '8890078f9d233b038e5110c1caee5a95',
'2.7.0' => '756b8a5685ce2b6b6e92062dcf040973',
'3.0.0' => '3a29d29b4ff7b2273b0739a82305ff71',
);

protected $htaccessHashes = array(
'2.4.0' => '5114479740cb1e79a8004f3eddeecb54',
'2.5.0' => 'f8229ef5e26221226844d461e1a4d8d2',
'2.6.0' => '31a04ba76f50c94bcf1f848d334d62c5',
'2.7.0' => 'd659abbf6c035b462b735743c007b17a',
'3.0.0' => 'd659abbf6c035b462b735743c007b17a',
);

protected $filesToReplace = array('wire', 'htaccess.txt', 'index.php');
Expand Down

0 comments on commit e2825fb

Please sign in to comment.