<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Dave Dash</title>
 <link href="http://davedash.com/tag/subversion/atom.xml" rel="self"/>
 <link href="http://davedash.com/tag/subversion"/>
 <updated>2012-01-17T21:54:19-08:00</updated>
 <id>http://davedash.com/</id>
 <author>
   <name>Dave Dash</name>
   <email>dd+atom1@davedash.com</email>
 </author>

 
 <entry>
   <title>Tips for symfony and Subversion</title>
   <link href="http://davedash.com/2007/04/17/tips-for-symfony-and-subversion/"/>
   <updated>2007-04-17T00:00:00-07:00</updated>
   <id>http://davedash.com/2007/04/17/tips-for-symfony-and-subversion</id>
   <content type="html">&lt;p&gt;[tags]symfony, subversion[/tags]&lt;/p&gt;

&lt;p&gt;There's some tricks you can do to running a symfony project with subversion:&lt;/p&gt;

&lt;h3&gt;Ignoring files in &lt;code&gt;cache/&lt;/code&gt; and &lt;code&gt;log/&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;The first thing you can do (and this is well documented in the &lt;a href=&quot;http://www.symfony-project.com/askeet/1&quot;&gt;askeet tutorial&lt;/a&gt;) is ignore files in &lt;code&gt;cache/&lt;/code&gt; and &lt;code&gt;log/&lt;/code&gt;.  These files are specific to each instance of your app and don't contain anything that needs to be in version control.&lt;/p&gt;

&lt;p&gt;Run the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd $SF_ROOT
rm -rf log/* cache/*
svn propedit svn:ignore log
svn propedit svn:ignore cache
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;svn propedit&lt;/code&gt; will bring up a text editor, in both instances you want to save the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;*
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Ignore other auto-generated files&lt;/h3&gt;

&lt;p&gt;Eric Sink wrote an excellent &lt;a href=&quot;http://www.ericsink.com/scm/source_control.html&quot;&gt;tutorial on source control&lt;/a&gt;.  In his chapter on &lt;a href=&quot;http://www.ericsink.com/scm/scm_repositories.html&quot;&gt;repositories&lt;/a&gt; he recommends checking in &lt;em&gt;only&lt;/em&gt; hand edited source code.  If a property file generates another file, check in the property file, not the auto-generated result.  This not only keeps your repository clean, it prevents a lot of unnecessary check-ins.&lt;/p&gt;

&lt;p&gt;If you use propel for your &lt;acronym title=&quot;Object Relational Mapping&quot;&gt;ORM&lt;/acronym&gt; layer there are a few files you can ignore using &lt;code&gt;svn propedit svn:ignore {dirname}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;$SF_ROOT/config&lt;/code&gt; we can ignore:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;*schema-transformed.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;These are &lt;code&gt;xml&lt;/code&gt; files that propel generates from &lt;code&gt;schema.xml&lt;/code&gt; (or &lt;code&gt;schema.yml&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;$SF_ROOT/data/sql&lt;/code&gt; we can ignore:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;lib.model.schema.sql
plugins.*.sql
sqldb.map
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;These are created from &lt;code&gt;schema.xml&lt;/code&gt; (or &lt;code&gt;schema.yml&lt;/code&gt;) as well.&lt;/p&gt;

&lt;p&gt;The real savings will come with your model.  The propel model creates customizable php classes in &lt;code&gt;lib/model&lt;/code&gt; which inherit from auto-generated files in &lt;code&gt;lib/om&lt;/code&gt; there are also auto-generated map files in `lib/map'&lt;/p&gt;

&lt;p&gt;We can run from &lt;code&gt;$SF_ROOT&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn propedit svn:ignore lib/model/om
svn propedit svn:ignore lib/model/map
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and enter&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;*
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;for both properties.&lt;/p&gt;

&lt;p&gt;If you've mistakenly checked in some of these files you will need to remove them from your repository via &lt;code&gt;svn delete&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;Linking the symfony Library&lt;/h3&gt;

&lt;p&gt;I prefer to embed the symfony library into each of my symfony apps rather than relying on a shared PEAR library.  This lets me run multiple versions of symfony without much fuss.  With subversion we can use the &lt;code&gt;svn:externals&lt;/code&gt; property to directly link our app with the symfony subversion repository.&lt;/p&gt;

&lt;p&gt;At first this sounds like danger, but externals can be linked to specific revisions.  However, the &lt;a href=&quot;http://symfony-project.com/&quot;&gt;symfony&lt;/a&gt; team tags their repository with version numbers.  To get this to work we need to do 3 things.  (&lt;strong&gt;UPDATE:&lt;/strong&gt; See Fabien's comment about using the lib/vendor directory)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Modify &lt;code&gt;config/config.php&lt;/code&gt; to look for symfony internally.  Just open it up and change it so it says this:
 &lt;div&gt;&lt;textarea name=&quot;code&quot; class=&quot;php&quot;&gt;
 &amp;lt;?php
 $sf_symfony_lib_dir  = dirname(&lt;strong&gt;FILE&lt;/strong&gt;).'/../lib/symfony';
 $sf_symfony_data_dir = dirname(&lt;strong&gt;FILE&lt;/strong&gt;).'/../data/symfony';
 &lt;/textarea&gt;&lt;/div&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;svn propedit svn:externals lib&lt;/code&gt; from &lt;code&gt;$SF_ROOT&lt;/code&gt; and enter:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; symfony http://svn.symfony-project.com/tags/RELEASE_1_0_2/lib/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or whatever version of symfony you want to link to, at the time of this post, &lt;code&gt;RELEASE_1_0_2&lt;/code&gt; is fairly fresh.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;svn propedit svn:externals data&lt;/code&gt; from &lt;code&gt;$SF_ROOT&lt;/code&gt; and enter:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; symfony http://svn.symfony-project.com/tags/RELEASE_1_0_2/data/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or whatever version of symfony you want to link to, at the time of this post.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Now when you do &lt;code&gt;svn update&lt;/code&gt; you'll have the &lt;a href=&quot;http://symfony-project.com/&quot;&gt;symfony&lt;/a&gt; library all linked up.  Furthermore this keeps all the developers on the same version of &lt;code&gt;symfony&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Also you may want to start running symfony using &lt;code&gt;./symfony&lt;/code&gt; versus &lt;code&gt;symfony&lt;/code&gt;.  The former looks at your configuration settings to determine which &lt;code&gt;symfony&lt;/code&gt; command to use, the latter is generally linked to your system wide command (which is generally the PEAR installed command).&lt;/p&gt;

&lt;h3&gt;Linking to symfony Plugins&lt;/h3&gt;

&lt;p&gt;I have my hands in a number of symfony plugins because I work on a lot of projects which tend to share a lot of similar functionality.  Many of the plugins are in early stages of development, so I find it helpful to have them linked from svn as well.  This way I can get the benefits of any new functionality and if the occasion should arise, I can contribute any useful changes I make.&lt;/p&gt;

&lt;p&gt;To link to the plugins you run &lt;code&gt;svn propedit svn:externals plugins&lt;/code&gt; and enter one plugin per line in the following format:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{plugin_name} -r{REVISION} {URL}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For one of my projects I use:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sfPrototypeTooltipPlugin http://svn.symfony-project.com/plugins/sfPrototypeTooltipPlugin
sfGuardPlugin http://svn.symfony-project.com/plugins/sfGuardPlugin
sfZendPlugin http://svn.symfony-project.com/plugins/sfZendPlugin
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I've omitted the revision, because I live dangerously and want to use the latest &lt;code&gt;$HEAD&lt;/code&gt;.&lt;/p&gt;
</content>
 </entry>
 

</feed>

