[TASK] update composer

This commit is contained in:
Kanti 2015-03-30 19:06:21 +02:00
commit a685bcf91b
116 changed files with 4837 additions and 8167 deletions

View file

@ -0,0 +1,7 @@
.gitattributes export-ignore
.gitignore export-ignore
example.php export-ignore
example2.php export-ignore
.updateignore export-ignore
README.md export-ignore
tests export-ignore

View file

@ -0,0 +1 @@
README.md

View file

@ -1,39 +0,0 @@
<?php
namespace Kanti;
class CacheOneFile
{
protected $fileName = "";
protected $holdTime = 43200; //12h
public function __construct($fileName, $holdTime = 43200)
{
$this->fileName = $fileName;
$this->holdTime = $holdTime;
}
public function is()
{
if (! HelperClass::fileExists($this->fileName)) {
return false;
}
if (filemtime($this->fileName) < ( time() - $this->holdTime )) {
unlink($this->fileName);
return false;
}
return true;
}
public function get()
{
return file_get_contents($this->fileName);
}
public function set($content)
{
file_put_contents($this->fileName, $content);
}
}

View file

@ -1,12 +0,0 @@
<?php
namespace Kanti;
class HelperClass{
static public function fileExists($file){
return file_exists(dirname($_SERVER["SCRIPT_FILENAME"]) . "/" . $file);
}
static public function isInPhar() {
return substr(__FILE__,0,7) === "phar://";
}
}

View file

