-
-
Notifications
You must be signed in to change notification settings - Fork 496
Added an initial documentation for Symfony Flex recipes #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I've just added one more option: For Symfony, instead of duplicating all recipes when 3.4 is out, we can just add it to |
README.rst
Outdated
.. code-block:: json | ||
|
||
{ | ||
"version_aliases": ["3.3", "3.4", "4.0-dev"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "4.0".
README.rst
Outdated
``aliases`` option | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
The main configuration option is called ``aliases`` and its value is an array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure that this is the main configuration option
README.rst
Outdated
|
||
Developers can now install this dependency as ``composer require acme-log``. For | ||
security reasons, and to improve Symfony's developer experience, a long list of | ||
aliases are reserved by Symfony Flex (``orm``, ``mailer``, ``loger``, ``admin``, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger
?
README.rst
Outdated
Developers can now install this dependency as ``composer require acme-log``. For | ||
security reasons, and to improve Symfony's developer experience, a long list of | ||
aliases are reserved by Symfony Flex (``orm``, ``mailer``, ``loger``, ``admin``, | ||
etc.) If you use those aliases in your recipe, they will be ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need this paragraph as we will be accepting or rejecting recipes before they get merged, so that's just a matter of reviewing the aliases.
README.rst
Outdated
|
||
This option lists all the additional versions of the dependency that work with | ||
this very same recipe (versions can use any of the syntaxes supported by | ||
Composer). This avoids duplicating recipes when a new version of the package is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Versions should only be like x.y
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also probably add a note about the fact that the main version used as a directory should be the oldest supported version.
README.rst
Outdated
Enables one or more bundles in the Symfony application by appending them to the | ||
``bundles.php`` file. Its value is an associative array with the bundle | ||
namespace as the keys and the array of environments where it must be enabled as | ||
the value. Use ``all`` to enable the bundle in any existing environment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably list all possible values. We do accept any values, but I think we need to restrict to the "default" supported Symfony envs: dev, test, prod.
README.rst
Outdated
The ``%BIN_DIR%`` string is a special value that it's turned into the absolute | ||
path of the binaries directory of the Symfony application. These are the special | ||
variables available: ``BIN_DIR``, ``CONF_DIR``, ``ETC_DIR``, ``SRC_DIR`` and | ||
``WEB_DIR``. You can also access to any variable defined in the ``extra`` section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add the %
sign so that people can copy/paste them directly.
README.rst
Outdated
"DB_HOST": "127.0.0.1", | ||
"DB_NAME": "symfony", | ||
"DB_USER": "root", | ||
"DB_PASSWORD": "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can change the example as DB_
vars are now different.
README.rst
Outdated
to execute them automatically when running ``composer install`` and ``composer update``. | ||
The value is an associative array where the key is the script to execute (including | ||
all its arguments and options) and the value is the type of script (``php-script`` | ||
for PHP scripts, ``script`` for Makefile tasks and ``symfony-cmd`` for Symfony |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
script
can really be any shell script, not just a make task.
README.rst
Outdated
file and wrapped with section separators (``###> your-recipe-name-here ###``) | ||
that must not be removed or modified. | ||
|
||
``post-install-output`` configurator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use Configurator
with a capital letter.
README.rst
Outdated
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This option lists all the additional versions of the dependency that work with | ||
this very same recipe (versions can use any of the syntaxes supported by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the sentence inside parenthesis is wrong
README.rst
Outdated
|
||
Enables one or more bundles in the Symfony application by appending them to the | ||
``bundles.php`` file. Its value is an associative array with the bundle | ||
namespace as the keys and the array of environments where it must be enabled as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the bundle class name, not the bundle namespace
README.rst
Outdated
The ``%BIN_DIR%`` string is a special value that it's turned into the absolute | ||
path of the binaries directory of the Symfony application. These are the special | ||
variables available: ``BIN_DIR``, ``CONF_DIR``, ``ETC_DIR``, ``SRC_DIR`` and | ||
``WEB_DIR``. You can also access to any variable defined in the ``extra`` section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should give access only to extras containing a scalar value (currently, we don't validate it in symfony/flex, but an array would give you a notice and Array
when casting it)
README.rst
Outdated
Symfony Flex turns that recipe into the following content appended to the ``.env`` | ||
and ``.env.dist`` files: | ||
|
||
.. code-block:: ini |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bash
would be better than ini
, as the syntax of the .env file is based on Bash (it is meant to allow using source .env
too in case you use explicit exports)
README.rst
Outdated
] | ||
} | ||
|
||
.. _`Symfony Flex`: https://github.com/fabpot/flex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it expected to stay there ? If we want to move it to the symfony org as soon as it is open-sourced, I suggest using directly the target URL to avoid forgetting to update it
README.rst
Outdated
All the contents of the ``manifest.json`` file are optional and they are divided | ||
into options and configurators. | ||
|
||
.. TODO: explain that recipe contents must be versioned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also explain the directory structure: vendor/package/version
where version is the minimum version supported by the recipe
README.rst
Outdated
|
||
This option defines one or more alternative names that can be used to install | ||
the dependency. Its value is an array of strings. For example, if a dependency | ||
is published as the ``acme-inc/acme-log-monolog-handler``, it can define one or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is published as the
README.rst
Outdated
"aliases": ["acme-log", "acmelog"] | ||
} | ||
|
||
Developers can now install this dependency as ``composer require acme-log``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"as acme-log
" or "with composer require acme-log
"
README.rst
Outdated
.. note:: | ||
|
||
When using ``version_aliases``, the directory where the recipe is defined | ||
must be the oldest supported version (``3.3`` in the previous example). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be 3.2
here as you don't need to duplicate the version from the directory name. That's only additional versions.
README.rst
Outdated
Enables one or more bundles in the Symfony application by appending them to the | ||
``bundles.php`` file. Its value is an associative array where the key is the | ||
bundle class name and the value is an array of environments where it must be | ||
enabled. The supported environtments are ``dev``, ``prod``, ``test`` and ``all`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
environments <- typo
README.rst
Outdated
} | ||
} | ||
|
||
The previous recipe is transformed by Symfony Flex into the following PHP code:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a README, you need to be explicit about highlighting, so you cannot use ::
, but .. code-block:: php
instead.
README.rst
Outdated
"MAILER_HOST": "localhost", | ||
"MAILER_PORT": "25", | ||
"MAILER_USER": "", | ||
"MAILER_PASSWORD": "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for the DB, we are now using MAILER_URL
:)
Thank you @javiereguiluz. |
It's based on your blog posts and the source code of Flex.