Skip to content

Commit b3a5ada

Browse files
committed
Updating docs
1 parent 6b5a38b commit b3a5ada

File tree

5 files changed

+68
-75
lines changed

5 files changed

+68
-75
lines changed

docs/blocks.rst

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ Then, add it to your ``.bldr.yml`` file:
4444
4545
bldr: ~
4646
47-
blocks:
48-
- Acme\Block\Demo\AcmeDemoBlock
49-
5047
# If you have configs
5148
acme_demo:
5249
some_setting: some_value
@@ -64,9 +61,9 @@ This extension lets you run ``exec`` and ``apply`` tasks.
6461

6562
.. code-block:: yaml
6663
67-
tasks:
64+
jobs:
6865
sample:
69-
calls:
66+
tasks:
7067
-
7168
task: exec
7269
executable: php
@@ -91,9 +88,9 @@ Some examples:
9188

9289
.. code-block:: yaml
9390
94-
tasks:
91+
jobs:
9592
sample:
96-
calls:
93+
tasks:
9794
-
9895
task: filesystem:mkdir
9996
files: [testDir]
@@ -116,9 +113,9 @@ To use this:
116113

117114
.. code-block:: yaml
118115
119-
tasks:
116+
jobs:
120117
sample:
121-
calls:
118+
tasks:
122119
-
123120
task: notify
124121
message: Test Message
@@ -128,9 +125,6 @@ When adding this extension, you can specify `smtp` connections:
128125

129126
.. code-block:: yaml
130127
131-
blocks:
132-
- Bldr\Block\Notify\NotifyBlock
133-
134128
notify:
135129
smtp:
136130
host: smtp.google.com
@@ -149,17 +143,17 @@ This one needs some work. Right now, you can only have one watch task.
149143

150144
.. code-block:: yaml
151145
152-
tasks:
146+
jobs:
153147
sample:
154-
calls:
148+
tasks:
155149
-
156150
task: watch
157151
src:
158152
- { path: [src, tests], files: *.php, recursive: true } # Checks src and tests directories for *.php files recursively
159153
- { path: vendor/, files: [*.php, *.yml], recursive: true } # Checks vendor/ directory for *.php and *.yml files recursively
160154
profile: someProfile
161155
sample2:
162-
calls:
156+
tasks:
163157
-
164158
task: watch
165159
src:

