1
- How to Create and store a Symfony2 Project in git
2
- =================================================
1
+ How to Create and store a Symfony2 Project in Subversion
2
+ ========================================================
3
3
4
4
.. tip ::
5
5
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 ` .
8
8
9
9
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 `).
13
41
14
42
Initial Project Setup
15
43
---------------------
16
44
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 :
19
46
20
47
1. Download the `Symfony2 Standard Edition `_ without vendors.
21
48
22
49
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 ``:
24
55
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
28
59
29
- .. code-block :: text
60
+ 4. Copy the Symfony2 project files in the subversion folder:
30
61
31
- /web/bundles/
32
- /app/bootstrap*
33
- /app/cache/*
34
- /app/logs/*
35
- /vendor/
36
- /app/config/parameters.ini
62
+ .. code-block :: bash
37
63
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/
43
65
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:
45
69
46
70
.. code-block :: bash
47
-
48
- $ git init
49
71
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)"
51
87
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.
55
92
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:
57
94
58
95
.. 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.
61
106
62
107
8. Finally, download all of the third-party vendor libraries:
63
108
64
109
.. code-block :: bash
65
110
66
111
$ php bin/vendors install
67
112
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.
71
116
72
117
You can continue to follow along with the :doc: `/book/page_creation ` chapter
73
118
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
89
134
libraries into the ``vendor/ `` directory. It also reads ``deps.lock `` file,
90
135
pinning each library listed there to the exact git commit hash.
91
136
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,
93
138
not even as submodules. Instead, we rely on the ``deps `` and ``deps.lock ``
94
139
files and the ``bin/vendors `` script to manage everything. Those files are
95
140
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
97
142
your project up to date.
98
143
99
144
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.
118
163
by updating them to the version specified in ``deps `` and recording it
119
164
into the ``deps.lock `` file.
120
165
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 :
129
167
130
- Storing your Project on a Remote Server
131
- ---------------------------------------
168
+ Subversion hosting solutions
169
+ ----------------------------
132
170
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 :
137
173
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 `_ .
141
177
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 .
145
181
146
182
.. _`git` : http://git-scm.com/
183
+ .. _`svn` : http://subversion.apache.org/
184
+ .. _`Subversion` : http://subversion.apache.org/
147
185
.. _`Symfony2 Standard Edition` : http://symfony.com/download
148
186
.. _`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