Now that I have a plan it was now time to put things into action. The first thing I needed to do was to get Symfony2 Standard Edition into a git repository in such a way I could easily upgrade the core code to new releases. I started talking to Rob about the problem and he wasn’t aware of an easy way to accomplish this but he had a few ideas he shared with me.
I then headed into #symfony on irc.freenode.net and started asking developers if they knew of a way to accomplish my goal. Someone pointed me at the standard edition git repository and someone else mentioned git submodule. After a few hours of reading tutorials and scouring man pages I have come up with what I’d consider a simple solution to my objective of keeping my applications core code in sync with the Symfony 2 Standard Edition all the while maintaining my changes between releases.
First I started by cloning a copy of my github repository.
cd ~/Workspace
knix:Workspace alex$ git clone git@github.com:ajt2/ioubeer2.git ioubeer
Cloning into ioubeer…
warning: You appear to have cloned an empty repository.
Next I need to add a remote repository to pull in Symfony2 Standard Edition
knix:Workspace alex$ cd ioubeer
knix:ioubeer alex$ git remote add sf2-se git://github.com/symfony/symfony-standard
Now that I have the remote repository I need to pull in a release by tag
knix:ioubeer alex$ git pull sf2-se tags/v2.0.0PR12
remote: Counting objects: 632, done.
remote: Compressing objects: 100% (297/297), done.
remote: Total 632 (delta 361), reused 531 (delta 284)
Receiving objects: 100% (632/632), 105.72 KiB, done.
Resolving deltas: 100% (361/361), done.
From git://github.com/symfony/symfony-standard
* tag v2.0.0PR12 -> FETCH_HEAD
knix:ioubeer alex$ ls
LICENSE README.md VERSION app bin src web
You’ll notice that if you do a git status it’ll tell you nothings change.
knix:ioubeer alex$ git status
# On branch master
nothing to commit (working directory clean)
This is to be expected because I pulled my code from another repository and haven’t committed anything to our repository. However we need to push the history of the remote repository up to our repository.
knix:ioubeer alex$ git push origin master
Counting objects: 631, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (219/219), done.
Writing objects: 100% (631/631), 105.59 KiB, done.
Total 631 (delta 361), reused 631 (delta 361)
To https://github.com/ajt2/ioubeer2
* [new branch] master -> master
Once I’ve pulled in SF2 SE I need to modify the config removing the line below otherwise when I attempt to load the vendors submodules an unexpected exception will be thrown.
knix:ioubeer alex$ vi app/config/config.yml
delete the line “error_handler: null”
I had to then also move the secret option up into the framework group because an exception was being thrown and that’s what the all knowing google told me to do.
charset: UTF-8
secret: %csrf_secret%
csrf_protection:
enabled: true
Now that I have the standard edition of Symfony2 in my repository I need to pull in the vendor branches as submodules in the vendor/ directory
knix:ioubeer alex$ sh bin/vendors.sh
Xdebug requires Zend Engine API version 220060519.
The Zend Engine API version 220090626 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org for a later version of Xdebug.
> Installing/Updating assetic
Cloning into assetic…
remote: Counting objects: 3206, done.
remote: Compressing objects: 100% (1406/1406), done.
remote: Total 3206 (delta 1875), reused 2634 (delta 1430)
Receiving objects: 100% (3206/3206), 354.17 KiB, done.
Resolving deltas: 100% (1875/1875), done.
HEAD is now at db41b52 fixed lessphp test
… REMOVED A BUNCH OF LINES …
Cloning into WebConfiguratorBundle…
remote: Counting objects: 197, done.
remote: Compressing objects: 100% (193/193), done.
remote: Total 197 (delta 98), reused 0 (delta 0)
Receiving objects: 100% (197/197), 33.13 KiB, done.
Resolving deltas: 100% (98/98), done.
HEAD is now at 3c272a6 added missing files
Xdebug requires Zend Engine API version 220060519.
The Zend Engine API version 220090626 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org for a later version of Xdebug.
Xdebug requires Zend Engine API version 220060519.
The Zend Engine API version 220090626 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org for a later version of Xdebug.
Installing assets for Symfony\Bundle\FrameworkBundle into /Users/alex/Workspace/ioubeer/web//bundles/framework
Installing assets for Acme\DemoBundle into /Users/alex/Workspace/ioubeer/web//bundles/acmedemo
Installing assets for Symfony\Bundle\WebProfilerBundle into /Users/alex/Workspace/ioubeer/web//bundles/webprofiler
Installing assets for Symfony\Bundle\WebConfiguratorBundle into /Users/alex/Workspace/ioubeer/web//bundles/symfonywebconfigurator
The next thing that needed to be done was give apache permission to write Symfony2’s cache files to the app/ directory and log files to the logs/ directory.
knix:ioubeer alex$ chmod -R a+w app/cache/ app/logs/
I now can load Symfony2 up into my browser and and view the demo app successfully! Since I’ve modify app/config/config.yml I need to commit those changes and push them up to my repository.
knix:ioubeer alex$ git add app/config/config.yml
knix:ioubeer alex$ git commit -m ‘Removed error_handler option and moved secret option into framework group’
[master d1809af] Removed error_handler option and moved secret option into framework group
1 files changed, 1 insertions(+), 2 deletions(-)
Counting objects: 9, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 480 bytes, done.
Total 5 (delta 4), reused 0 (delta 0)
To https://github.com/ajt2/ioubeer
1f2be22..d1809af master -> master
The rebirth of IOUBeer.com with Symfony2 and Git Flow – Part 1
The rebirth of IOUBeer.com with Symfony2 and Git Flow – Part 3