Skip to content

Commit 76b7571

Browse files
committed
[cookbook] Tweaking the new entry on using subversion, making one section shared, etc
1 parent df53f7a commit 76b7571

File tree

5 files changed

+83
-114
lines changed

5 files changed

+83
-114
lines changed

cookbook/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Cookbook
55
:hidden:
66

77
workflow/new_project_git
8+
workflow/new_project_svn
89

910
controller/error_pages
1011
controller/service

cookbook/map.rst.inc

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
* **Workflow**
22

33
* :doc:`/cookbook/workflow/new_project_git`
4+
* :doc:`/cookbook/workflow/new_project_svn`
45

56
* **Controllers**
67

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Managing Vendor Libraries with bin/vendors and deps
2+
---------------------------------------------------
3+
4+
Every Symfony project uses a group of third-party "vendor" libraries. One
5+
way or another the goal is to download these files into your ``vendor/``
6+
directory and, ideally, to give you some sane way to manage the exact version
7+
you need for each.
8+
9+
By default, these libraries are downloaded by running a ``php bin/vendors install``
10+
"downloader" script. This script reads from the ``deps`` file at the root
11+
of your project. This is an ini-formatted script, which holds a list of each
12+
of the external libraries you need, the directory each should be downloaded to,
13+
and (optionally) the version to be downloaded. The ``bin/vendors`` script
14+
uses ``git`` to downloaded these, solely because these external libraries
15+
themselves tend to be stored via git. The ``vin/vendors`` script also reads
16+
the ``deps.lock`` file, which allows you to pin each library to an exact
17+
git commit hash.
18+
19+
It's important to realize that these vendor libraries are *not* actually part
20+
of *your* repository. Instead, they're simply un-tracked files that are downloaded
21+
into the ``vendor/`` directory by the ``bin/vendors`` script. But since all
22+
the information needed to download these files is saved in ``deps`` and ``deps.lock``
23+
(which *are* stored) in our repository), any other developer can use our
24+
project, run ``php bin/vendors install``, and download the exact same set
25+
of vendor libraries. This means that you're controlling exactly what each
26+
vendor library looks like, without needing to actually commit them to *your*
27+
repository.
28+
29+
So, whenever a developer uses your project, he/she should run the ``php bin/vendors install``
30+
script to ensure that all of the needed vendor libraries are downloaded.
31+
32+
.. sidebar:: Upgrading Symfony
33+
34+
Since Symfony is just a group of third-party libraries and third-party
35+
libraries are entirely controlled through ``deps`` and ``deps.lock``,
36+
upgrading Symfony means simply upgrading each of these files to match
37+
their state in the latest Symfony Standard Edition.
38+
39+
Of course, if you've added new entries to ``deps`` or ``deps.lock``, be sure
40+
to replace only the original parts (i.e. be sure not to also delete any of
41+
your custom entries).
42+
43+
.. caution::
44+
45+
There is also a ``php bin/vendors update`` command, but this has nothing
46+
to do with upgrading your project and you will normally not need to use
47+
it. This command is used to freeze the versions of all of your vendor libraries
48+
by updating them to the version specified in ``deps`` and recording it
49+
into the ``deps.lock`` file.

cookbook/workflow/new_project_git.rst

+1-38
Original file line numberDiff line numberDiff line change
@@ -79,44 +79,7 @@ to learn more about how to configure and develop inside your application.
7979

8080
.. _cookbook-managing-vendor-libraries:
8181

82-
Managing Vendor Libraries with bin/vendors and deps
83-
---------------------------------------------------
84-
85-
Every Symfony project uses a large group of third-party "vendor" libraries.
86-
87-
By default, these libraries are downloaded by running the ``php bin/vendors install``
88-
script. This script reads from the ``deps`` file, and downloads the given
89-
libraries into the ``vendor/`` directory. It also reads ``deps.lock`` file,
90-
pinning each library listed there to the exact git commit hash.
91-
92-
In this setup, the vendors libraries aren't part of your git repository,
93-
not even as submodules. Instead, we rely on the ``deps`` and ``deps.lock``
94-
files and the ``bin/vendors`` script to manage everything. Those files are
95-
part of your repository, so the necessary versions of each third-party library
96-
are version-controlled in git, and you can use the vendors script to bring
97-
your project up to date.
98-
99-
Whenever a developer clones a project, he/she should run the ``php bin/vendors install``
100-
script to ensure that all of the needed vendor libraries are downloaded.
101-
102-
.. sidebar:: Upgrading Symfony
103-
104-
Since Symfony is just a group of third-party libraries and third-party
105-
libraries are entirely controlled through ``deps`` and ``deps.lock``,
106-
upgrading Symfony means simply upgrading each of these files to match
107-
their state in the latest Symfony Standard Edition.
108-
109-
Of course, if you've added new entries to ``deps`` or ``deps.lock``, be sure
110-
to replace only the original parts (i.e. be sure not to also delete any of
111-
your custom entries).
112-
113-
.. caution::
114-
115-
There is also a ``php bin/vendors update`` command, but this has nothing
116-
to do with upgrading your project and you will normally not need to use
117-
it. This command is used to freeze the versions of all of your vendor libraries
118-
by updating them to the version specified in ``deps`` and recording it
119-
into the ``deps.lock`` file.
82+
.. include:: _vendor_deps.rst.inc
12083

