Skip to content

Commit a08aa2c

Browse files
committed
rewrite complete for Subversion
1 parent fb33f52 commit a08aa2c

File tree

1 file changed

+102
-64
lines changed

1 file changed

+102
-64
lines changed

cookbook/workflow/new_project_svn.rst

+102-64
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,118 @@
1-
How to Create and store a Symfony2 Project in git
2-
=================================================
1+
How to Create and store a Symfony2 Project in Subversion
2+
========================================================
33

44
.. tip::
55

6-
Though this entry is specifically about git, the same generic principles
7-
will apply if you're storing your project in Subversion.
6+
This entry is specifically about Subversion, and based on principles found
7+
in :doc:`/cookbook/workflow/new_project_git`.
88

99
Once you've read through :doc:`/book/page_creation` and become familiar with
10-
using Symfony, you'll no-doubt be ready to start your own project. In this
11-
cookbook article, you'll learn the best way to start a new Symfony2 project
12-
that's stored using the `git`_ source control management system.
10+
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
14+
would do with `git`_.
15+
16+
.. caution::
17+
18+
This is **a** method to import your Symfony2 project in a Subversion
19+
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.
22+
23+
Subversion repository
24+
---------------------
25+
26+
For this article we will suppose that your repository layout follows the
27+
widespread standard structure :
28+
29+
.. code-block:: text
30+
31+
myproject/
32+
branches/
33+
tags/
34+
trunk/
35+
36+
.. tip::
37+
38+
Most of the subversion hosting should follow this standard practice. This
39+
is the recommended layout in `Version Control with Subversion`_ and the
40+
layout used by most free hosting (see :ref:`svn-hosting`).
1341

1442
Initial Project Setup
1543
---------------------
1644

17-
To get started, you'll need to download Symfony and initialize your local
18-
git repository:
45+
To get started, you'll need to download Symfony2 and get the basic Subversion setup :
1946

2047
1. Download the `Symfony2 Standard Edition`_ without vendors.
2148

2249
2. Unzip/untar the distribution. It will create a folder called Symfony with
23-
your new project structure, config files, etc. Rename it to whatever you like.
50+
your new project structure, config files, etc. Rename it to whatever you
51+
like.
52+
53+
3. Checkout the Subversion repository that will host this project. Let's say it
54+
is hosted on `Google code`_ and called ``myproject``:
2455

25-
3. Create a new file called ``.gitignore`` at the root of your new project
26-
(e.g. next to the ``deps`` file) and paste the following into it. Files
27-
matching these patterns will be ignored by git:
56+
.. code-block:: bash
57+
58+
$ svn checkout http://myproject.googlecode.com/svn/trunk myproject
2859
29-
.. code-block:: text
60+
4. Copy the Symfony2 project files in the subversion folder:
3061

