<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Git | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Mon, 29 Mar 2021 14:41:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>git deploy with composer install hook</title>
		<link>https://nerdpress.org/2014/11/14/git-deploy-composer-install-hook/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Fri, 14 Nov 2014 07:51:00 +0000</pubDate>
				<category><![CDATA[Composer]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[composer]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[Git]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2572</guid>

					<description><![CDATA[<p>I usually would not recommend deployment via git and running composer on your prod server for several reasons like f.e. the network. I rather believe in builds. But sometimes its just too convenient :) So i have this uncritical smaller API app where the hosting has git, ssh access and i am in full control &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2014/11/14/git-deploy-composer-install-hook/" class="more-link">Continue reading<span class="screen-reader-text"> "git deploy with composer install hook"</span></a></p>
The post <a href="https://nerdpress.org/2014/11/14/git-deploy-composer-install-hook/">git deploy with composer install hook</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>I usually would not recommend deployment via git and running <a href="https://getcomposer.org/">composer</a> on your prod server for several reasons like f.e. the network. I rather believe in builds.<br />
But sometimes its just too convenient :)</p>
<p>So i have this uncritical smaller API app where the hosting has git, ssh access and i am in full control and i decided too keep it simple.<br />
<span id="more-2572"></span></p>
<p>For deploy i login via ssh and make a <strong>git pull</strong> too fetch the code.<br />
Now we need to make a <strong>composer install</strong>, if the composer.lock has changes to fetch all php dependencies.<br />
Therefor i found a handy bash script, tweaked it a bit and installed it as post-merge git hook.</p>
<p>Install the hook:</p>
<pre class="brush: bash; title: ; notranslate">
cd project
nano .git/hooks/post-merge #paste &amp; edit the script
chmod 775 .git/hooks/post-merge 
</pre>
<p>What it does?<br />
After all code from the <strong>git pull</strong> is merged into the working tree, the hook checks if the composer.lock has changed. If so it will run a <strong>composer install</strong>.<br />
Note that it runs with <strong>&#8211;no-dev</strong> since we are on production and dont need f.e. phpunit there.</p>
<p>I know you know, but let it be said again: run <strong>composer install</strong> not <strong>composer update</strong>, as you never should run composer update on production, read why <a href="http://adamcod.es/2013/03/07/composer-install-vs-composer-update.html">here</a>.</p>
<p>So here is the bash:</p>
<pre class="brush: bash; title: ; notranslate">
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
# phponly by Ivo Bathke ;)
 
changed_files=&quot;$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)&quot;
 
check_run() {
  echo &quot;$changed_files&quot; | grep --quiet &quot;$1&quot; &amp;&amp; eval &quot;$2&quot;
}
 
