dongshi7433
2010-09-20 00:39
浏览 49
已采纳

我应该如何组织基于框架的项目的源代码管理?

I'm struggling trying to sort out what the best-practice is for putting a project under source control when the project is written against a framework. In my situation I will be using Mercurial for source control.

Most PHP frameworks have an 'application' folder where I'm supposed to put my code that interacts with the framework. So is it best to put the application folder into it's own repository and then have another repository for the framework files? Or is it better to put everything, including the framework, into a single repository?

I'd like to be able to have a decent amount of flexibility, namely I'd like to be able to swap out the version of the framework I'm using for experimentation while still being able to publish changes using the stable version.

I have experience with both the Kohana and Zend Framework frameworks so if you could use those as references that would be fantastic.

图片转代码服务由CSDN问答提供 功能建议

我正在努力解决在项目中将项目置于源代码管理之下的最佳实践 是针对框架编写的。 在我的情况下,我将使用Mercurial进行源代码控制。

大多数PHP框架都有一个“应用程序”文件夹,我应该把我的代码放在与框架交互的地方。 那么最好将应用程序文件夹放入它自己的存储库中,然后为框架文件建立另一个存储库吗? 或者将包括框架在内的所有内容放到单个存储库中会更好吗?

我希望能够拥有相当大的灵活性,即我希望能够 能够替换我用于实验的框架版本,同时仍然能够使用稳定版本发布更改。

我有Kohana和Zend Framework框架的经验所以 如果你可以使用那些作为很棒的参考。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • doulingzhuang3079 2010-09-20 00:55
    已采纳

    Well i dont use Mecrucial but perhaps my typical set up with Subversion will apply after you translate it :) I dont use a local centralized installation. I fnd that more often than not ill be using a specific version for each application i work on given the fast releas cycles of frameworks. So i always embed them within a project.

    For Zend:

    svn/path/
      trunk/
        application/
        library/
          Zend/  
          MyNamespace/
        public/
        data/
    

    I use an svn:external to the version of the framework i want.... for example: http://framework.zend.com/svn/framework/standard/tags/release-1.10.5/library/Zend

    For Symfony its much the same using externals for both symfony and any plugins. the difference is libraries like symfony and Zend i would put in a vendor directory instead of directly in lib:

    svn/path/
      trunk/
        apps
        lib/
          vendor/
            Zend/  
            symfony/
        plugins/
        web/
        config/
        data/
        cache/
        log/
    
    已采纳该答案
    打赏 评论
  • dozxos6346 2010-09-20 00:50

    Assuming SVN there is this nifty feature called svn:ignore where you can mark files/folders or sets of files/folders as `ignored'.

    This allows you to mix the files that should be versioned with the files that shouldn't; so it is really useful for libraries (and hence frameworks): only version your own source code and mark the rest (generated files, libraries) as ignored.

    Possibly add a readme which documents what libs should be installed and how for use when others use your code, or when you want to setup a copy working environment on another machine.

    Note that pretty much any other version control systems tends to have an `ignore' feature, it's not specific to SVN.

    打赏 评论
  • dongmuyuan3046 2010-09-20 00:59

    Very similar to svn, hg uses <root>/.hgignore to ignore files/directories (remember to add .hgignore itself as an entry).

    I have no experience with either framework, but I can't think of a scenario where you want to track the framework and your application code together, since they definitely will progress at different pace. The framework code should have its own version control anyway.

    打赏 评论
  • douwen7905 2010-09-20 04:09

    On my Kohana projects using git, I set up the entire project as a repository. This includes the application folder as well as modules and system. The system folder is a submodule pointing back to Kohana's latest stable. The modules can be normal files in the repo or they can be submodules as well. I also have a folder for the public_html files.

    You can see how one company has it set up here: http://github.com/synapsestudios/kohana-projecttemplate

    For development, you can make a new branch of your project and check out whichever version of system or module files you need to test with.

    打赏 评论

相关推荐 更多相似问题