Netbeans project with git and Composer repository

9

I'm developing a PHP project that requires two separate libraries. I am required to use NETBEANS.

To develop the three separately but at the same time and because the main project "MAIN PROJECT" needs the other two, I have idealized:

  • All projects with composer ... as usual

  • All projects with git repositories ... as usual

  • When making changes to the two complementary projects I plan to update the MAIN project with the composer soon after each clear commit.

  • To do this I thought it would be simple to put in the MAIN PROJECT as follows:

    "repositories": [ 
    {   
       "packagist": false 
    }, {    
     "type": "vcs",
     "url": "/localhost/htdocs/projecto1/" 
    },{    
      "type": "vcs",
      "url": "/localhost/htdocs/projecto2/" 
    }],
    

    However, because it is local, I can not update directly from the git repository of each sub project created by NETBEANS. I wanted to avoid putting the projects online until they are more evolved. I have at the root of each project its composer.json file and of course the .git directory of the repository.

    After shaking my head, I decided to ask if anyone has ever had an equal situation and to enlighten me on this subject ... sff. I have a lot of experience with composer but I'm not even aware why it does not work.

    UPDATE: I get as artifact putting the repositories in zip's but it is far from what I intended. It forces me to zip , with the file composer.json in the root of the zip package ... example:

     (...)
     "repositories": [
            {
                "packagist": false
            }, {
                "type": "artifact",
                "url": "/artifacts/"
            }],
     (...)
    

    This excerpt is placed in composer.json of projecto MAIN . I turn around but I can not seem to find how interesting and productive I am from each repository GIT local for each project the main project depends on.

    Has anyone gone through this yet?

        
    asked by anonymous 06.03.2015 / 16:55

    1 answer

    4

    I have been walking and as I mentioned in the question to develop three projects, where one that I named the MAIN project depends on two other which are bases / components. As development is simultaneous updating the code in the main project about changes in the two complementary projects is important, so I was looking for a practical solution within the editor that I was imposed for the project ie NETBEANS .

    As I use Composer for package management and Git as a repository there would have to be a way to commit to each of the base projects and Composer in the MAIN project to reference their "local" repository and in order to update with the changes made.

    My first solution was with the ZIP packages approach as presented in the question but in fact it forces you to zip and place the zip in a folder of local repositories. But if it performed commits it had to be possible to update the MAIN project from the respective repositories.

    In%% of base projects I keep the settings, but in the MAIN project the novelty happens by changing:

    (...)
     "repositories": [
            {
                "packagist": false
            }, {
                "type": "artifact",
                "url": "/artifacts/"
            }],
    (...)
    

    by:

    (...)
    "repositories": [
            {
                "packagist": false
            }{
                "type": "package",
                "package": {
                    "name": "projecto1",
                    "version": "dev-master",
                    "source": {
                        "url": "/localhost/htdocs/projecto1",
                        "type": "git",
                        "reference": "origin/master"
                    }
                }
            },{
                "type": "package",
                "package": {
                    "name": "projecto2",
                    "version": "dev-master",
                    "source": {
                        "url": "/localhost/htdocs/projecto2",
                        "type": "git",
                        "reference": "origin/master"
                    }
                }
            }],
    (...)
    

    In this way it is possible to perform the commits in the two projects and in the MAIN project with only one Composer UPDATE I update my code for the latest versions in development. Being a "NETBEANS" editor are just simple clicks, et voilá . Note that to achieve this solution is necessary to have git installed to support the command line that NETBEANS performs!

        
    27.04.2015 / 12:50