@ -0,0 +1,122 @@
#HubUpdater
![https://github.com/Kanti/hub-updater/releases/latest](https://img.shields.io/github/release/kanti/hub-updater.svg?style=flat-square) ![https://packagist.org/packages/kanti/hub-updater](https://img.shields.io/packagist/dt/kanti/hub-updater.svg?style=flat-square)
Simple Github Updater for Web Projects [PHP]
## is HubUpdater for me? [Checklist]
- [ ] I have an little product/projekt on github. (~ <=30MB)
- [ ] it can run PHP and uses [composer](https://getcomposer.org/)s autoloader
- [ ] I want my users to update my Product with one click
## check for an update [simple]
```php
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater('kanti/test');
$updater->update();
```
## how to provide an update?
- Go to your Repository on github.com &#x2023;&#x2023;
- click on the ``releases`` tab &#x2023;&#x2023;
- click on ``Draft a new release`` &#x2023;&#x2023;
- Enter your release details &#x2023;&#x2023;
- click on ``Publish release`` &#x2023;&#x2023;
- now you can use HubUpdater to update to the newest version.
- _note: <sub>The timestamp of the release is used. NOT the version number!!</sub>_
## install via composer
The recommended way to install hub-updater is through
[Composer](http://getcomposer.org).
```bash
# Install Composer
curl -sS https://getcomposer.org/installer | php
```
Next, run the Composer command to install the latest stable version of HubUpdater:
```bash
composer require kanti/hub-updater ~0.3
```
After installing, you need to require Composer's autoloader:
```php
<?php
require 'vendor/autoload.php';
```
## settings
```php
$settings = array(
"settingsKey" => 'value',
);
new \Kanti\HubUpdater($settings);
```
|setting|description|default|
|---|---|---|
|name|the name your Repository has |**must be set**|
|branch|the branch you like to watch. |``master``|
|cache|the directory you like to put the cache stuff |``./cache/``|
|save|the directory you like to put the content of the zip |``./``|
|prerelease|would you like to download the prereleases? |``false``|
|cacheFile|name of the InformationCacheFile(in cacheDir)|``downloadInfo.json``|
|holdTime|time(seconds) the Cached-Information will be used|``43200``|
|versionFile|name of the InstalledVersionInformation is safed(in cacheDir)|``installedVersion.json``|
|zipFile|name of the temporary zip file(in cacheDir)|``tmpZipFile.zip``|
|updateignore|name of the updateignore file(in root of project)|``.updateignore``|
|exceptions|if true, will ``throw new \Exception`` on failure|``false``|
## Check for an update [complete]
```php
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater(array(
"cacheFile" => "downloadInfo.json",//name of the InformationCacheFile(in cacheDir)
"holdTime" => 43200,//time(seconds) the Cached-Information will be used
"versionFile" => "installedVersion.json",//name of the InstalledVersionInformation is safed(in cacheDir)
"zipFile" => "tmpZipFile.zip",//name of the temporary zip file(in cacheDir)
"updateignore" => ".updateignore",//name of the updateignore file(in root of project)
"name" => 'kanti/test',//Repository to watch
"branch" => 'master',//wich branch to watch
"cache" => 'cache/',//were to put the caching stuff
"save" => 'save/',//there to put the downloaded Version[default ./]
"prerelease" => true,//accept prereleases?
"exceptions" => true,//if true, will throw new \Exception on failure
));
if ($updater->able()) {
if (isset($_GET['update'])) {
$updater->update();
echo '<p>updated :)</p>';
} else {
echo '<a href="?update">Update Me</a>'; //only update if they klick this link
}
} else {
echo '<p>uptodate :)</p>';
}
```
## the .updateignore file
### syntax:
put a file in one line and it will not be updated. _note <sub>put the .updateignore in your projects root directory</sub>_
```
.htaccess
favicon.ico
there/the/config.ini/is.ini
```
## Thanks:
- ca_bundle.crt form [bagder/ca-bundle](https://github.com/bagder/ca-bundle)

View file

@ -13,15 +13,23 @@
"support": {
"forum": "https://github.com/Kanti/hub-updater/issues",
"issues": "https://github.com/Kanti/hub-updater/issues",
"source": "https://github.com/Kanti/hub-updater"
"source": "https://github.com/Kanti/hub-updater"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"Kanti\\": ""
}
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.6@dev"
},
"autoload": {
"psr-4": {
"Kanti\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Kanti\\Test\\": "tests"
}
}
}

974
system/vendor/kanti/hub-updater/composer.lock generated vendored Normal file
View file

@ -0,0 +1,974 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "b8e4efa9ea29bd0bab50ed2191d4b9cb",
"packages": [],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "3d9669e597439e8d205baf315efb757038fb4dea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/3d9669e597439e8d205baf315efb757038fb4dea",
"reference": "3d9669e597439e8d205baf315efb757038fb4dea",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-01-16 19:29:51"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "fd0ac2007401505fb596fdfb859ec4e103d69e55"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/fd0ac2007401505fb596fdfb859ec4e103d69e55",
"reference": "fd0ac2007401505fb596fdfb859ec4e103d69e55",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"suggest": {
"dflydev/markdown": "~1.0",
"erusev/parsedown": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-0": {
"phpDocumentor": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"time": "2014-09-02 14:26:20"
},
{
"name": "phpspec/prophecy",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "d647e27524f9f7edc37baf63a114b52f5975808f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/d647e27524f9f7edc37baf63a114b52f5975808f",
"reference": "d647e27524f9f7edc37baf63a114b52f5975808f",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"phpdocumentor/reflection-docblock": "~2.0",
"sebastian/comparator": "~1.1"
},
"require-dev": {
"phpspec/phpspec": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2015-01-26 10:50:16"
},
{
"name": "phpunit/php-code-coverage",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "34cc484af1ca149188d0d9e91412191e398e0b67"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67",
"reference": "34cc484af1ca149188d0d9e91412191e398e0b67",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
"sebastian/environment": "~1.0",
"sebastian/version": "~1.0"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.2.1",
"ext-xmlwriter": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2015-01-24 10:06:35"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"File/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2013-10-10 15:34:57"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"Text/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2014-01-30 17:20:04"
},
{
"name": "phpunit/php-timer",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2013-08-02 07:42:54"
},
{
"name": "phpunit/php-token-stream",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db32c18eba00b121c145575fcbcd4d4d24e6db74",
"reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2015-01-17 09:51:32"
},
{
"name": "phpunit/phpunit",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "e85198bbce24ea11075ce8bdfc2cfffb818aae8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e85198bbce24ea11075ce8bdfc2cfffb818aae8c",
"reference": "e85198bbce24ea11075ce8bdfc2cfffb818aae8c",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpspec/prophecy": "~1.3.1",
"phpunit/php-code-coverage": "~2.0",
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.1",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.2",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.1|~3.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.6.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2015-01-27 07:32:25"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "b752b41e3fead4feee99f3a2f2972cef517abb8b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b752b41e3fead4feee99f3a2f2972cef517abb8b",
"reference": "b752b41e3fead4feee99f3a2f2972cef517abb8b",
"shasum": ""
},
"require": {
"doctrine/instantiator": "~1.0,>=1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "4.4.*@dev"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2015-01-18 10:44:19"
},
{
"name": "sebastian/comparator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "6a1e846331bb3cc1a305168125d047fb86260e3d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1e846331bb3cc1a305168125d047fb86260e3d",
"reference": "6a1e846331bb3cc1a305168125d047fb86260e3d",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.1",
"sebastian/exporter": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2015-01-05 16:29:00"
},
{
"name": "sebastian/diff",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "6dc90302a4cdf8486c221a0ad3a4da53859fcfa5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6dc90302a4cdf8486c221a0ad3a4da53859fcfa5",
"reference": "6dc90302a4cdf8486c221a0ad3a4da53859fcfa5",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "http://www.github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2015-01-01 09:20:29"
},
{
"name": "sebastian/environment",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2015-01-01 10:01:08"
},
{
"name": "sebastian/exporter",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "84839970d05254c73cde183a721c7af13aede943"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943",
"reference": "84839970d05254c73cde183a721c7af13aede943",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2015-01-27 07:23:06"
},
{
"name": "sebastian/global-state",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "007c441df427cf0e175372fcbb9d196bce7eb743"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/007c441df427cf0e175372fcbb9d196bce7eb743",
"reference": "007c441df427cf0e175372fcbb9d196bce7eb743",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-01-20 04:09:31"
},
{
"name": "sebastian/recursion-context",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "3989662bbb30a29d20d9faa04a846af79b276252"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252",
"reference": "3989662bbb30a29d20d9faa04a846af79b276252",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-01-24 09:48:32"
},
{
"name": "sebastian/version",
"version": "1.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b",
"reference": "a77d9123f8e809db3fbdea15038c27a95da4058b",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2014-12-15 14:25:24"
},
{
"name": "symfony/yaml",
"version": "dev-master",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "13ef40ee1437582f86fa805445363d0c694dae3a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/13ef40ee1437582f86fa805445363d0c694dae3a",
"reference": "13ef40ee1437582f86fa805445363d0c694dae3a",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2015-01-25 04:42:01"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"phpunit/phpunit": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.0"
},
"platform-dev": []
}

View file

@ -0,0 +1,5 @@
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater('kanti/test');
$updater->update();

View file

@ -0,0 +1,29 @@
<?php
require 'vendor/autoload.php';
$updater = new \Kanti\HubUpdater(array(
"cacheFile" => "downloadInfo.json",//name of the InformationCacheFile(in cacheDir)
"holdTime" => 43200,//time(seconds) the Cached-Information will be used
"versionFile" => "installedVersion.json",//name of the InstalledVersionInformation is safed(in cacheDir)
"zipFile" => "tmpZipFile.zip",//name of the temporary zip file(in cacheDir)
"updateignore" => ".updateignore",//name of the updateignore file(in root of project)
"name" => 'kanti/test',//Repository to watch
"branch" => 'master',//wich branch to watch
"cache" => 'cache/',//were to put the caching stuff
"save" => 'save/',//there to put the downloaded Version[default ./]
"prerelease" => true,//accept prereleases?
"exceptions" => true,//if true, will throw new \Exception on failure
));
if ($updater->able()) {
if (isset($_GET['update'])) {
$updater->update();
echo '<p>updated :)</p>';
} else {
echo '<a href="?update">Update Me</a>'; //only update if they klick this link
}
} else {
echo '<p>uptodate :)</p>';
}

View file

@ -0,0 +1,58 @@
<?php
namespace Kanti;
class CacheOneFile
{
protected $fileName = "";
protected $holdTime = 43200; //12h
public function __construct($fileName, $holdTime = 43200)
{
$this->fileName = $fileName;
$this->holdTime = $holdTime;
}
public function is()
{
if (!HelperClass::fileExists($this->fileName)) {
return false;
}
clearstatcache();
if (filemtime($this->fileName) < (time() - $this->holdTime)) {
unlink($this->fileName);
return false;
}
return true;
}
protected function file_force_contents()
{
$args = func_get_args();
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $args[0]);
$parts = explode(DIRECTORY_SEPARATOR, $path);
array_pop($parts);
$directory = '';
foreach ($parts as $part):
$check_path = $directory . $part;
if (is_dir($check_path . DIRECTORY_SEPARATOR) === FALSE) {
mkdir($check_path, 0755);
}
$directory = $check_path . DIRECTORY_SEPARATOR;
endforeach;
call_user_func_array('file_put_contents', $args);
}
public function get()
{
return file_get_contents($this->fileName);
}
public function set($content)
{
$this->file_force_contents($this->fileName, $content);
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace Kanti;
class HelperClass
{
protected static function isAbsolutePath($path)
{
return ('/' == $path[0] || '\\' == $path[0] || (strlen($path) > 3 && ctype_alpha($path[0]) && $path[1] == ':' &&
('\\' == $path[2] || '/' == $path[2])));
}
public static function fileExists($file)
{
if (is_bool($file) || is_array($file)) {
throw new \InvalidArgumentException;
}
if(strlen($file) >= 3 && static::isAbsolutePath($file)){
return file_exists($file);
}
return file_exists(dirname($_SERVER["SCRIPT_FILENAME"]) . "/" . $file);
}
static public function isInPhar()
{
return substr(__FILE__, 0, 7) === "phar://";
}
}

View file

@ -28,11 +28,14 @@ class HubUpdater
{
//options
if (is_array($option)) {
if (!isset($option['name'])) {
if (!isset($option['name']) || empty($option['name'])) {
throw new \Exception('No Name in Option Set');
}
$this->options = $option + $this->options;
} elseif (is_string($option)) {
if(empty($option)){
throw new \Exception('No Name Set');
}
$this->options['name'] = $option;
} else {
throw new \Exception('No Option Set');
@ -65,7 +68,8 @@ class HubUpdater
$this->streamContext = stream_context_create(
array(
'http' => array(
'header' => "User-Agent: Awesome-Update-My-Self-" . $this->options['name'] . "\r\nAccept: application/vnd.github.v3+json\r\n",
'header' => "User-Agent: Awesome-Update-My-Self-" . $this->options['name'] . "\r\n"
. "Accept: application/vnd.github.v3+json\r\n",
),
'ssl' => array(
'cafile' => $caBundleDir . '/ca_bundle.crt',
@ -288,6 +292,13 @@ class HubUpdater
$this->newestInfo = $release;
break;
}
if (!isset($this->newestInfo)) {
if ($this->options["exceptions"]) {
throw new \Exception("no suitable release found");
} else {
return array();
}
}
return $this->newestInfo;
}
}

View file

@ -0,0 +1,73 @@
<?php
/**
* Created by PhpStorm.
* User: Matthias
* Date: 27.01.2015
* Time: 08:55
*/
namespace Kanti\Test;
use Kanti\CacheOneFile;
class CacheOneFileTest extends \PHPUnit_Framework_TestCase
{
private $invalidContent = [
true,
false,
array('content'),
];
private $validContent = [
'',
'a',
'ab',
'abc',
1,
12,
123,
];
public function testIs()
{
$fileName = __DIR__ . "/asserts/testfile.txt";
$time = 60*60;//1h
if(file_exists($fileName)){
unlink($fileName);
}
$cache = new CacheOneFile($fileName,$time);
if($cache->is()){
$this->fail("is not set");
}
touch($fileName);
if(! $cache->is()){
$this->fail("could not set");
}
touch($fileName,0);
if($cache->is()){
$this->fail("does not reset");
}
}
public function testGet(){
$fileName = __DIR__ . "/asserts/testfile.txt";
$time = 60*60;//1h
$cache = new CacheOneFile($fileName,$time);
foreach ($this->validContent as $value) {
$cache->set($value);
if($cache->get() !== (string)$value){
$this->fail("get set dosen't match for value{" . print_r($value,true) . "}");
}
}
unlink($fileName);
foreach ($this->invalidContent as $value) {
$cache->set($value);
if($cache->get() === $value){
$this->fail("get set does match for value{" . print_r($value,true) . "}");
}
}
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* Created by PhpStorm.
* User: Matthias
* Date: 27.01.2015
* Time: 08:41
*/
namespace Kanti\Test;
use Kanti\HelperClass;
class HelperClassTest extends \PHPUnit_Framework_TestCase {
private $invalidFileNames = [
true,
false,
array('array'),
];
private $validFileNames = [
'',
'a',
'ab',
'abc',
1,
12,
123,
];
public function testStaticFileExists()
{
foreach ($this->invalidFileNames as $value) {
try {
HelperClass::fileExists($value);
} catch (\InvalidArgumentException $e) {
// Good, we got an exception!
continue;
}
$this->fail('Expected exception not raised on value: "' . $value . '".');
}
foreach ($this->validFileNames as $value) {
HelperClass::fileExists($value);
}
}
public function testIsInPhar(){
if(HelperClass::isInPhar()){
$this->fail("unit test is in phar?");
}
}
}

View file

@ -0,0 +1 @@
content

View file

@ -0,0 +1,9 @@
<?php
ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
$_SERVER['SCRIPT_FILENAME'] = dirname(__DIR__) . "\index.php";
chdir(dirname(__DIR__));
require_once __DIR__ . "/../vendor/autoload.php";

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Hub-Updater Test Suite">
<directory>./</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../src/</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="../build/report.tap"/>
<log type="junit" target="../build/report.junit.xml"/>
<log type="coverage-html" target="../build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="../build/coverage.txt"/>
<log type="coverage-clover" target="../build/logs/clover.xml"/>
</logging>
</phpunit>