Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Commit

Permalink
Cleaned up configs and removed resources (no longer needed)
Browse files Browse the repository at this point in the history
  • Loading branch information
xsist10 committed Apr 21, 2014
1 parent 311a6cc commit ee7bb91
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 81 deletions.
28 changes: 0 additions & 28 deletions res/config.json

This file was deleted.

25 changes: 0 additions & 25 deletions res/thawte.pem

This file was deleted.

Binary file modified shone.phar
Binary file not shown.
4 changes: 0 additions & 4 deletions src/Compiler.php
Expand Up @@ -101,9 +101,6 @@ public function compile($pharFile = 'shone.phar')
}
$this->addShoneBin($phar);

// Add resources
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../res/config.json'));

// Stubs
$phar->setStub($this->getStub());

Expand All @@ -125,7 +122,6 @@ private function addFile($phar, $file, $strip = true)
$content = "\n".$content."\n";
}

$content = str_replace('@package_version@', $this->version, $content);
$content = str_replace('@release_date@', $this->versionDate, $content);

$phar->addFromString($path, $content);
Expand Down
43 changes: 27 additions & 16 deletions src/Config.php
Expand Up @@ -41,8 +41,31 @@ class Config
* @var array
*/
public static $defaultConfig = array(
'ignore-ext' => array(),
'ssl-cert-check' => 1
'ssl-cert-check' => 1,
'ignore-ext' => array(
'avi',
'bmp',
'doc',
'docx',
'gif',
'ico',
'jpeg',
'jpg',
'json',
'lock',
'log',
'md',
'mkv',
'mp3',
'mpeg',
'mpg',
'pdf',
'png',
'tar',
'txt',
'yml',
'zip'
)
);

/**
Expand All @@ -55,11 +78,6 @@ class Config
*/
private $config_file;

/**
* @var string
*/
private $home_file;

/**
* Build a new config object
*
Expand All @@ -80,15 +98,8 @@ public function __construct()
$home = getcwd();
}

$this->home_file = $home . '/shone.json';

// Attempt to load a custom config
$this->config_file = realpath($this->home_file);
if (!is_readable($this->config_file))
{
// Failing that, default to the bundled one
$this->config_file = __DIR__ . '/../res/config.json';
}
$this->config_file = $home . '/shone.json';
if (is_file($this->config_file) && is_readable($this->config_file)) {
$json = json_decode(file_get_contents($this->config_file), true);
$this->merge($json);
Expand All @@ -113,7 +124,7 @@ public function getConfigFile()
*/
public function save()
{
return file_put_contents($this->home_file, json_encode($this->config)) > 0;
return file_put_contents($this->config_file, json_encode($this->config)) > 0;
}

/**
Expand Down
9 changes: 2 additions & 7 deletions src/Scanner.php
Expand Up @@ -25,7 +25,7 @@
*/
class Scanner
{
const VERSION = '@package_version@';
const VERSION = '1.1.3';
const RELEASE_DATE = '@release_date@';

const USER_AGENT = 'Shone PHAR Client';
Expand Down Expand Up @@ -84,15 +84,10 @@ public function __construct()
* Get the user-agent to pass for the scanner
*
* @return string
* @codeCoverageIgnore
*/
protected function getUserAgent()
{
if (self::VERSION == '@package_version@') {
return self::USER_AGENT . ' - dev';
} else {
return self::USER_AGENT . ' - ' . self::VERSION;
}
return self::USER_AGENT . ' - ' . self::VERSION;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Tests/Command/SelfUpdateCommandTest.php
Expand Up @@ -10,6 +10,7 @@

namespace Shone\Scanner\Tests\Command;

use Shone\Scanner\Scanner;
use Shone\Scanner\Console\Application;
use Shone\Scanner\Command\SelfUpdateCommand;
use Shone\Scanner\Utils\RemoteFileSystem;
Expand Down Expand Up @@ -55,7 +56,7 @@ public function testExecuteForCommandAliasWithSameVersion()
$rfs = $this->getMock('Shone\Scanner\Utils\RemoteFileSystem');
$rfs->expects($this->atLeastOnce())
->method('getFile')
->will($this->returnValue(json_encode(array('version' => '@package_version@'))));
->will($this->returnValue(json_encode(array('version' => Scanner::VERSION))));

$command = $this->getMock('Shone\Scanner\Command\SelfUpdateCommand', array('getRemoteFileSystem'));

Expand Down

0 comments on commit ee7bb91

Please sign in to comment.