Welcome Guest, Not a member yet? Register   Sign In
Git, CodeIgniter as a Project's Dependency, Submodules & Subtrees
#1

[eluser]Walter Coots[/eluser]
The first post I had about this was about a year ago. Soon after, I got engaged, planned a wedding, got married, turned 30, hosted family for the holidays, switched jobs, bought property that extended our backyard, honeymooned, and moved my wife and her cat in. So it's been a busy half year! In my new job we use Git every day, so I've gotten much more comfortable with it, and I'm better able to articulate what I'm wanting to do.

~

The long and short: I built a CMS that uses CodeIgniter. It also uses a variety of other things such as jQuery, jCrop, Modernizr, jQuery Address, etc. Naturally, I'll need to keep these up-to-date. The other challenge is that since this is a CMS, there will be multiple instances of it on my machine - one for each site that uses it.

What I'd like to do is set up a master version of the CMS using submodules or subtrees (I'm open to the execution) which would allow me to keep dependencies up-to-date by pulling from their remote Git repositories. In addition to that, I'd like to track all these changes in a master repository, and have the CMS act as a dependency for each of the project's that uses it. (This way I can have the option to have a separate repository for each project which utilizes the CMS.)

The question is: how do I do this?

I haven't really developed on someone else's repo yet, so I'm not sure how well Git does with tracking changes to files that have been moved - especially if they've been moved outside of the folder which contains the .git folder. Also, some of the public and CMS assets reside in the same directories - for example, each CI application's php file:

/assets/
/public/
/public.php
/admin/
/admin.php
/system/

Has anyone tried anything like this before? Are there best practices? Is it a ridiculous idea?
#2

[eluser]Thorpe Obazee[/eluser]
I have done something like this but I built it with frameworks that have built-in support for modules(Yii) or plugins(CakePHP). I am pretty sure you can do this with CodeIgniter.

With modules, etc. I like the idea of making things almost plug and play. Anyway, I haven't been really active here for the past 2 years but I think wiredesignz's ME still works, no?
#3

[eluser]XMadMax[/eluser]
Hey Walter,

Yep, it's possible to have:

/public/application
/public/application/config
/public/application/core
.
.
/public/www/index.php
/public/www/assets

and same on admin...

/admin/application
/admin/application/config
/admin/application/core
.
.
/admin/www/index.php
/admin/www/assets


Each of those, must to have a unique url, subdomain or subfolder:

admin.myhost.com and www.myhost.com

or

www.myhost.com/admin and www.myhost.com (you must to have an .htaccess in admin folder that makes RewriteBase to /admin)

Also, if you want to use the same code between both apps, try XHMVC:

Demo: http://xhmvc.4amics.com/applications/demo/www

Repository: https://bitbucket.org/xperez/codeigniter...ions-xhmvc


#4

[eluser]Pert[/eluser]
Files outside .git root folder are not tracked, moved files are tracked as old location is considered completely deleted and new location is considered complete new file with full content - so there's no "move" as such if you move files in your OS. There might be ways to move files around inside GIT repo so it would also keep the history of file changes in previous locations.

I am using one repo to build my code, then repo for each separate project, and I have set up my files in a way that I only have to copy over one or two folders within /application/ that hold only CMS code and nothing project specific. Then you can treat your CMS like jQuery for example, just replace old files with new code and job done.

Congrats on the wedding and birthday Wink




Theme © iAndrew 2016 - Forum software by © MyBB