docs/creating-a-block.rst

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ stable release you will have to add them too into your composer.json as below:
2727
2828
{
2929
"require-dev": {
30-
"bldr-io/bldr": "~4.2.0",
30+
"bldr-io/bldr": "~7.0.0",
3131
"dflydev/embedded-composer": "dev-master@dev",
3232
"composer/composer": "dev-master@dev"
3333
}
@@ -36,7 +36,7 @@ stable release you will have to add them too into your composer.json as below:
3636
4. Create a Block class
3737
-----------------------
3838

39-
All of bldr, and the official extensions follow `PSR-4`_ (as well as all the other PSR's, and most, if not all, of the bylaws).
39+
All of bldr, and the official extensions follow `PSR-4`_ (as well as all the other applicable PSR's, and most, if not all, of the bylaws).
4040
With that, create your directory structure and your Block class:
4141

4242
.. code-block:: shell
@@ -76,22 +76,23 @@ All blocks must extend the `Bldr\DependencyInjection\AbstractBlock`_, so your cl
7676
The assemble function is where the magic happens. If you take a look at the AbstractBlock, there are some helper functions
7777
in there to make it easier to add new calls, services, and parameters to the Container.
7878

79-
5. Create your Call
79+
5. Create your Task
8080
-------------------
8181

82-
As a demo, let's say we want to make a call that will output a random number to the user when running the call.
82+
As a demo, let's say we want to make a task that will output a random number to the user when running the task.
8383

84-
First, lets create the call. Directory structure doesn't really matter, but the core structure is normally `src/Call/<Name>Call.php`.
85-
Similar to blocks, all calls must extend `Bldr\Call\AbstractCall`_.
84+
First, lets create the task. Directory structure doesn't really matter, but the core structure is normally `src/Task/<Name>Task.php`.
85+
Similar to blocks, all tasks should extend `Bldr\Block\Core\Task\AbstractTask`_ and must implement `Bldr\Task\TaskInterface`_.
8686

87-
Lets make the `src/Call` directory, and create the new Call:
87+
Lets make the `src/Task` directory, and create the new task:
8888
.. code-block:: shell
8989
90-
mkdir src/Call && vim src/Call/OutputRandomNumberCall.php
90+
mkdir src/Task && vim src/Task/OutputRandomNumberCall.php
9191
92-
Then, let's build the call class! Extending the AbstractCall, requires that we implement two methods: `configure`_ and `run`_
92+
Then, let's build the task class! Extending the AbstractTask, suggests that we implement `configure`_ and requires that we
93+
implement `run`_.
9394

94-
*src/Call/OutputRandomNumberCall.php*
95+
*src/Task/OutputRandomNumberTask.php*
9596

9697
.. code-block:: php
9798
@@ -101,14 +102,15 @@ Then, let's build the call class! Extending the AbstractCall, requires that we i
101102
* License Information
102103
*/
103104
104-
namespace Acme\Block\Demo\Call;
105+
namespace Acme\Block\Demo\Task;
105106
106-
use Bldr\Call\AbstractCall;
107+
use Bldr\Block\Core\Task\AbstractTask;
108+
use Symfony\Component\Console\Output\OutputInterface;
107109
108110
/**
109111
* @author John Doe <john@doh.com>
110112
*/
111-
class OutputRandomNumberCall extends AbstractCall
113+
class OutputRandomNumberTask extends AbstractTask
112114
{
113115
/**
114116
* {@inheritDoc}
@@ -117,24 +119,22 @@ Then, let's build the call class! Extending the AbstractCall, requires that we i
117119
{
118120
$this->setName('acme_demo:output_random_number')
119121
->setDescription('This call outputs a random number. If min and max are specified, it will use those as the range')
120-
->addOption('min', true, 'Minimum number in range', 0)
121-
->addOption('max', true, 'Maximum number in range', 100)
122+
->addParameter('min', true, 'Minimum number in range', 0)
123+
->addParameter('max', true, 'Maximum number in range', 100)
122124
;
123125
}
124126
125127
/**
126128
* {@inheritDoc}
127129
*/
128-
public function run()
130+
public function run(OutputInterface $output)
129131
{
130-
$random = rand($this->getOption('min'), $this->getOption('max'));
131-
$this->output->writeln(['', 'Random Number: '.$random, '']);
132-
133-
return true;
132+
$random = rand($this->getParameter('min'), $this->getParameter('max'));
133+
$output->writeln(['', 'Random Number: '.$random, '']);
134134
}
135135
}
136136
137-
Next, we need to add the call to the container, so we can use it in .bldr.yml files:
137+
Next, we need to add the task to the container, so we can use it in .bldr.yml(.dist) files:
138138

139139
*src/AcmeDemoBlock.php*
140140

@@ -164,15 +164,15 @@ Next, we need to add the call to the container, so we can use it in .bldr.yml fi
164164
// Here's one of the shortcut methods! This method will return a Symfony DI Definition
165165
// that is tagged as `bldr`. If you need to, you can easily add arguments to the constructor,
166166
// or calls to methods.
167-
$call = $this->addCall('acme_demo.output_random_number', 'Acme\Block\Demo\AcmeDemoBlock');
167+
$task = $this->addTask('acme_demo.output_random_number', 'Acme\Block\Demo\Task\OutputRandomNumberTask');
168168
169169
// If you need dependencies, you could do the following:
170-
// $call->setArgument(0, new Reference('some_service'));
170+
// $task->setArgument(0, new Reference('some_service'));
171171
// or
172172
// $arguments = array(new Reference('some_service'));
173-
// $call->addMethodCall('someMethodName', $arguments);
173+
// $task->addMethodCall('someMethodName', $arguments);
174174
175-
// If you want to add a service, that isn't a call, you can also use:
175+
// If you want to add a service, that isn't a task, you can also use:
176176
// $this->addService($name, $class);
177177
// Which will also return a Symfony DI Definition
178178
}
@@ -199,12 +199,12 @@ With this, you should be able to install it with the `bldr.json` file and add it
199199
name: some/name
200200
profile:
201201
test:
202-
tasks:
202+
jobs:
203203
- randomize
204204
205-
tasks:
205+
jobs:
206206
randomize:
207-
calls:
207+
tasks:
208208
-
209209
type: acme_demo:output_random_number
210210
min: 0
@@ -214,7 +214,7 @@ And run it!
214214

215215
.. code-block:: shell
216216
217-
./bldr.phar build test
217+
./bldr.phar run test
218218
219219
220220
There's some more advanced stuff, like being able to specify configuration:
@@ -291,6 +291,7 @@ Then make a Configuration.php file. This config is the config from Symfony. You
291291
292292
.. _PSR-4: http://www.php-fig.org/psr/psr-4/
293293
.. _BldrDependencyInjectionAbstractBlock: https://github.com/bldr-io/bldr/blob/master/src/DependencyInjection/AbstractBlock.php
294-
.. _BldrCallAbstractCall:https://github.com/bldr-io/bldr/blob/master/src/Call/AbstractCall.php
294+
.. _BldrBlockCoreTaskAbstractTask:https://github.com/bldr-io/bldr/blob/master/src/Block/Core/Task/AbstractTask.php
295+
.. _BldrTaskTaskInterface:https://github.com/bldr-io/bldr/blob/master/src/Task/TaskInterface.php
295296
.. _configure: https://github.com/bldr-io/bldr/blob/master/src/Call/CallInterface.php#L28
296297
.. _run: https://github.com/bldr-io/bldr/blob/master/src/Call/CallInterface.php#L54

docs/index.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Welcome to Bldr's documentation!
44
Bldr, in the simplest terms, is a task runner, and an awesome one at that. It was written with simpler configs in mind. If you are used to build systems,
55
you've probably seen some pretty complicated build files, and they were probably written in xml that is clunky and a pain to maintain.
66

7-
Well, here's one written for Bldr using yaml (json is also supported):
7+
Well, here's one written for Bldr using yaml (json and php are also supported):
88

99
**This is a sample configuration. Your project may not have the dependencies required to run this configuration.**
1010

@@ -17,18 +17,19 @@ Well, here's one written for Bldr using yaml (json is also supported):
1717
profiles:
1818
default:
1919
description: Development Profile
20-
tasks:
20+
jobs:
2121
- prepare
2222
- lint
2323
- phpcs
2424
- test
2525
26-
tasks:
26+
jobs:
2727
prepare:
2828
description: Cleans up old builds and prepares the new one
29-
calls:
29+
tasks:
3030
-
3131
type: filesystem:remove
32+
continue
3233
files: [build/coverage, build/logs]
3334
-
3435
type: filesystem:mkdir
@@ -42,18 +43,17 @@ Well, here's one written for Bldr using yaml (json is also supported):
4243
arguments: [install, --prefer-dist]
4344
lint:
4445
description: Lints the files of the project
45-
calls:
46+
tasks:
4647
-
4748
type: apply
48-
failOnError: true
4949
src:
5050
- { path: [src, tests], files: *.php, recursive: true } # Checks src and tests directories for *.php files recursively
5151
executable: php
5252
arguments: [-l]
5353
5454
phpcs:
5555
description: Runs the PHP Code Sniffer
56-
calls:
56+
tasks:
5757
-
5858
type: exec
5959
executable: php
@@ -66,10 +66,9 @@ Well, here's one written for Bldr using yaml (json is also supported):
6666
- src/
6767
test:
6868
description: Runs the PHPUnit Tests
69-
calls:
69+
tasks:
7070
-
7171
type: exec
72-
failOnError: true
7372
executable: php
7473
arguments:
7574
- bin/phpunit
@@ -91,7 +90,6 @@ Content
9190
:maxdepth: 2
9291

9392
installation
94-
configuration
9593
usage
9694
blocks
9795
creating-a-block

docs/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ in ``$PATH`` as shown here_.
99

1010
.. code-block:: shell
1111
12-
$ composer global require bldr-io/bldr=~4.2.0 dflydev/embedded-composer=dev-master@dev composer/composer=dev-master@dev
12+
$ composer global require bldr-io/bldr=~7.0.0 dflydev/embedded-composer=dev-master@dev composer/composer=dev-master@dev
1313
1414
# Or
1515
@@ -31,7 +31,7 @@ It is suggested that you use the phar, as you can get conflicts with dependencie
3131
3232
# Or
3333
34-
$ composer require bldr-io/bldr "~6.4.0"
34+
$ composer require bldr-io/bldr "~7.0.0"
3535
3636
3737
And that's it! From here, you should be able to run ``bldr`` if you set it up globally, or ``./bin/bldr`` or ``php ./vendor/bin/bldr`` if you set

docs/usage.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,49 @@ Create a ``.bldr.yml(.dist)`` file:
1212
bldr:
1313
name: some/name
1414
description: A description about the project # (Not Required)
15-
profiles: # A list of profiles that can be ran with `./bldr.phar build`
16-
someTask:
17-
description: Gets ran when `./bldr.phar build someTask` is called
18-
tasks:
15+
profiles: # A list of profiles that can be ran with `./bldr.phar run`
16+
someJob:
17+
description: Gets ran when `./bldr.phar run someJob` is called
18+
jobs:
1919
- foo
20-
someOtherTask:
21-
tasks:
20+
someOtherJob:
21+
jobs:
2222
- bar
2323
inheritanceExample:
24-
description: Will run the tasks from `someTask` and then `someOtherTask`.
24+
description: Will run the tasks from `someJob` and then `someOtherJob`.
2525
uses:
26-
before: [someTask]
27-
after: [someOtherTask]
28-
tasks:
26+
before: [someJob]
27+
after: [someOtherJob]
28+
jobs:
2929
foo:
30-
description: Foo task
31-
calls:
30+
description: Foo job
31+
tasks:
3232
-
3333
type: exec
3434
executable: echo
3535
arguments: [Hello World]
3636
bar:
37-
description: Bar task
38-
calls:
37+
description: Bar job
38+
tasks:
3939
-
4040
type: exec
4141
executable: sleep
4242
arguments: [1]
4343
44-
To view a list of available call types, run:
44+
To view a list of available task types, run:
4545

4646
.. code-block:: shell
4747
4848
./bldr.phar task:list
4949
50-
And to get more information on a particular type, run:
50+
And to get more information on a particular task, run:
5151

5252
.. code-block:: shell
5353
5454
./bldr.phar task:info <task name>
5555
56-
To run your profiles: (This has changed since version 4)
56+
To run your profiles: (This has changed since version 7)
5757

5858
.. code-block:: shell
5959
60-
./bldr.phar build <profile name>
60+
./bldr.phar run <profile name>

0 commit comments

Comments
 (0)