12184
Vendors and Submodules
12285
~~~~~~~~~~~~~~~~~~~~~~

cookbook/workflow/new_project_svn.rst

+31-76
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,22 @@ How to Create and store a Symfony2 Project in Subversion
88

99
Once you've read through :doc:`/book/page_creation` and become familiar with
1010
using Symfony, you'll no-doubt be ready to start your own project. The
11-
preferred method to manage Symfony2 projects is using `git`_ but some people
12-
are stuck with `Subversion`_ and don't have a choice. In this cookbook article,
13-
you'll learn how to manage your project using `svn`_ in a similar manner you
11+
preferred method to manage Symfony2 projects is using `git`_ but some prefer
12+
to use `Subversion`_ which is totally fine!. In this cookbook article, you'll
13+
learn how to manage your project using `svn`_ in a similar manner you
1414
would do with `git`_.
1515

16-
.. caution::
16+
.. tip::
1717

18-
This is **a** method to import your Symfony2 project in a Subversion
18+
This is **a** method to tracking your Symfony2 project in a Subversion
1919
repository. There are several ways to do and this one is simply one that
20-
works. Furthermore, it is quite complex to do so you should probably
21-
consider using `git`_ anyway.
20+
works.
2221

23-
Subversion repository
24-
---------------------
22+
The Subversion Repository
23+
-------------------------
2524

2625
For this article we will suppose that your repository layout follows the
27-
widespread standard structure :
26+
widespread standard structure:
2827

2928
.. code-block:: text
3029
@@ -35,16 +34,16 @@ widespread standard structure :
3534
3635
.. tip::
3736

38-
Most of the subversion hosting should follow this standard practice. This
37+
Most subversion hosting should follow this standard practice. This
3938
is the recommended layout in `Version Control with Subversion`_ and the
4039
layout used by most free hosting (see :ref:`svn-hosting`).
4140

4241
Initial Project Setup
4342
---------------------
4443

45-
To get started, you'll need to download Symfony2 and get the basic Subversion setup :
44+
To get started, you'll need to download Symfony2 and get the basic Subversion setup:
4645

47-
1. Download the `Symfony2 Standard Edition`_ without vendors.
46+
1. Download the `Symfony2 Standard Edition`_ without or without vendors.
4847

