Skip to content

Commit 14989b0

Browse files
author
Rajib Ahmed
committed
Remove spaces from README code samples.
1 parent 2d4458f commit 14989b0

File tree

1 file changed

+51
-57
lines changed

1 file changed

+51
-57
lines changed

README.md

Lines changed: 51 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ If you're not familiar with Composer, please see <http://getcomposer.org/>.
5252
1. Add php-resque to your application's composer.json.
5353

5454
```json
55-
56-
{
57-
...
58-
"require": {
59-
"chrisboulton/php-resque": "1.2.x"
60-
},
61-
...
62-
}
55+
{
56+
//...
57+
"require": {
58+
"chrisboulton/php-resque": "1.2.x"
59+
},
60+
// ...
61+
}
6362
```
6463

6564
2. Run `composer install`.
@@ -68,7 +67,7 @@ If you're not familiar with Composer, please see <http://getcomposer.org/>.
6867
initialization file. (example)
6968

7069
```sh
71-
require 'vendor/autoload.php';
70+
require 'vendor/autoload.php';
7271
```
7372

7473
## Jobs ##
@@ -78,32 +77,28 @@ If you're not familiar with Composer, please see <http://getcomposer.org/>.
7877
Jobs are queued as follows:
7978

8079
```php
80+
// Required if redis is located elsewhere
81+
Resque::setBackend('localhost:6379');
8182

82-
// Required if redis is located elsewhere
83-
Resque::setBackend('localhost:6379');
84-
85-
$args = array(
86-
'name' => 'Chris'
87-
);
88-
Resque::enqueue('default', 'My_Job', $args);
89-
83+
$args = array(
84+
'name' => 'Chris'
85+
);
86+
Resque::enqueue('default', 'My_Job', $args);
9087
```
9188

9289
### Defining Jobs ###
9390

9491
Each job should be in it's own class, and include a `perform` method.
9592

9693
```php
97-
98-
class My_Job
99-
{
100-
public function perform()
101-
{
102-
// Work work work
103-
echo $this->args['name'];
104-
}
105-
}
106-
94+
class My_Job
95+
{
96+
public function perform()
97+
{
98+
// Work work work
99+
echo $this->args['name'];
100+
}
101+
}
107102
```
108103

109104
When the job is run, the class will be instantiated and any arguments
@@ -120,24 +115,23 @@ The `tearDown` method if defined, will be called after the job finishes.
120115

121116

122117
```php
118+
class My_Job
119+
{
120+
public function setUp()
121+
{
122+
// ... Set up environment for this job
123+
}
124+
125+
public function perform()
126+
{
127+
// .. Run job
128+
}
123129

124-
class My_Job
130+
public function tearDown()
125131
{
126-
public function setUp()
127-
{
128-
// ... Set up environment for this job
129-
}
130-
131-
public function perform()
132-
{
133-
// .. Run job
134-
}
135-
136-
public function tearDown()
137-
{
138-
// ... Remove environment for this job
139-
}
132+
// ... Remove environment for this job
140133
}
134+
}
141135
```
142136

143137
### Tracking Job Statuses ###
@@ -151,15 +145,15 @@ To track the status of a job, pass `true` as the fourth argument to
151145
returned:
152146

153147
```php
154-
$token = Resque::enqueue('default', 'My_Job', $args, true);
155-
echo $token;
148+
$token = Resque::enqueue('default', 'My_Job', $args, true);
149+
echo $token;
156150
```
157151

158152
To fetch the status of a job:
159153

160154
```php
161-
$status = new Resque_Job_Status($token);
162-
echo $status->get(); // Outputs the status
155+
$status = new Resque_Job_Status($token);
156+
echo $status->get(); // Outputs the status
163157
```
164158

165159
Job statuses are defined as constants in the `Resque_Job_Status` class.
@@ -191,15 +185,15 @@ not having a single environment such as with Ruby, the PHP port makes
191185
*no* assumptions about your setup.
192186

193187
To start a worker, it's very similar to the Ruby version:
194-
195-
$ QUEUE=file_serve php bin/resque
196-
188+
```sh
189+
$ QUEUE=file_serve php bin/resque
190+
```
197191
It's your responsibility to tell the worker which file to include to get
198192
your application underway. You do so by setting the `APP_INCLUDE` environment
199193
variable:
200194

201195
```sh
202-
$ QUEUE=file_serve APP_INCLUDE=../application/init.php php bin/resque
196+
$ QUEUE=file_serve APP_INCLUDE=../application/init.php php bin/resque
203197
```
204198

205199
*Pro tip: Using Composer? More than likely, you don't need to worry about
@@ -216,8 +210,8 @@ Setting `VERBOSE` will print basic debugging information and `VVERBOSE`
216210
will print detailed information.
217211

218212
```sh
219-
$ VERBOSE QUEUE=file_serve bin/resque
220-
$ VVERBOSE QUEUE=file_serve bin/resque
213+
$ VERBOSE QUEUE=file_serve bin/resque
214+
$ VVERBOSE QUEUE=file_serve bin/resque
221215
```
222216

223217
### Priorities and Queue Lists ###
@@ -230,7 +224,7 @@ checked in.
230224
As per the original example:
231225

232226
```sh
233-
$ QUEUE=file_serve,warm_cache bin/resque
227+
$ QUEUE=file_serve,warm_cache bin/resque
234228
```
235229

236230
The `file_serve` queue will always be checked for new jobs on each
@@ -242,7 +236,7 @@ All queues are supported in the same manner and processed in alphabetical
242236
order:
243237

244238
```sh
245-
$ QUEUE=* bin/resque
239+
$ QUEUE=* bin/resque
246240
```
247241

248242
### Running Multiple Workers ###
@@ -251,7 +245,7 @@ Multiple workers ca be launched and automatically worked by supplying
251245
the `COUNT` environment variable:
252246

253247
```sh
254-
$ COUNT=5 bin/resque
248+
$ COUNT=5 bin/resque
255249
```
256250

257251
### Custom prefix ###
@@ -260,7 +254,7 @@ When you have multiple apps using the same Redis database it is better to
260254
use a custom prefix to separate the Resque data:
261255

262256
```sh
263-
$ PREFIX=my-app-name bin/resque
257+
$ PREFIX=my-app-name bin/resque
264258
```
265259

266260
### Forking ###
@@ -308,7 +302,7 @@ and supplying a callback that you would like triggered when the event is
308302
raised:
309303

310304
```sh
311-
Resque_Event::listen('eventName', [callback]);
305+
Resque_Event::listen('eventName', [callback]);
312306
```
313307

314308
`[callback]` may be anything in PHP that is callable by `call_user_func_array`:

0 commit comments

Comments
 (0)