Skip to content

Commit 2723fc7

Browse files
committed
Merge pull request #237 from javiereguiluz/doc_rst
Converted documentation into reStructuredText format
2 parents 0abe584 + cb8a2c6 commit 2723fc7

File tree

6 files changed

+338
-267
lines changed

6 files changed

+338
-267
lines changed

CONTRIBUTING.md

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@ Contributing
33

44
First of all, **thank you** for contributing, **you are awesome**!
55

6-
Here are a few rules to follow in order to ease code reviews, and discussions before
7-
maintainers accept and merge your work.
6+
Here are a few rules to follow in order to ease code reviews, and discussions
7+
before maintainers accept and merge your work:
88

9-
You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
10-
[PSR-2](http://www.php-fig.org/psr/2/). If you don't know about any of them, you
11-
should really read the recommendations. Can't wait? Use the [PHP-CS-Fixer
12-
tool](http://cs.sensiolabs.org/).
13-
14-
You MUST run the test suite.
15-
16-
You MUST write (or update) unit tests.
17-
18-
You SHOULD write documentation.
9+
* You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
10+
[PSR-2](http://www.php-fig.org/psr/2/) recommendations. Use the [PHP-CS-Fixer
11+
tool](http://cs.sensiolabs.org/) to fix the syntax of your code automatically.
12+
* You MUST run the test suite.
13+
* You MUST write (or update) unit tests.
14+
* You SHOULD write documentation.
1915

2016
Please, write [commit messages that make
2117
sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
@@ -31,3 +27,52 @@ Also, while creating your Pull Request on GitHub, you MUST write a description
3127
which gives the context and/or explains why you are creating it.
3228

3329
Thank you!
30+
31+
Running tests
32+
-------------
33+
34+
Before running the test suite, execute the following Composer command to install
35+
the dependencies used by the bundle:
36+
37+
```bash
38+
$ composer install --dev
39+
```
40+
41+
Then, execute the tests executing:
42+
43+
```bash
44+
$ phpunit
45+
```
46+
47+
### JavaScript Test Suite
48+
49+
First, install [PhantomJS](http://phantomjs.org/) and then, execute this command:
50+
51+
```bash
52+
$ phantomjs Resources/js/run_jsunit.js Resources/js/router_test.html
53+
```
54+
55+
Compiling the JavaScript files
56+
------------------------------
57+
58+
> **NOTE**
59+
>
60+
> We already provide a compiled version of the JavaScript; this section is only
61+
> relevant if you want to make changes to this script.
62+
63+
In order to re-compile the JavaScript source files that we ship with this
64+
bundle, you need the Google Closure Tools. You need the
65+
[plovr](http://plovr.com/download.html) tool, which is a Java ARchive, so you
66+
also need a working Java environment. You can re-compile the JavaScript with the
67+
following command:
68+
69+
```bash
70+
$ java -jar plovr.jar build Resources/config/plovr/compile.js
71+
```
72+
73+
Alternatively, you can use the JMSGoogleClosureBundle. If you install this
74+
bundle, you can re-compile the JavaScript with the following command:
75+
76+
```bash
77+
$ php app/console plovr:build @FOSJsRoutingBundle/compile.js
78+
```

Resources/doc/commands.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Commands
2+
========
3+
4+
fos:js-routing:dump
5+
-------------------
6+
7+
This command dumps the route information into a file so that instead of having
8+
the controller generated JavaScript, you can use a normal file. This also allows
9+
to combine the routes with the other JavaScript files in assetic.
10+
11+
.. code-block:: bash
12+
13+
$ php app/console fos:js-routing:dump
14+
15+
Instead of the line
16+
17+
.. code-block:: twig
18+
19+
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
20+
21+
you now include this as
22+
23+
.. code-block:: html
24+
25+
<script src="/js/fos_js_routes.js"></script>
26+
27+
Or inside assetic, do
28+
29+
.. code-block:: twig
30+
31+
{% javascripts filter='?yui_js'
32+
'bundles/fosjsrouting/js/router.js'
33+
'js/fos_js_routes.js'
34+
%}
35+
<script src="{{ asset_url }}"></script>
36+
{% endjavascripts %}
37+
38+
.. caution::
39+
40+
You should follow the Symfony documentation about generating URLs
41+
in the console: `Configuring The Request Context Globally`_.
42+
43+
.. tip::
44+
45+
If you are using JMSI18nRoutingBundle, you need to run the command with the
46+
``--locale`` parameter once for each locale you use and adjust your include
47+
paths accordingly.
48+
49+
fos:js-routing:debug
50+
--------------------
51+
52+
This command lists all exposed routes:
53+
54+
.. code-block:: bash
55+
56+
$ php app/console fos:js-routing:debug [name]
57+
58+
.. _`Configuring The Request Context Globally`: http://symfony.com/doc/current/cookbook/console/sending_emails.html#configuring-the-request-context-globally

Resources/doc/index.md

Lines changed: 0 additions & 255 deletions
This file was deleted.

0 commit comments

Comments
 (0)