فهرست منبع

Merge branch 'master' of github.com:mmoreram/gearman-bundle

mmoreram 11 سال پیش
والد
کامیت
a7f3765cab
4فایلهای تغییر یافته به همراه56 افزوده شده و 58 حذف شده
  1. 4 7
      .gitignore
  2. 52 37
      README.md
  3. 0 10
      Service/GearmanCacheWrapper.php
  4. 0 4
      Service/GearmanParser.php

+ 4 - 7
.gitignore

@@ -1,10 +1,7 @@
-build
-phpunit.xml
-Resources/doc/_build/*
-coverage
+Tests/Functional/cache
+Tests/Functional/logs
 composer.lock
 composer.lock
-vendor
 composer.phar
 composer.phar
+phpunit.xml
 phpcs.log
 phpcs.log
-Tests/Functional/cache
-Tests/Functional/logs
+vendor

+ 52 - 37
README.md

@@ -17,6 +17,7 @@ Table of contents
     * [Installing Gearman](#installing-gearman)
     * [Installing Gearman](#installing-gearman)
     * [Installing GearmanBundle](#installing-gearmanbundle)
     * [Installing GearmanBundle](#installing-gearmanbundle)
     * [Configuration](#configuration)
     * [Configuration](#configuration)
+    * [Tests](#tests)
 2. [Definition of Workers](#definition-of-workers)
 2. [Definition of Workers](#definition-of-workers)
     * [Worker Annotations](#worker-annotations)
     * [Worker Annotations](#worker-annotations)
     * [Job Annotations](#job-annotations)
     * [Job Annotations](#job-annotations)
@@ -48,8 +49,9 @@ Installing/Configuring
 -----
 -----
 ## Tags
 ## Tags
 
 
-* Use version `2.3-dev` for last updated. Alias of `dev-master`.
+* Use last unstable version ( alias of `dev-master` ) to stay always in last commit
 * Use last stable version tag to stay in a stable release.
 * Use last stable version tag to stay in a stable release.
+* [![Latest Unstable Version](https://poser.pugx.org/mmoreram/gearman-bundle/v/unstable.png)](https://packagist.org/packages/mmoreram/gearman-bundle)  [![Latest Stable Version](https://poser.pugx.org/mmoreram/gearman-bundle/v/stable.png)](https://packagist.org/packages/mmoreram/gearman-bundle)
 
 
 > As long as Symfony2 versions 2.1 and 2.2 are not maintained anymore, and
 > As long as Symfony2 versions 2.1 and 2.2 are not maintained anymore, and
 > as long as these branches had same code than master branch, they all have been deleted
 > as long as these branches had same code than master branch, they all have been deleted
@@ -58,27 +60,27 @@ Installing/Configuring
 
 
 To install Gearman Job Server with `apt-get` use the following commands:
 To install Gearman Job Server with `apt-get` use the following commands:
 
 
-```
-sudo apt-get install gearman-job-server
+``` bash
+$ sudo apt-get install gearman-job-server
 ```
 ```
 
 
 And start server
 And start server
 
 
-```
-service gearman-job-server start
+``` bash
+$ service gearman-job-server start
 ```
 ```
 
 
 Then you need to install **Gearman driver** using the following commands
 Then you need to install **Gearman driver** using the following commands
 
 
-```
-pecl install channel://pecl.php.net/gearman-X.X.X
+``` bash
+$ pecl install channel://pecl.php.net/gearman-X.X.X
 ```
 ```
 
 
 You will find all available gearman versions in [Pear Repository](http://pecl.php.net/package/gearman)
 You will find all available gearman versions in [Pear Repository](http://pecl.php.net/package/gearman)
 Finally you need to start php module
 Finally you need to start php module
 
 
-```
-echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini
+``` bash
+$ echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini
 ```
 ```
 
 
 ## Installing [GearmanBundle](https://github.com/mmoreram/GearmanBundle)
 ## Installing [GearmanBundle](https://github.com/mmoreram/GearmanBundle)
@@ -96,8 +98,9 @@ You have to add require line into you composer.json file
 
 
 Then you have to use composer to update your project dependencies
 Then you have to use composer to update your project dependencies
 
 
-```
-php composer.phar update
+``` bash
+$ curl -sS https://getcomposer.org/installer | php
+$ php composer.phar update
 ```
 ```
 
 
 And register the bundle in your appkernel.php file
 And register the bundle in your appkernel.php file
@@ -211,6 +214,13 @@ liip_doctrine_cache:
             type: array
             type: array
 ```
 ```
 
 
+## Tests
+You can test this bundle with this command
+
+``` bash
+$ php vendor/phpunit/phpunit/phpunit.php
+```
+
 Definition of Workers
 Definition of Workers
 -----
 -----
 
 
@@ -358,24 +368,26 @@ class AcmeService
 
 
 And have this service defined in your dependency injection definition file
 And have this service defined in your dependency injection definition file
 
 
-    # /Resources/config/services.yml
-    bundles:
-        Services:
-            myServiceName:
-                class: Acme\AcmeBundle\Services\AcmeService
-                arguments:
-                    event_dispatcher: @event_dispatcher
-                    mailer: @mailer
-
+``` yml
+# /Resources/config/services.yml
+bundles:
+   Services:
+      myServiceName:
+         class: Acme\AcmeBundle\Services\AcmeService
+         arguments:
+            event_dispatcher: @event_dispatcher
+            mailer: @mailer
+```
 
 
 Running your Jobs
 Running your Jobs
 -----
 -----
 
 
 Gearman provides a set of commands that will make easier to know all workers settings.
 Gearman provides a set of commands that will make easier to know all workers settings.
 
 
+``` bash
+$ php app/console
+```
 ```
 ```
-/app/console
-
 gearman
 gearman
     gearman:cache:clear                   Clears gearman cache data on current environment
     gearman:cache:clear                   Clears gearman cache data on current environment
     gearman:cache:warmup                  Warms up gearman cache data
     gearman:cache:warmup                  Warms up gearman cache data
@@ -390,9 +402,10 @@ gearman
 
 
 Once all your workers are defined, you can simply list them to ensure all settings are correct.
 Once all your workers are defined, you can simply list them to ensure all settings are correct.
 
 
+``` bash
+$ php app/console gearman:workers:list
+```
 ```
 ```
-/app/console gearman:workers:list
-
 @Worker:  Mmoreramerino\TestBundle\Services\AcmeWorker
 @Worker:  Mmoreramerino\TestBundle\Services\AcmeWorker
 callablename:  MmoreramerinoTestBundleServicesMyAcmeWorker
 callablename:  MmoreramerinoTestBundleServicesMyAcmeWorker
 Jobs:
 Jobs:
@@ -407,9 +420,10 @@ You can describe full worker using its callableName.
 This command provides you all information about desired Worker, overwritting custom annotation settings to default config settings.
 This command provides you all information about desired Worker, overwritting custom annotation settings to default config settings.
 This command also provides you all needed information to work with Supervisord.
 This command also provides you all needed information to work with Supervisord.
 
 
+``` bash
+$ php app/console gearman:worker:describe MmoreramerinoTestBundleServicesMyAcmeWorker
+```
 ```
 ```
-php app/console gearman:worker:describe MmoreramerinoTestBundleServicesMyAcmeWorker
-
 @Worker\className : Mmoreramerino\TestBundle\Services\AcmeWorker
 @Worker\className : Mmoreramerino\TestBundle\Services\AcmeWorker
 @Worker\fileName : /var/www/projects/myrepo/src/Mmoreramerino/TestBundle/Services/AcmeWorker.php
 @Worker\fileName : /var/www/projects/myrepo/src/Mmoreramerino/TestBundle/Services/AcmeWorker.php
 @Worker\nameSpace : Mmoreramerino\TestBundle\Services
 @Worker\nameSpace : Mmoreramerino\TestBundle\Services
@@ -434,9 +448,10 @@ You can also describe full job using also its callableName
 This command provides you all information about desired Job, overwritting custom annotation settings to worker settings.
 This command provides you all information about desired Job, overwritting custom annotation settings to worker settings.
 This command also provides you all needed information to work with Supervisord.
 This command also provides you all needed information to work with Supervisord.
 
 
+``` bash
+$ php app/console gearman:job:describe MmoreramerinoTestBundleServicesMyAcmeWorker~doSomething
+```
 ```
 ```
-php app/console gearman:job:describe MmoreramerinoTestBundleServicesMyAcmeWorker~doSomething
-
 @Worker\className : Mmoreramerino\TestBundle\Services\AcmeWorker
 @Worker\className : Mmoreramerino\TestBundle\Services\AcmeWorker
 @Worker\fileName : /var/www/projects/myrepo/src/Mmoreramerino/TestBundle/Services/AcmeWorker.php
 @Worker\fileName : /var/www/projects/myrepo/src/Mmoreramerino/TestBundle/Services/AcmeWorker.php
 @Worker\nameSpace : Mmoreramerino\TestBundle\Services
 @Worker\nameSpace : Mmoreramerino\TestBundle\Services
@@ -473,9 +488,9 @@ php app/console gearman:job:describe MmoreramerinoTestBundleServicesMyAcmeWorker
 You can execute by command line an instance of a worker or a job.
 You can execute by command line an instance of a worker or a job.
 The difference between them is that an instance of a worker can execute any of their jobs, without assignning any priority to them, and a job only can run itself.
 The difference between them is that an instance of a worker can execute any of their jobs, without assignning any priority to them, and a job only can run itself.
 
 
-```
-php app/console gearman:worker:execute MmoreramerinoTestBundleServicesMyAcmeWorker
-php app/console gearman:job:execute MmoreramerinoTestBundleServicesMyAcmeWorker~doSomething
+``` bash
+$ php app/console gearman:worker:execute MmoreramerinoTestBundleServicesMyAcmeWorker
+$ php app/console gearman:job:execute MmoreramerinoTestBundleServicesMyAcmeWorker~doSomething
 ```
 ```
 
 
 > By using callableName you can let Supervisord maintain alive a worker.
 > By using callableName you can let Supervisord maintain alive a worker.
@@ -526,8 +541,8 @@ $gearman
 * setServer: Clean server list and set new server to requested client
 * setServer: Clean server list and set new server to requested client
 * clearServers: Clear server list
 * clearServers: Clear server list
 
 
-> By default, if no server is set, gearman will use server defined as default in config.yml
-> host: *127.0.0.1*
+> By default, if no server is set, gearman will use server defined as default in config.yml  
+> host: *127.0.0.1*  
 > port: *4730*
 > port: *4730*
 
 
 ## Request a job
 ## Request a job
@@ -735,8 +750,8 @@ Cache
 
 
 GearmanBundle caches all annotations. You can clear or warmup just gearman cache by using custom commands
 GearmanBundle caches all annotations. You can clear or warmup just gearman cache by using custom commands
 
 
-```
-/app/console
+``` bash
+$ php app/console
 
 
 gearman
 gearman
     gearman:cache:clear                   Clears gearman cache data on current environment
     gearman:cache:clear                   Clears gearman cache data on current environment
@@ -745,8 +760,8 @@ gearman
 
 
 Gearman also clear and warmup cache when using Symfony2 cache commands
 Gearman also clear and warmup cache when using Symfony2 cache commands
 
 
-```
-/app/console
+``` bash
+$ php app/console
 
 
 cache
 cache
     cache:clear                           Clears the cache
     cache:clear                           Clears the cache

+ 0 - 10
Service/GearmanCacheWrapper.php

@@ -9,19 +9,9 @@
 
 
 namespace Mmoreram\GearmanBundle\Service;
 namespace Mmoreram\GearmanBundle\Service;
 
 
-use Symfony\Component\Finder\Finder;
-use Symfony\Component\HttpKernel\KernelInterface;
 use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
 use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
 use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
 use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
-use Doctrine\Common\Annotations\Reader;
-use Doctrine\Common\Annotations\AnnotationRegistry;
 use Doctrine\Common\Cache\Cache;
 use Doctrine\Common\Cache\Cache;
-use Doctrine\Common\Annotations\SimpleAnnotationReader;
-use ReflectionClass;
-
-use Mmoreram\GearmanBundle\Module\WorkerCollection;
-use Mmoreram\GearmanBundle\Module\WorkerClass as Worker;
-use Mmoreram\GearmanBundle\Driver\Gearman\Work as WorkAnnotation;
 
 
 /**
 /**
  * Gearman cache loader class
  * Gearman cache loader class

+ 0 - 4
Service/GearmanParser.php

@@ -11,11 +11,7 @@ namespace Mmoreram\GearmanBundle\Service;
 
 
 use Symfony\Component\Finder\Finder;
 use Symfony\Component\Finder\Finder;
 use Symfony\Component\HttpKernel\KernelInterface;
 use Symfony\Component\HttpKernel\KernelInterface;
-use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
-use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
 use Doctrine\Common\Annotations\Reader;
 use Doctrine\Common\Annotations\Reader;
-use Doctrine\Common\Annotations\AnnotationRegistry;
-use Doctrine\Common\Cache\Cache;
 use ReflectionClass;
 use ReflectionClass;
 
 
 use Mmoreram\GearmanBundle\Module\WorkerCollection;
 use Mmoreram\GearmanBundle\Module\WorkerCollection;