31-
/web/bundles/
32-
/app/bootstrap*
33-
/app/cache/*
34-
/app/logs/*
35-
/vendor/
36-
/app/config/parameters.ini
62+
.. code-block:: bash
3763
38-
4. Copy ``app/config/parameters.ini`` to ``app/config/parameters.ini.dist``.
39-
The ``parameters.ini`` file is ignored by git (see above) so that machine-specific
40-
settings like database passwords aren't committed. By creating the ``parameters.ini.dist``
41-
file, new developers can quickly clone the project, copy this file to
42-
``parameters.ini``, customize it, and start developing.
64+
$ mv Symfony/* myproject/
4365
44-
5. Initialize your git repository:
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:
4569

4670
.. code-block:: bash
47-
48-
$ git init
4971
50-
6. Add all of the initial files to git:
72+
$ cd myproject/
73+
$ 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)"
5187
52-
.. code-block:: bash
53-
54-
$ git add .
88+
.. tip::
89+
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.
5592

56-
7. Create an initial commit with your started project:
93+
6. The rest of the files can now be added and commited to the project:
5794

5895
.. code-block:: bash
59-
60-
$ git commit -m "Initial commit"
96+
97+
$ svn add --force .
98+
$ svn ci -m "add basic Symfony Standard 2.X.Y"
99+
100+
7. Copy ``app/config/parameters.ini`` to ``app/config/parameters.ini.dist``.
101+
The ``parameters.ini`` file is ignored by svn (see above) so that
102+
machine-specific settings like database passwords aren't committed. By
103+
creating the ``parameters.ini.dist`` file, new developers can quickly clone
104+
the project, copy this file to ``parameters.ini``, customize it, and start
105+
developing.
61106

62107
8. Finally, download all of the third-party vendor libraries:
63108

64109
.. code-block:: bash
65110
66111
$ php bin/vendors install
67112
68-
At this point, you have a fully-functional Symfony2 project that's correctly
69-
committed to git. You can immediately begin development, committing the new
70-
changes to your git repository.
113+
At this point, you have a fully-functional Symfony2 project, followed in your
114+
Subversion repository. The development can start with commits in the Subversion
115+
repository.
71116

72117
You can continue to follow along with the :doc:`/book/page_creation` chapter
73118
to learn more about how to configure and develop inside your application.
@@ -89,11 +134,11 @@ script. This script reads from the ``deps`` file, and downloads the given
89134
libraries into the ``vendor/`` directory. It also reads ``deps.lock`` file,
90135
pinning each library listed there to the exact git commit hash.
91136

92-
In this setup, the vendors libraries aren't part of your git repository,
137+
In this setup, the vendors libraries aren't part of your repository,
93138
not even as submodules. Instead, we rely on the ``deps`` and ``deps.lock``
94139
files and the ``bin/vendors`` script to manage everything. Those files are
95140
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
141+
are version-controlled, and you can use the vendors script to bring
97142
your project up to date.
98143

99144
Whenever a developer clones a project, he/she should run the ``php bin/vendors install``
@@ -118,35 +163,28 @@ script to ensure that all of the needed vendor libraries are downloaded.
118163
by updating them to the version specified in ``deps`` and recording it
119164
into the ``deps.lock`` file.
120165

121-
Vendors and Submodules
122-
~~~~~~~~~~~~~~~~~~~~~~
123-
124-
Instead of using the ``deps``, ``bin/vendors`` system for managing your vendor
125-
libraries, you may instead choose to use native `git submodules`_. There
126-
is nothing wrong with this approach, though the ``deps`` system is the official
127-
way to solve this problem and git submodules can be difficult to work with
128-
at times.
166+
.. _svn-hosting:
129167

130-
Storing your Project on a Remote Server
131-
---------------------------------------
168+
Subversion hosting solutions
169+
----------------------------
132170

133-
You now have a fully-functional Symfony2 project stored in git. However,
134-
in most cases, you'll also want to store your project on a remote server
135-
both for backup purposes, and so that other developers can collaborate on
136-
the project.
171+
The biggest difference between `git`_ and `svn`_ is that Subversion *needs* a
172+
ventral repository to work. You then have several solutions :
137173

138-
The easiest way to store your project on a remote server is via `GitHub`_.
139-
Public repositories are free, however you will need to pay a monthly fee
140-
to host private repositories.
174+
- Self hosting: create your own repository and access it either through the
175+
filesystem or the network. To help in this task you can read `Version Control
176+
with Subversion`_.
141177

142-
Alternatively, you can store your git repository on any server by creating
143-
a `barebones repository`_ and then pushing to it. One library that helps
144-
manage this is `Gitolite`_.
178+
- Third party hosting: there are a lot of serious free hosting solutions
179+
available like `Google code`_, `SourceForge`_ or `Gna`_. Some of them offer
180+
git hosting as well.
145181

146182
.. _`git`: http://git-scm.com/
183+
.. _`svn`: http://subversion.apache.org/
184+
.. _`Subversion`: http://subversion.apache.org/
147185
.. _`Symfony2 Standard Edition`: http://symfony.com/download
148186
.. _`Standard Edition Readme`: https://github.com/symfony/symfony-standard/blob/master/README.md
149-
.. _`git submodules`: http://book.git-scm.com/5_submodules.html
150-
.. _`GitHub`: https://github.com/
151-
.. _`barebones repository`: http://progit.org/book/ch4-4.html
152-
.. _`Gitolite`: https://github.com/sitaramc/gitolite
187+
.. _`Version Control with Subversion`: http://svnbook.red-bean.com/
188+
.. _`Google code`: http://code.google.com/hosting/
189+
.. _`SourceForge`: http://sourceforge.net/
190+
.. _`Gna`: http://gna.org/

0 commit comments

Comments
 (0)