0

I started ZendSkeletonApplication via Composer. I will need for my project PRIVATE repository (Git). How to do it? Skeleton have now .git files so how I can work with my project for example on BitBucket?

Regards

JokerDark2
  • 97
  • 2
  • 7

3 Answers3

1

The best way to create a ZF2 skeleton project from scratch is to use ZFTool (http://framework.zend.com/manual/2.1/en/modules/zendtool.introduction.html). Install it to /usr/local/bin (with executable permissions) and then you can do this:

$ zftool.phar create project project_name

This will give you a skeleton application in the project_name folder which is completely git free.

Now create a private repository on BitBucket and follow the instructions for setting up with code already on your disk.

Note that the project created in project_name has a .gitmodules file. If you're using Composer, you can just delete this file before you add to BitBucket. If you want to use submodules, then its set up with ZF2 as a submodule ready for you to init and update.

Rob Allen
  • 12,643
  • 1
  • 40
  • 49
  • Thanks for answer. It's best way I think but I probably have no choice and must composer to install other components like doctrine etc;/ But what happends if I delete this modules file? Everythink from vendor will be scanned by git and I have to commit it to bucket? Secound thing I don't like this mess whats doing Composer (clean project via Composer 150mb). – JokerDark2 Feb 28 '13 at 11:07
  • The skeleton app provides two ways to handle dependencies: Git sub modules via the .gitmodules file (http://git-scm.com/book/en/Git-Tools-Submodules) and Composer via the composer.json file (http://www.getcomposer.org). You probably only want to use one or the other in any given project. – Rob Allen Feb 28 '13 at 11:32
0

By utilizing the submodule feature of git, you may have your own project on bitbucket and have the zend library, etc. as a submodule in the seperate lib/-directory, like so:

YourProject/   <-- Your git working tree (via git init)
  public/
  libs/
    Zend/      <-- a git submodule
  application/

The command to add a submodule is git submodule add http://zf-repo libs/Zend. You can then seperately update and track the zend framework, because your main git working tree will also reference a specific version of the Zend Framework Library.

Lars
  • 5,757
  • 4
  • 25
  • 55
  • I have now .git folder in MyProject dir so I have to delete .git folder manually and git init new repository? My main git repo what I want place on BB should ignore vendor/ZF2 folder where is now ZF2 library as git submodule but shoulnt ignore vendor/MyZendExtension lib folder. – JokerDark2 Feb 27 '13 at 19:04
0

Once you forked the ZendSkeletonApplication, you can push the fork to a private repository in your Bitbucket account or on your own servers/network.

You can deploy your own packages/modules on Bitbucket and even require them via composer if you want, but as @Lars stated, it's possible to simply use a git submodule if that's easier for you.

There's also a great presentation by Niels Aderman about advanced composer usage if you're not familiar with the tool.

Ocramius
  • 25,171
  • 7
  • 103
  • 107
  • I have now clean local copy of ZendSkeletonApplication installed via Composer and I don't know what to do now.. I have to delete this .git folder what exists now from cloning? – JokerDark2 Feb 27 '13 at 19:11
  • @JokerDark2 no, that's the git repo metadata. If you are not familiar with git and prefer to use SVN or another version control system, you can delete it: I personally don't suggest it. – Ocramius Feb 27 '13 at 19:12
  • I just want git on bitbucket. I want have possibility to add later doctrine or other components not only ZF2(without composer). My main repo should allow me to work localy with eveythink what I develop or add to my application or vendor. I installed now ZF2 skeleton without Composer (via Git submodules). So now I need only to import files from my computer to BitBucket account and it will work fine? – JokerDark2 Feb 27 '13 at 19:44
  • I'm trying now to import my copy like BitBucket expects it but after: git remote add origin ... I'm getting fatal error: remote origin already exists.. – JokerDark2 Feb 27 '13 at 19:49
  • Adding doctrine to a zf2 project without composer is problematic: see my answer at http://stackoverflow.com/questions/14979381/zf2-doctrine-without-composer . Bitbucket makes no difference if you use composer or submodules. – Ocramius Feb 27 '13 at 19:51
  • 1
    `git remote add bitbucket && git push -u bitbucket --all` will do – Ocramius Feb 27 '13 at 19:51
  • Thanks a lot for your help! Now its working fine on bitbucket ;) later I try to add somethink via Composer. – JokerDark2 Feb 27 '13 at 20:41