4948
2. Unzip/untar the distribution. It will create a folder called Symfony with
5049
your new project structure, config files, etc. Rename it to whatever you
@@ -63,34 +62,28 @@ To get started, you'll need to download Symfony2 and get the basic Subversion se
6362
6463
$ mv Symfony/* myproject/
6564
66-
5. Let's now set the ignore rules, this is the complex part compared to `git`_.
67-
You need to add some specific files/folders to the subversion repository and
68-
edit ``svn:ignore`` properties:
65+
5. Let's now set the ignore rules. Not everything *should* be stored in your
66+
subversion repository. Some files (like the cache) are generated and
67+
others (like the database configuration) are meant to be customized
68+
on each machine. This makes use of the ``svn:ignore`` property, so that
69+
we can ignore specific files.
6970

7071
.. code-block:: bash
7172
7273
$ cd myproject/
7374
$ svn add --depth=empty app app/cache app/logs app/config web
74-
$ svn propedit svn:ignore .
75-
vendor
76-
$ svn propedit svn:ignore app/
77-
bootstrap*
78-
$ svn propedit svn:ignore app/config/
79-
parameters.ini
80-
$ svn propedit svn:ignore app/cache/
81-
*
82-
$ svn propedit svn:ignore app/logs/
83-
*
84-
$ svn propedit svn:ignore web
85-
bundles
86-
$ svn ci -m "commit basic symfony ignore list (vendor, app/bootstrap*, app/config/parameters.ini, app/cache/*, app/logs/*, web/bundles)"
8775
88-
.. tip::
76+
$ svn propset svn:ignore "vendor" .
77+
$ svn propset svn:ignore "bootstrap*" app/
78+
$ svn propset svn:ignore "parameters.ini" app/config/
79+
$ svn propset svn:ignore "*" app/cache/
80+
$ svn propset svn:ignore "*" app/logs/
8981
90-
This part is a bit painful but this is the only way to make sure that those
91-
files and folders will **never** appear in your project repository.
82+
$ svn propset svn:ignore "bundles" web
9283
93-
6. The rest of the files can now be added and commited to the project:
84+
$ svn ci -m "commit basic symfony ignore list (vendor, app/bootstrap*, app/config/parameters.ini, app/cache/*, app/logs/*, web/bundles)"
85+
86+
6. The rest of the files can now be added and committed to the project:
9487

9588
.. code-block:: bash
9689
@@ -113,9 +106,10 @@ To get started, you'll need to download Symfony2 and get the basic Subversion se
113106
.. tip::
114107

115108
`git`_ has to be installed to run ``bin/vendors``, this is the protocol
116-
used to fetch vendor libraries.
109+
used to fetch vendor libraries. This only means that ``git`` is used as
110+
a tool to basically help download the libraries in the ``vendor/`` directory.
117111

118-
At this point, you have a fully-functional Symfony2 project, followed in your
112+
At this point, you have a fully-functional Symfony2 project stored in your
119113
Subversion repository. The development can start with commits in the Subversion
120114
repository.
121115

@@ -127,54 +121,15 @@ to learn more about how to configure and develop inside your application.
127121
The Symfony2 Standard Edition comes with some example functionality. To
128122
remove the sample code, follow the instructions on the `Standard Edition Readme`_.
129123

130-
.. _cookbook-managing-vendor-libraries:
131-
132-
Managing Vendor Libraries with bin/vendors and deps
133-
---------------------------------------------------
134-
135-
Every Symfony project uses a large group of third-party "vendor" libraries.
136-
137-
By default, these libraries are downloaded by running the ``php bin/vendors install``
138-
script. This script reads from the ``deps`` file, and downloads the given
139-
libraries into the ``vendor/`` directory. It also reads ``deps.lock`` file,
140-
pinning each library listed there to the exact git commit hash.
141-
142-
In this setup, the vendors libraries aren't part of your repository,
143-
not even as submodules. Instead, we rely on the ``deps`` and ``deps.lock``
144-
files and the ``bin/vendors`` script to manage everything. Those files are
145-
part of your repository, so the necessary versions of each third-party library
146-
are version-controlled, and you can use the vendors script to bring
147-
your project up to date.
148-
149-
Whenever a developer clones a project, he/she should run the ``php bin/vendors install``
150-
script to ensure that all of the needed vendor libraries are downloaded.
151-
152-
.. sidebar:: Upgrading Symfony
153-
154-
Since Symfony is just a group of third-party libraries and third-party
155-
libraries are entirely controlled through ``deps`` and ``deps.lock``,
156-
upgrading Symfony means simply upgrading each of these files to match
157-
their state in the latest Symfony Standard Edition.
158-
159-
Of course, if you've added new entries to ``deps`` or ``deps.lock``, be sure
160-
to replace only the original parts (i.e. be sure not to also delete any of
161-
your custom entries).
162-
163-
.. caution::
164-
165-
There is also a ``php bin/vendors update`` command, but this has nothing
166-
to do with upgrading your project and you will normally not need to use
167-
it. This command is used to freeze the versions of all of your vendor libraries
168-
by updating them to the version specified in ``deps`` and recording it
169-
into the ``deps.lock`` file.
124+
.. include:: _vendor_deps.rst.inc
170125

171126
.. _svn-hosting:
172127

173128
Subversion hosting solutions
174129
----------------------------
175130

176131
The biggest difference between `git`_ and `svn`_ is that Subversion *needs* a
177-
central repository to work. You then have several solutions :
132+
central repository to work. You then have several solutions:
178133

179134
- Self hosting: create your own repository and access it either through the
180135
filesystem or the network. To help in this task you can read `Version Control

0 commit comments

Comments
 (0)