librelist archives

« back to archive

Photon particules ?

Photon particules ?

William Martin
2013-01-02 @ 12:19
Happy new year !

I start to work with photon on multiple projects and i can reuse some code
from one to another.
I call this source folder "libs" and i put into it all code not specific to
a project (XML, session, template tools ..). This folder grow, it's not a
issue yet.

I have found a simple way to store all my shard code (ie. particules) into
a projet and load on demand only piece of code that i need in the project.
It's based on git.

First, I have a branch per feature.
You need to create a orphan branch per feature, so the history of each
branch is empty. It's just a way to store multiple working directory in the
same git repo.

$ git branch -a
* template/tag-apikey

Second, Create your new project with "hnu init".
In this project you can clone the particules repository with a no check-out
option. It's like clone the repo as bare but with the no-bare structure.
Then, create your master branch, it's will be your main working branch.

$ git clone http://my-particules-repo libs --no-checkout
$ git checkout --orphan master

Third, check-out only the feature you need. Git will merge perfectly
feature with the same folder/file tree.

$ git merge session/mongodb-backend
$ git merge utils/mongodb-counters

Trick 1, when you release your project, create a commit to store the status
of all your merge.
If you update a particule feature, just merge again into master and commit.

Trick 2, you can have private particule, you just need to add other remote
in the git repo.

Base on this draft, i propose you to create two git repository for photon.
- photon-core : the actual project
- photon-libs : the shared particule project

Any comments will be appreciated.