# `composer install` if the `composer.lock` file gets changed
# to update all the php dependencies
check_run composer.lock &quot;composer install --no-dev&quot;
</pre>
<p>I <a href="https://gist.github.com/ivoba/6dcdff1d8eaed7e53ec6">forked</a> it from <a href="https://gist.github.com/GianlucaGuarini/8001627">here</a>, that forked from <a href="https://gist.github.com/sindresorhus/7996717">there</a>.</p>The post <a href="https://nerdpress.org/2014/11/14/git-deploy-composer-install-hook/">git deploy with composer install hook</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Silverstripe Setup Script</title>
		<link>https://nerdpress.org/2012/02/09/silverstripe-setup-script/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Thu, 09 Feb 2012 09:30:42 +0000</pubDate>
				<category><![CDATA[Project Setup]]></category>
		<category><![CDATA[Silverstripe]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Setup]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2041</guid>

					<description><![CDATA[<p>We thought we had to improve our SilverStripe setup script for our development environment. So Max and me rewrote it to add submodules and some other improvements. Just run: ./install_silverstripe.sh mynewproject tags/2.4.7 and you have silverstripe project folder structure the tutorial theme a already filled git repository sapphire as submodule cms as submodule Uploadify as &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/02/09/silverstripe-setup-script/" class="more-link">Continue reading<span class="screen-reader-text"> "Silverstripe Setup Script"</span></a></p>
The post <a href="https://nerdpress.org/2012/02/09/silverstripe-setup-script/">Silverstripe Setup Script</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>We thought we had to improve our <a href="https://nerdpress.org/2011/09/11/install-silverstripe-with-some-modules-from-git/">SilverStripe setup script</a> for our development environment.<br />
So <a href="https://web-development.cc/">Max</a> and me rewrote it to add submodules and some other improvements.</p>
<p>Just run:</p>
<pre class="brush: bash; title: ; notranslate">
./install_silverstripe.sh mynewproject tags/2.4.7
</pre>
<p>and you have</p>
<ul>
<li>silverstripe project folder structure</li>
<li>the tutorial theme</li>
<li>a already filled git repository</li>
<li>sapphire as submodule</li>
<li>cms as submodule</li>
<li>Uploadify as submodule</li>
<li>DataObjectManager as submodule</li>
<li>UserForms as submodule</li>
</ul>
<p><span id="more-2041"></span></p>
<p>What you then still need to do is:</p>
<ul>
<li>create the database</li>
<li>setup a local vhost</li>
<li>open your project url and run the install process</li>
<li>start to code</li>
</ul>
<p>So here it is:<br />
<script src="https://gist.github.com/1768946.js?file=install_silverstripe.sh"></script><noscript><pre><code class="language-shell shell"># install silverstripe + common modules from github
# usage sh install_silverstripe.sh &lt;folder_name&gt; &lt;tag/branch&gt;
# examples: 
# sh install_silverstripe.sh some_folder tags/2.4.5
# sh install_silverstripe.sh some_folder master

#set up project base folder
git clone git@github.com:silverstripe/silverstripe-installer.git $1
cd $1
git checkout $2
#we kill the .git because we want this repo just as starter and init our own repository (instead of export)
rm -rf .git

#set permissions for install
chmod 0777 assets assets/*
chmod 0666 .htaccess mysite/_config.php assets/*/*

git init

git submodule add git@github.com:silverstripe/silverstripe-cms.git cms
cd cms
git checkout $2
cd ..
git add cms
git commit -m &quot;checked out submodule cms to $2&quot;

git submodule add git@github.com:silverstripe/sapphire.git sapphire
cd sapphire
git checkout $2
cd ..
git add sapphire
git commit -m &quot;checked out submodule sapphire to $2&quot;

# add common modules
git submodule add git://github.com/unclecheese/Uploadify.git uploadify
git submodule add git://github.com/unclecheese/DataObjectManager.git dataobject_manager
git submodule add git://github.com/silverstripe/silverstripe-userforms.git userform

git submodule init
git submodule update

git add .
git commit -m &quot;Initial Commit&quot;</code></pre></noscript></p>The post <a href="https://nerdpress.org/2012/02/09/silverstripe-setup-script/">Silverstripe Setup Script</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>set up magento in multiple environments</title>
		<link>https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/</link>
					<comments>https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Tue, 27 Sep 2011 03:29:47 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[eCommerce]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[environments]]></category>
		<category><![CDATA[Git]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1667</guid>

					<description><![CDATA[<p>I just started digging in the shop software magento for a project and set up the following development environment. In this scenario development is done on two local machines while products and pages beeing already edited on the &#8220;Live&#8221;-Web-Server. Git is used for version control and deployment. Also FTP SSH. Magento is quite nice when &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/" class="more-link">Continue reading<span class="screen-reader-text"> "set up magento in multiple environments"</span></a></p>
The post <a href="https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/">set up magento in multiple environments</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>I just started digging in the shop software <a href="http://www.magentocommerce.com">magento</a> for a project and set up the following development environment.</p>
<p>In this scenario development is done on two local machines while products and pages beeing already edited on the &#8220;Live&#8221;-Web-Server.<br />
Git is used for version control and deployment. Also <del>FTP</del> SSH.<span id="more-1667"></span></p>
<p><a href="https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments.png"><img decoding="async" class="alignnone size-medium wp-image-1761" title="magento_sync_multiple_environments" src="https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments-300x147.png" alt="sync multiple Magento environments" width="300" height="147" srcset="https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments-300x147.png 300w, https://nerdpress.org/wp-content/uploads/2011/09/magento_sync_multiple_environments.png 732w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>Magento is quite nice when it comes to deployment, as most config stuff is stored in XML files.<br />
Those files are kept locally and ignored from version control.</p>
<p>So this is what my <a href="http://stackoverflow.com/questions/4564622/best-practices-for-using-git-with-magento">.gitignore</a> looks like:</p>
<pre class="brush: bash; title: ; notranslate">
#cache, sessions, logs
/var/cache/*
/var/session/*
/var/locks/*
/var/report/*
/var/log/*
#media folder - images etc...
/media/*

#local config files
/app/etc/local.xml
.htaccess

#database dump
/database.sql

</pre>
<p>So i got a copy of the repository in each environment with a local .htaccess and local.xml file.</p>
<p>Theres a few things stored in DB by magento, though.<br />
The most obvious is the &#8220;web/secure/base_url&#8221; and &#8220;web/unsecure/base_url&#8221; which both reside in the &#8220;core_config_data&#8221; table.<br />
Those have to be set to the name of the host you&#8217;re working on.</p>
<p>This can be done with a shell script like this:</p>
<pre class="brush: bash; title: ; notranslate">

#create a dupm of the live DB on the server
ssh user@server.com 'mysqldump -u&#x5B;username] -p&#x5B;password] &gt; ~/db_dump.sql'

#copy DB dump to local machine
scp user@server.com:~/db_dump.sql ./database.sql

#import SQL
mysql -u&#x5B;local_mysql_user] -p&#x5B;local_mysql_pw] &#x5B;local_db_name] &lt; ./database.sql

#update config settings in the DB
mysql -u&#x5B;local_mysql_user] -p&#x5B;local_mysql_pw] &#x5B;local_db_name]&lt;UPDATE
core_config_data
SET value='http://local.server.com/'
WHERE value ='http://server.com';
EOFMYSQL

</pre>
<p>This way all CMS and products  can be edited on the server, while the local machines can be easily synched.<br />
For me this works fine, as we are working only in the file system in the local environment.<br />
In case you can&#8217;t use the online Server as &#8220;database master&#8221; this might be not that simple.</p>
<p>As we most likely don&#8217;t want the whole /media folder under version control we might want to have another shell script to copy the media files to the local machine (via SCP in this case):</p>
<pre class="brush: bash; title: ; notranslate">

#remove local media folder
rm -rf ./media/*
#fetch media files
scp -r ssh_user@server.com:~/magento_folder/media/* ./media

</pre>
<p>I guess this could be done more efficiently with maybe ant or something.<br />
But for the moment this works fine for me.</p>
<p>So now i can update my local environment with one line on the console:</p>
<pre class="brush: bash; title: ; notranslate">

git pull; sh sync_db.sh; sh sync_media.sh

</pre>The post <a href="https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/">set up magento in multiple environments</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2011/09/27/set-up-magento-in-multiple-environments/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>install silverstripe with some modules from GIT</title>
		<link>https://nerdpress.org/2011/09/11/install-silverstripe-with-some-modules-from-git/</link>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Sun, 11 Sep 2011 12:53:22 +0000</pubDate>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Silverstripe]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[installer]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1634</guid>

					<description><![CDATA[<p>This is a small shell script to set up silverstripe CMS along with some modules i often use (as seen in ivo&#8217;s post) The script has two parameters: &#8211; the folder to clone the whole thing into &#8211; the branch/tag to checkout afterwards # install silverstripe + common modules from github # usage sh install_silverstripe.sh &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/09/11/install-silverstripe-with-some-modules-from-git/" class="more-link">Continue reading<span class="screen-reader-text"> "install silverstripe with some modules from GIT"</span></a></p>
The post <a href="https://nerdpress.org/2011/09/11/install-silverstripe-with-some-modules-from-git/">install silverstripe with some modules from GIT</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>This is a small shell script to set up <a href="http://www.silverstripe.org/">silverstripe CMS</a><br />
along with some modules i often use (as seen in <a href="https://nerdpress.org/2011/06/06/silverstripe-image-gallery-installation/">ivo&#8217;s post</a>)</p>
<p>The script has two parameters:<br />
&#8211; the folder to clone the whole thing into<br />
&#8211; the branch/tag to checkout afterwards</p>
<pre class="brush: bash; title: ; notranslate">
# install silverstripe + common modules from github
# usage sh install_silverstripe.sh &lt;folder_name&gt; &lt;tag/branch&gt;
# examples:
# sh install_silverstripe.sh some_folder tags/2.4.5
# sh install_silverstripe.sh some_folder master
</pre>
<p><span id="more-1634"></span></p>
<p>As Silverstripe itself is split up in 3 repositories<br />
(the installer/base folder, the cms and the sapphire framework itself)<br />
we fetch the base folder first:</p>
<pre class="brush: bash; title: ; notranslate">
#set up project base folder
git clone git@github.com:silverstripe/silverstripe-installer.git $1
cd $1
git checkout $2
</pre>
<p>Get the cms</p>
<pre class="brush: bash; title: ; notranslate">
#setup cms
git clone git@github.com:silverstripe/silverstripe-cms.git cms
cd cms
git checkout $2
cd ..
</pre>
<p>Get sapphire &#8230;</p>
<pre class="brush: bash; title: ; notranslate">
#setup framework
git clone git@github.com:silverstripe/sapphire.git sapphire
cd sapphire
git checkout $2
cd ..
</pre>
<p>Setup some permissions for the web installer.</p>
<pre class="brush: bash; title: ; notranslate">
#set permissions for install
chmod 0777 assets assets/*
chmod 0666 .htaccess mysite/_config.php assets/*/*
</pre>
<p>Fetch the blackcandy theme from a fourth repository.<br />
Backup the tutorial theme in case we need it.</p>
<pre class="brush: bash; title: ; notranslate">
#install blackcandy theme
mv themes/tutorial ./
rm -rf themes
git clone https://github.com/silverstripe-themes/silverstripe-blackcandy.git themes
cd themes
git checkout $2
cd ..
mv tutorial themes
</pre>
<p>Install some modules</p>
<pre class="brush: bash; title: ; notranslate">
# install common modules
git clone https://github.com/unclecheese/Uploadify.git uploadify
git clone https://github.com/unclecheese/DataObjectManager.git dataobject_manager
git clone https://github.com/silverstripe/silverstripe-userforms.git userforms
</pre>
<p><strong>iIput the script <a href="https://gist.github.com/1209496">on github</a></strong><br />
&#8230;in case you might wanna use it or add something i&#8217;ve missed.</p>The post <a href="https://nerdpress.org/2011/09/11/install-silverstripe-with-some-modules-from-git/">install silverstripe with some modules from GIT</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Unfuddle: Repository read access denied</title>
		<link>https://nerdpress.org/2011/03/21/unfuddle-repository-read-access-denied/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Mon, 21 Mar 2011 13:11:18 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Project Setup]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[unfuddle]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1427</guid>

					<description><![CDATA[<p>Unfuddle: Repository read access denied Ich benutze ja ganz gerne unfuddle für Projekte mit closed source. Dort kann man nämlich mit dem free Account, anders wie bei github, private repositories erstellen. Nun hatte ich aber neulich plötzlich einen Auth Fehler und konnte mich mit meinem key nicht mehr connecten: ERROR:gitosis.serve.main:Repository read access denied fatal: The &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/03/21/unfuddle-repository-read-access-denied/" class="more-link">Continue reading<span class="screen-reader-text"> "Unfuddle: Repository read access denied"</span></a></p>
The post <a href="https://nerdpress.org/2011/03/21/unfuddle-repository-read-access-denied/">Unfuddle: Repository read access denied</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Unfuddle: Repository read access denied</p>
<p>Ich benutze ja ganz gerne <a href="http://www.unfuddle.com">unfuddle</a> für Projekte mit closed source.<br />
Dort kann man nämlich mit dem free Account, anders wie bei <a href="http://github.com">github</a>, private repositories erstellen.</p>
<p>Nun hatte ich aber neulich plötzlich einen Auth Fehler und konnte mich mit meinem key nicht mehr connecten:</p>
<pre class="brush: bash; title: ; notranslate">
ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly
</pre>
<p>Ich war mir keiner schuld bewußt.</p>
<p>Nachdem ich meinen key gelöscht bei unfuddle hatte und neu anlegen wollte, kam dann die Fehlermeldung:</p>
<pre class="brush: bash; title: ; notranslate">
This public key has already been taken by another user.
If you have multiple accounts, you must use a different public key for each account.
</pre>
<p><span id="more-1427"></span></p>
<p>Des Rätsels Löung war dann <a href="http://unfuddle.com/community/forums/4/topics/362">hier</a> zu finden.</p>
<p>Kurz: ich hatte meinen key noch einem anderen Projekt zugeteilt, wo ich contribute, allerdings mit einem anderen Account.<br />
Also zweiten key angelegt, bei unfuddle eingetragen, über ssh config einen switch eingetragen und schon klappts</p>The post <a href="https://nerdpress.org/2011/03/21/unfuddle-repository-read-access-denied/">Unfuddle: Repository read access denied</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Symfony 2 &#8220;from scratch&#8221; bootstrappen</title>
		<link>https://nerdpress.org/2010/12/01/symfony-2-from-scratch-bootstrappen/</link>
					<comments>https://nerdpress.org/2010/12/01/symfony-2-from-scratch-bootstrappen/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 01 Dec 2010 11:52:52 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[Bundle]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Install]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[PHP 5.3]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[Setup]]></category>
		<category><![CDATA[symfony 2]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1247</guid>

					<description><![CDATA[<p>&#8230; machen wir heute mal, weil die Sandbox komisch ist mit den vielen (ärm &#8211; 2) redundanten /vendor und /wasweißich-Verzeichnissen. Also, bauen wir die Sandbox mal nach: Wir brauchen: Ein halbwegs aktuelles PHP 5.3.x, MySQL 5.x, Apache 2 und git. Dann erstmal den aktuellen Symfony2-Master ziehen&#8230; $ git clone https://github.com/fabpot/symfony.git symfony2test &#8230; und die Vendor-Scripte &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2010/12/01/symfony-2-from-scratch-bootstrappen/" class="more-link">Continue reading<span class="screen-reader-text"> "Symfony 2 &#8220;from scratch&#8221; bootstrappen"</span></a></p>
The post <a href="https://nerdpress.org/2010/12/01/symfony-2-from-scratch-bootstrappen/">Symfony 2 “from scratch” bootstrappen</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>&#8230; machen wir heute mal, weil die Sandbox komisch ist mit den vielen (ärm &#8211; 2) redundanten /vendor und /wasweißich-Verzeichnissen. </p>
<p>Also, bauen wir die Sandbox mal nach:</p>
<p><span id="more-1247"></span></p>
<p>Wir brauchen: Ein halbwegs aktuelles PHP 5.3.x, MySQL 5.x, Apache 2 und git.</p>
<p>Dann erstmal den aktuellen Symfony2-Master ziehen&#8230;</p>
<pre class="brush: bash; title: ; notranslate">
$ git clone https://github.com/fabpot/symfony.git symfony2test
</pre>
<p>&#8230; und die Vendor-Scripte installieren:</p>
<pre class="brush: bash; title: ; notranslate">
$ cd symfony2test
$ sh ./install_vendors.sh
</pre>
<p>Nun sollte sich folgendes Verzeichnislayout ergeben haben:</p>
<pre class="brush: bash; title: ; notranslate">
drwxr-xr-x  6 joshi joshi 4,0K 2010-11-30 21:19 .
drwxr-xr-x 22 joshi joshi 4,0K 2010-11-27 16:34 ..
-rw-rw-rw-  1 joshi joshi  998 2010-11-30 21:10 autoload.php.dist
drwxr-xr-x  8 joshi joshi 4,0K 2010-11-30 21:19 .git
-rw-r--r--  1 joshi joshi   34 2010-11-30 15:49 .gitignore
-rwxrwxrwx  1 joshi joshi  840 2010-11-30 21:10 install_vendors.sh
-rw-rw-rw-  1 joshi joshi 1,1K 2010-11-30 21:10 LICENSE
-rw-rw-rw-  1 joshi joshi 1,1K 2010-11-30 21:10 phpunit.xml.dist
-rw-rw-rw-  1 joshi joshi 1,2K 2010-11-30 21:10 README
drwxrwxrwx  3 joshi joshi 4,0K 2010-11-30 21:10 src
drwxrwxrwx  3 joshi joshi 4,0K 2010-11-30 21:10 tests
-rwxrwxrwx  1 joshi joshi  541 2010-11-30 21:10 update_vendors.sh
drwxrwxrwx 11 joshi joshi 4,0K 2010-11-30 21:13 vendor
</pre>
<p>Die Vendor-Scripts liegen zunächst mal im Projekt-Root-Verzeichnis; Dort haben sie aber nichts verloren:</p>
<pre class="brush: bash; title: ; notranslate">
$ mv vendor/ src/
</pre>
<p>Nun haben wir alles, um eine Symfony-App zu erstellen &#8211; das funktioniert momentan aber noch ausschließlich in Handarbeit:</p>
<pre class="brush: bash; title: ; notranslate">
$ mkdir -p web app/cache app/logs app/views app/config  src/Bundle src/Application/HelloBundle/Controller src/Application/HelloBundle/Resources/config src/Application/HelloBundle/Resources/views src/Application/HelloBundle/Resources/views/Hello src/Application/HelloBundle/Entity
</pre>
<p>Anmerkung: Diese wilde Verzeichnisstruktur entspricht 1:1 der Sandbox. Sicherlich steht das endgültige Verzeichnis-Layout eines typischen Symfony2-Projekts noch nicht fest &#8211; auch gibt es ja, wie bereits erwähnt, (noch) keine globale Executable samt symfony:generate-project Task. Ein Ziel von Symfony2 ist, die Modularisierung und Entkopplung der einzelnen Framework-Komponenenten (genannt &#8220;Bundles&#8221;) zu verfeinern. Ähnliche Konzepte kennt man aus der Java-Welt, aber auch bspw. aus CMF wie Silverstripe.</p>
<p>So ist der aktuelle Dev-Branch also eher als lose Sammlung einzelner &#8220;Bundles&#8221; zu verstehen und nicht als Full-Stack-Framework (Die Menge aller Bundles + Task-Bundle wird aber wieder genau das sein). Am ehesten vielleicht vergleichbar mit dem Aufbau des Zend-Frameworks &#8211; wobei das wohl fast als Negativ-Beispiel für &#8220;fake-loose-coupling&#8221; herhalten kann. Symfony2-Bundles sind &#8220;echt&#8221; decoupled und erwarten als einzige Abhängigkeit einen PHP-Autoloader.</p>
<p>&#8220;Bundles&#8221; sind die &#8220;Plugins&#8221; aus Symfony 1.x, mit dem Unterschied, dass das <a href="http://docs.symfony-reloaded.org/guides/internals/overview.html">Core-Framework selbst (&#8220;Kernel&#8221;) wiederum auch ein Bundle ist</a>.</p>
<p>Kurz gesagt: Das Verzeichnislayout, das in Symfony1.x zwar auch mehr oder weniger flexibel war, doch nur unter Schmerzen tiefgreifend veränderlich war, ist nun erstmal völlig variabel. Da ich mich aber an Fabians vorausschauender best-practice orientieren möchte, sieht &#8220;mein&#8221; Verzeichnislayout jetzt eben zufälligerweise aus wie das der Symfony2-Sandbox:</p>
<pre class="brush: bash; title: ; notranslate">
app/
  cache/
  config/
  logs/
  views/
autoload.php.dist
install_vendors.sh
LICENSE
phpunit.xml.dist
README
src/
  Application/
    HelloBundle/
      Controller/
      Entity/
      Resources/
        config/
        views/
  Bundle/
  Symfony/
  vendor/
    ...
tests/
update_vendors.sh
web/
</pre>
<p>Das Verzeichnis /web ist unser Webroot, es sollte nun also ein VirtualHost angelegt werden, der auf dieses zeigt: </p>
<pre class="brush: xml; title: ; notranslate">
&lt;VirtualHost *:80&gt;
  SetEnv APP_ENV dev
  ServerName symfony2.int
  DocumentRoot /var/www/symfony2test/web
&lt;/VirtualHost&gt;
</pre>
<p>Nun können wir damit beginnen, unsere Anwendungsdateien zu erstellen, indem wir einen Frontcontroller anlegen:</p>
<p>web/index.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
require_once __DIR__.'/../app/AppKernel.php';
use SymfonyComponentHttpFoundationRequest;
$kernel = new AppKernel('prod', false);
$kernel-&gt;handle(new Request())-&gt;send();
</pre>
<p>Zunächst holen wir uns den für unsere Anwendung spezifischen Kernel, instanziieren und bitten ihn, einen Http-Request zu bearbeiten.</p>
<p>Damit das Routing funktioniert, benötigen wir noch eine .htaccess-Datei (oder eine entsprechende mod_rewrite-Regel in der VirtualHost-Konfiguration):</p>
<p>web/.htaccess</p>
<pre class="brush: xml; title: ; notranslate">
&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php &#x5B;QSA,L]
&lt;/IfModule&gt;
</pre>
<p>Dann erzeugen wir unseren Kernel und eine Cache-Definition in app/:</p>
<p>app/AppKernel.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
require_once __DIR__.'/../src/autoload.php';

use SymfonyComponentHttpKernelKernel;
use SymfonyComponentDependencyInjectionLoaderLoaderInterface;

class AppKernel extends Kernel
{
    public function registerRootDir()
    {
        return __DIR__;
    }

    public function registerBundles()
    {
        $bundles = array(
            new SymfonyBundleFrameworkBundleFrameworkBundle(),
            new SymfonyBundleTwigBundleTwigBundle(),

            // enable third-party bundles
            new SymfonyBundleZendBundleZendBundle(),
            new SymfonyBundleSwiftmailerBundleSwiftmailerBundle(),
            new SymfonyBundleDoctrineBundleDoctrineBundle(),
            
            // register your bundles
            new ApplicationHelloBundleHelloBundle(),
        );

        if ($this-&gt;isDebug()) {
            $bundles&#x5B;] = new SymfonyBundleWebProfilerBundleWebProfilerBundle();
        }

        return $bundles;
    }

    public function registerBundleDirs()
    {
        return array(
            'Application'     =&gt; __DIR__.'/../src/Application',
            'Bundle'          =&gt; __DIR__.'/../src/Bundle',
            'Symfony\Bundle' =&gt; __DIR__.'/../src/Symfony/Bundle',
        );
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        // use YAML for configuration
        $loader-&gt;load(__DIR__.'/config/config_'.$this-&gt;getEnvironment().'.yml');
    }
}
</pre>
<p>Interessant sind die beiden zu implementierenden Methoden registerBundles() und registerBundleDirs(). RegisterBundles() teilt dem Kernel mit, welche Bundles in der Anwendung aktiv sind und verwendet werden &#8211; vergleichbar mit enablePlugins() der projectConfiguration.class.php eines beliebigen Symfony 1.x Projekts. registerBundleDirs() mappt wiederum die einzelnen Bundle-Namespaces auf ihre Pfade. Dies ist eigentlich ein wenig doppelt-gemoppelt, verwenden wir doch einen SPL-Autoloader, um unsere Namespaces zu registrieren. Allerdings benötigt der Kernel noch einmal explizit ein Namespace-Bundle-Pfad-Mapping, um bspw. Template-Namespaces korrekt aufzulösen. Stimmt bspw. der Pfad zum SymfonyBundle-Namespace nicht, läuft zwar die Anwendung, doch die Template-Engine kann die Pfade zu bspw. den Assets (Bildern und CSS-Stylesheets) des WebProfilerBundles nicht auflösen. Dies hätte den gleichen Effekt, als hätte ich vergessen, das Assets-Verzeichnis web/sf in einer Symfony 1.x-Anwendung zu referenzieren.</p>
<p>Vorsicht: Die Sandbox und Beispielscripts verwenden hier teils falsche Pfade: So zeigt der Namespace-Pfad der Symfony-Bundles zunächst auf src/vendor/symfony/src/Symfony/Bundle statt auf src/Symfony/Bundle. Das funktioniert in dem Falle auch, weil es eben zwei Symfony-Installationen in der Sandbox gibt (einmal die via install_vendors.sh und die, die man sich selbst gezogen hat). Man sollte sich immerhin für eine entscheiden und seine Projekt- und Arbeitsdateien entsprechend aufräumen. Aber dafür machen wir&#8217;s hier ja auch &#8220;from scratch&#8221;.</p>
<p>Jede Symfony2-Anwendung benötigt zudem eine konkrete, anwendungsspezifische Cache-Implementierung:</p>
<p>app/AppCache.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
require_once __DIR__.'/AppKernel.php';
use SymfonyBundleFrameworkBundleCacheCache;
class AppCache extends Cache
{
}
</pre>
<p>Nun können wir uns an die Konfiguration begeben. In der Datei app/AppKernel.php wird bestimmt, wie und wo konfiguriert wird:</p>
<pre class="brush: php; title: ; notranslate">
    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        // use YAML for configuration
        $loader-&gt;load(__DIR__.'/config/config_'.$this-&gt;getEnvironment().'.yml');
    }
</pre>
<p>Demnach müssen wir für jedes Environment eine config_%env%.yml-Datei erstellen. Dadurch, dass das Symfony2 Configuration-Framework explizite Vererbung (besser: imports) untestützt, reicht eine &#8220;globale&#8221; config.yml und entsprechend angepasste config_%env%.yml-Dateien:</p>
<p>app/config/config.yml</p>
<pre class="brush: python; title: ; notranslate">
app.config:
    charset:       UTF-8
    error_handler: null
    csrf_secret:   xxxxxxxxxx
    router:        { resource: &quot;%kernel.root_dir%/config/routing.yml&quot; }
    validation:    { enabled: true, annotations: true }
    templating:    {} #assets_version: SomeVersionScheme
    session:
        default_locale: en
        lifetime:       3600
        auto_start:     true

# Twig Configuration
twig.config:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%
</pre>
<p>Dann erstellen wir die Konfiguration für das development environment:</p>
<p>app/config/config_dev.yml</p>
<pre class="brush: python; title: ; notranslate">
imports:
    - { resource: config.yml }

app.config:
    router:   { resource: &quot;%kernel.root_dir%/config/routing_dev.yml&quot; }
    profiler: { only_exceptions: false }

webprofiler.config:
    toolbar: true
    intercept_redirects: true

zend.config:
    logger:
        priority: debug
        path:     %kernel.logs_dir%/%kernel.environment%.log
</pre>
<p>In Z. 1 wird config.yml als &#8220;gobale&#8221; Konfiguration importiert. Ansonsten alles mehr oder weniger selbsterklärend, die einzige Auffälligkeit ist, dass das Routing hier nun explizit konfiguriert wird (siehe Z. 5) &#8211; im Gegensatz zu Symfony 1.x-Projekten.</p>
<p>Anmerkung: Falls sich jemand wundern sollte, wo und wie diese Fülle an Optionen dokumentiert sind: Hier hilft nur in die jeweilige <a href="http://components.symfony-project.org/dependency-injection/">Service-Definition des DI-Containers</a> zu schauen. Das mag zu Beginn sehr verwirren, doch die einheitliche Bundle-Struktur hilft da wiederum bei der Navigation. Bundle-Konfigurationen findet man ausschließlich im Verzeichnis Resources/ eines Bundles.</p>
<p>Zurück zur Routing-Configuration, die nun angelegt werden muss:</p>
<p>app/config/routing.yml</p>
<pre class="brush: python; title: ; notranslate">
homepage:
    pattern:  /
    defaults: { _controller: FrameworkBundle:Default:index }

hello:
    resource: HelloBundle/Resources/config/routing.yml
</pre>
<p>app/config/routing_dev.yml</p>
<pre class="brush: python; title: ; notranslate">
_main:
    resource: routing.yml

_profiler:
    resource: WebProfilerBundle/Resources/config/routing/profiler.xml
    prefix:   /_profiler
</pre>
<p>Auch jetzt wurden zwei Routing-Konfigurationen (global und dev), beide werden transparent in config.yml bzw. config_dev.yml referenziert. Die routing_dev.yml ist ausschließlich da um die Route für das WebProfilerBundle zu registrieren.</p>
<p>Die Route &#8220;hello&#8221; in Z. 5 der routing.yml referenziert wiederum eine Bundle-spezifische Route, abzulegen im HelloBundle:</p>
<p>src/Application/HelloBundle/Resources/config/routing.yml:</p>
<pre class="brush: python; title: ; notranslate">
hello:
    pattern:  /hello/:name
    defaults: { _controller: HelloBundle:Hello:index }
</pre>
<p>Somit haben wir fast alles zusammen, um eine Anwendung zum Laufen zu bringen &#8211; Front Controller, Kernel-Konfiguration, Cache, Routing &#8211; nur die konkrete Implementierung unserer Anwendung fehlt noch sowie ein winziges Detail, der Autoloader. Dieser wird ebenfalls durch unseren Kernel angeschmissen (siehe Z. 1 app/AppKernel.php). Erwartet wird eine flache autoload.php-Datei in src/ &#8211; ob sie dort korrekt gelagert ist, oder eher in src/Application liegen sollte oder gar im Projekt root &#8211; das kann sich jeder selbst zusammenreimen.</p>
<p>src/autoload.php:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
require_once __DIR__ . '/Symfony/Component/HttpFoundation/UniversalClassLoader.php';

use SymfonyComponentHttpFoundationUniversalClassLoader;

$vendorDir = __DIR__ . '/vendor';

$loader = new UniversalClassLoader();
$loader-&gt;registerNamespaces(array(
    'Symfony'                        =&gt; __DIR__,
    'Application'                    =&gt; __DIR__,
    'Bundle'                         =&gt; __DIR__,
    'Doctrine\Common\DataFixtures' =&gt; $vendorDir.'/doctrine-data-fixtures/lib',
    'Doctrine\Common'               =&gt; $vendorDir.'/doctrine-common/lib',
    'Doctrine\DBAL\Migrations'     =&gt; $vendorDir.'/doctrine-migrations/lib',
    'Doctrine\ODM\MongoDB'         =&gt; $vendorDir.'/doctrine-mongodb/lib',
    'Doctrine\DBAL'                 =&gt; $vendorDir.'/doctrine-dbal/lib',
    'Doctrine'                       =&gt; $vendorDir.'/doctrine/lib',
    'Zend'                           =&gt; $vendorDir.'/zend/library',
));
$loader-&gt;registerPrefixes(array(
    'Swift_' =&gt; $vendorDir.'/swiftmailer/lib/classes',
    'Twig_'  =&gt; $vendorDir.'/twig/lib',
));
$loader-&gt;register();
</pre>
<p>In autoload.php verwenden wir keine PHP-nativen Autoload-Mechanismen noch den SPL-Autoload-Wrapper direkt, sondern eine weitere Symfony2 Framework-Komponente: Den UniversalClassLoader. Dieser Loader kann Namespaces auflösen, lässt sich aber ebenfalls auf die &#8220;alte&#8221;, unter PHP >= 5.2 gängige Zend bzw. Pear-Notation mappen, was das obige Codesnippet aufzeigt. Intern baut der UniversalClassLoader natürlich auf den entsprechenden SPL-Funktionen auf.</p>
<p>Vorsicht: Der Code entspricht wieder nicht dem originalen Sandbox-Code (Der Namespace-Pfad für die Symfony-Komponenten ist wieder src/ statt src/vendor/symfony/src).</p>
<p>Wir haben weiter oben Routen definiert, die nun entsprechende Endpunkte im HelloBundle brauchen. Wir implementieren dazu eine Bundle-Definition und einen HelloController:</p>
<p>src/Application/HelloBundle/HelloBundle.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace ApplicationHelloBundle;

use SymfonyComponentHttpKernelBundleBundle;

class HelloBundle extends Bundle
{
}

</pre>
<p>src/Application/HelloBundle/Controller:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace ApplicationHelloBundleController;

use SymfonyBundleFrameworkBundleControllerController;

class HelloController extends Controller
{
    public function indexAction($name)
    {
        return $this-&gt;render('HelloBundle:Hello:index.twig', array('name' =&gt; $name));

        // render a PHP template instead
        // return $this-&gt;render('HelloBundle:Hello:index.php', array('name' =&gt; $name));
    }
}
</pre>
<p>und die zugehörige View:</p>
<pre class="brush: xml; title: ; notranslate">
{% extends &quot;HelloBundle::layout.twig&quot; %}

{% block content %}
    Hello {{ name }}!
{% endblock %}
</pre>
<p>Nun müssen wir nur noch die im Template referenzierte Layout-Datei anlegen:</p>
<p>src/Application/HelloBundle/Resources/views/layout.twig:</p>
<pre class="brush: xml; title: ; notranslate">
{% extends &quot;::layout.twig&quot; %}

{% block body %}
    &lt;h1&gt;Hello Application&lt;/h1&gt;

    {% block content %}{% endblock %}
{% endblock %}
</pre>
<p>Und wiederum die in diesem Bundle-spezifischen Layout-Template referenzierte &#8220;globale&#8221; Layout-Datei &#8211; stilsicher mit HTML5-Doctype:</p>
<p>app/views/layout.twig:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
        &lt;title&gt;{% block title %}Hello Application{% endblock %}&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        {% block body %}{% endblock %}
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Das wars. Man sollte nun im Browser zwei Seiten sehen können, einmal die Standard-Projekt-Route &#8220;/&#8221; auf FrameworkBundle:Default:index gemapped und die Route /hello/:name auf HelloBundle:Hello:index gemapped. Zu beachten ist hierbei das Namespace-Mapping auf die Pfade, die im AppKernel unter registerBundleDirs() angegeben wurden &#8211; zum besseren Verständis der Namensraumauflösung der Routen sowie der Templates.</p>
<p>Abschließend kann man sich noch eine Symfony-Konsolenanwendung nach /app legen:</p>
<p>app/console</p>
<pre class="brush: php; title: ; notranslate">
#!/usr/bin/env php
&lt;?php
require_once __DIR__.'/AppKernel.php';
use SymfonyBundleFrameworkBundleConsoleApplication;
$kernel = new AppKernel('dev', true);
$application = new Application($kernel);
$application-&gt;run();
</pre>
<p>nach einem </p>
<pre class="brush: bash; title: ; notranslate">
$ chmod + x app/console
</pre>
<p>kann man nun via ./app/console folgende Ausgabe bewundern und sich mit den ersten Symfony-Bundle-Tasks vertraut machen:</p>
<pre class="brush: bash; title: ; notranslate">
$ app/console
Symfony version 2.0.0-DEV - app

Usage:
  &#x5B;options] command &#x5B;arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v Increase verbosity of messages.
  --version        -V Display this program version.
  --ansi           -a Force ANSI output.
  --no-interaction -n Do not ask any interactive question.
  --shell          -s Launch the shell.

Available commands:
  help                         Displays help for a command (?)
  list                         Lists commands
assets
  :install                     
doctrine
  :ensure-production-settings  Verify that Doctrine is properly configured for a production environment.
doctrine:cache
  :clear-metadata              Clear all metadata cache for a entity manager.
  :clear-query                 Clear all query cache for a entity manager.
  :clear-result                Clear result cache for a entity manager.
doctrine:data
  :load                        Load data fixtures to your database.
doctrine:database
  :create                      Create the configured databases.
  :drop                        Drop the configured databases.
doctrine:generate
  :entities                    Generate entity classes and method stubs from your mapping information.
  :entity                      Generate a new Doctrine entity inside a bundle.
  :proxies                     Generates proxy classes for entity classes.
  :repositories                Generate repository classes from your mapping information.
doctrine:mapping
  :convert                     Convert mapping information between supported formats.
  :convert-d1-schema           Convert a Doctrine 1 schema to Doctrine 2 mapping files.
  :import                      Import mapping information from an existing database.
doctrine:query
  :dql                         Executes arbitrary DQL directly from the command line.
  :sql                         Executes arbitrary SQL directly from the command line.
doctrine:schema
  :create                      Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output.
  :drop                        Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output.
  :update                      Processes the schema and either update the database schema of EntityManager Storage Connection or generate the SQL output.
init
  :bundle                      
router
  :debug                       Displays current routes for an application
  :dump-apache                 Dumps all routes as Apache rewrite rules

</pre>The post <a href="https://nerdpress.org/2010/12/01/symfony-2-from-scratch-bootstrappen/">Symfony 2 “from scratch” bootstrappen</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2010/12/01/symfony-2-from-scratch-bootstrappen/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>git prompt</title>
		<link>https://nerdpress.org/2010/11/13/git-repository-status-im-shell-prompt/</link>
					<comments>https://nerdpress.org/2010/11/13/git-repository-status-im-shell-prompt/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Sat, 13 Nov 2010 14:37:43 +0000</pubDate>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[vServer]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[tools]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1179</guid>

					<description><![CDATA[<p>gerade gefunden: git prompt &#8211; GIT repository status direkt im shell prompt. nützlich und schön bunt.</p>
The post <a href="https://nerdpress.org/2010/11/13/git-repository-status-im-shell-prompt/">git prompt</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>gerade gefunden:</p>
<p><a href="http://volnitsky.com/project/git-prompt/">git prompt</a> &#8211; GIT repository status direkt im shell prompt.</p>
<p>nützlich und schön bunt.</p>The post <a href="https://nerdpress.org/2010/11/13/git-repository-status-im-shell-prompt/">git prompt</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2010/11/13/git-repository-status-im-shell-prompt/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Ein symfony Projekt in git</title>
		<link>https://nerdpress.org/2010/05/08/ein-symfony-projekt-in-git/</link>
					<comments>https://nerdpress.org/2010/05/08/ein-symfony-projekt-in-git/#comments</comments>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Sat, 08 May 2010 13:05:59 +0000</pubDate>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Plugin]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=980</guid>

					<description><![CDATA[<p>Neulich habe ich mal ein Projekt von SVN auf git umgezogen. Ähnlich wie bei SVN muss auch hierbei das Projekt ein bißchen vorbereitet werden damit die Versionierung das macht was sie soll. Das Projekt wird in Eclipse bearbeitet, also wird auch hier drauf Rücksicht genommen. Alles was man beachten muss ist eigentlich nur die ignores &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2010/05/08/ein-symfony-projekt-in-git/" class="more-link">Continue reading<span class="screen-reader-text"> "Ein symfony Projekt in git"</span></a></p>
The post <a href="https://nerdpress.org/2010/05/08/ein-symfony-projekt-in-git/">Ein symfony Projekt in git</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Neulich habe ich mal ein Projekt von SVN auf git umgezogen.<br />
Ähnlich wie bei SVN muss auch hierbei das Projekt ein bißchen vorbereitet werden damit die Versionierung<br />
das macht was sie soll.<br />
Das Projekt wird in Eclipse bearbeitet, also wird auch hier drauf Rücksicht genommen.</p>
<p>Alles was man beachten muss ist eigentlich nur die ignores für git richtig zu setzen.<br />
Hier mal meine Ignore List:</p>
<p><span id="more-980"></span></p>
<p>In der root Ebene des Projekts ein <em>.gitignore</em> file anlegen mit diesem Inhalt: </p>
<pre class="brush: bash; title: ; notranslate">
cat .gitignore
*.log
*~
.project
.buildpath
.settings/*

#symfony
config/databases.yml
config/properties.ini
cache/*
log/*
data/*.db
</pre>
<p>Das sind so die Standards, also alle Log files, die Eclipse spezifischen Projekt Files und die Standard Editor backup-files (die mit der Tilde).<br />
Dazu noch ein die symfony Files und Directories, die man am besten nicht mit versionieren sollte.</p>
<p>Für Symfony selber benutze ich dann noch ein Plugin, welches sich um die autogenerated Files kümmert.<br />
<a href="http://www.symfony-project.org/plugins/sfSCMIgnoresTaskPlugin">sfSCMIgnoresTaskPlugin</a><br />
Diese sollte man auch nicht mit versionieren, warum steht <a href="http://shout.setfive.com/2009/03/22/git-ignores-and-symfony">hier</a>.<br />
Da nach jedem <em>autogenerate</em> sich die Verzeichnis Struktur ändert, führt man einfach das Plugin aus </p>
<pre class="brush: plain; title: ; notranslate">
symfony util:generate-ignores --add-ignores git
</pre>
<p>und schon sind all diese Files auch auf ignore:</p>
<p><em>model/om, model/map, form/base, filter/base<br />
doctrine/base, Plugin/base</em></p>
<p>Zusätzlich legt es auch noch ignores für die Standard ignore Kandidaten in symfony an.<br />
Redundant zu oben zwar, aber doppelt hält besser ;)</p>
<p>Zwei Sachen sind mir dabei aufgefallen die evtl verbesserungswürdig sind:<br />
1. das Plugin setzt auch die <em>ProjectConfiguration.class.php</em> auf ignore, was mir nicht ganz klar ist?<br />
2. berücksichtigt es keine sqlite *.db files im data dir. ich denke das wird in der nächsten Version mit drin sein.</p>The post <a href="https://nerdpress.org/2010/05/08/ein-symfony-projekt-in-git/">Ein symfony Projekt in git</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2010/05/08/ein-symfony-projekt-in-git/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
