pocketarc / git-deploy-php

git-deploy-php is a simple php-based tool that deploys your Git repositories to FTP/SFTP servers, and keeps them updated automatically.
http://brunodebarros.github.io/git-deploy-php
292 stars 45 forks source link

Composer Install ERROR #80

Closed djmassive closed 7 years ago

djmassive commented 7 years ago

Archiwum.zip

After I redownloaded using composer whole folder, and then I'm trying to make composer update I see error message:

Writing lock file Generating autoload files

php tools/build.php Could not open input file: tools/build.php Script php tools/build.php handling the post-autoload-dump event returned with error code 1

File tools/build.php exists. Before I've try to update my old one, but after regenerate git-deploy there was an errors:

PHP Warning: require(phar:///Users/avatec/Sites/development/git-deploy-kopia/git-deploy/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: phar error: "vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php" is not a file in phar "/Users/avatec/Sites/development/git-deploy-kopia/git-deploy" in phar:///Users/avatec/Sites/development/git-deploy-kopia/git-deploy/vendor/composer/autoload_real.php on line 66 PHP Fatal error: require(): Failed opening required 'phar:///Users/avatec/Sites/development/git-deploy-kopia/git-deploy/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='.:') in phar:///Users/avatec/Sites/development/git-deploy-kopia/git-deploy/vendor/composer/autoload_real.php on line 66

BUT - that files exists in those path

pocketarc commented 7 years ago

That's odd; when you say "redownloaded using composer whole folder", what do you mean?

I ran the following code:

git clone git@github.com:BrunoDeBarros/git-deploy-php.git
cd git-deploy-php
composer update

And got the following output:

Generating autoload files
> php tools/build.php
Built git-deploy successfully!

What are you doing differently, if anything?

pocketarc commented 7 years ago

P.S. Note that if you're just trying to use git-deploy-php, you literally just need the git-deploy file and the deploy.ini. Don't download everything! You don't need everything; the tools and everything else are for our development, not for normal use.

pocketarc commented 7 years ago

And if you're trying to use it as a composer package, here's what I got when I tried doing that:

composer require brunodebarros/git-deploy-php
Using version ^2.0 for brunodebarros/git-deploy-php
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing brunodebarros/git-deploy-php (2.0.1): Downloading (100%)         
Writing lock file
Generating autoload files
apro@Coldreign:~/temp$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
djmassive commented 7 years ago

I need, because I added some code to generate version numer file and changelog xml. In this version I need to build whole git-deploy from source because it is phar file.

On 23.10.2017, 13:58 +0200, Bruno De Barros notifications@github.com, wrote:

P.S. Note that if you're just trying to use git-deploy-php, you literally just need the git-deploy file and the deploy.ini. Don't download everything! You don't need everything; the tools and everything else are for our development, not for normal use. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

pocketarc commented 7 years ago

Ah, that's fine! Thanks for the clarification; the build should work without any problems. Do you have a fork of this repo that I can inspect to see if there's anything I can help with?

djmassive commented 7 years ago

No this is locally only for now. This is code I've trying to add to tools/index.php to be included every git-deploy runs:

after: $git = new \Brunodebarros\Gitdeploy\Git($args['repo_path']); (line 46)

` exec("git log --pretty=format:'%h' -n 1", $githash); exec("git log -1 --pretty=%B", $a); exec("git rev-list --all --count" , $build); exec("git describe" , $version); foreach($a as $i) { if(!empty($i)) { if($i !== 'no message') { $gitlog[] = $i; } } } $build = $build[0];

 $version = $version[0];
 $version = preg_replace("/\-([0-9]+)\-([a-z0-9]+)/" , ".$1", $version);

if(file_get_contents(__DIR__ . "/version.ini") !== $version) {
    file_put_contents(__DIR__ . "/version.ini", $version);

    if(file_exists( __DIR__ . "/changelog.xml" )) {
        $content = file_get_contents("changelog.xml") . PHP_EOL;
        $xml = simplexml_load_string($content);
        $cl_count = count($xml->changelog) - 1;

        $changelog_data = $xml->changelog[$cl_count]['date'];
        $changelog_czas = $xml->changelog[$cl_count]['time'];
        $changelog_wersja = $xml->changelog[$cl_count]['version'];
        $changelog_opis = $xml->changelog[$cl_count]->description;

        if( date('Y-m-d') == $changelog_data && !empty($gitlog) ) {

            $changelog_opis = $changelog_opis . PHP_EOL . "- " . implode(PHP_EOL . "- " , $gitlog);

            $xml->changelog[$cl_count]['build'] = $build;
            $xml->changelog[$cl_count]['commit'] = $githash[0];
            $xml->changelog[$cl_count]['time'] = date('H:i:s');
            $xml->changelog[$cl_count]['version'] = $version;
            $xml->changelog[$cl_count]->description = $changelog_opis;

            file_put_contents(__DIR__ . "/changelog.xml", $xml->saveXML());
        } else {

            if(!empty($gitlog)) {
                $xml = file_get_contents(__DIR__ . "/changelog.xml");
                $xml = simplexml_load_string( $xml );

                $cl = $xml->addChild("changelog");
                $cl->addAttribute("build", $build);
                $cl->addAttribute("commit", $githash[0]);
                $cl->addAttribute("date", date('Y-m-d'));
                $cl->addAttribute("time", date('H:i:s'));
                $cl->addAttribute("version", $version);
                $cl->addChild("description", "- " . implode(PHP_EOL . "- " , $gitlog));

                file_put_contents(__DIR__ . "/changelog.xml", $xml->saveXML());
            }
        }
    }
}

`

After I do composer require && composer update I have only vendor folder with git-deploy phar, so I download all the source and trying to regenerate with my changes.

pocketarc commented 7 years ago

The best thing to do here is, create a fork in GitHub, clone it, do composer update and check that it all works. After that, add your code, try to run it again, and see what happens.

djmassive commented 7 years ago

Ok thank u a lot I will try this way :-)

djmassive commented 7 years ago

Same errors - my fork: https://github.com/djmassive/git-deploy-php

PHP Warning:  require(phar:///Users/avatec/Sites/development/git-deploy/git-deploy-php/git-deploy/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: phar error: "vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php" is not a file in phar "/Users/avatec/Sites/development/git-deploy/git-deploy-php/git-deploy" in phar:///Users/avatec/Sites/development/git-deploy/git-deploy-php/git-deploy/vendor/composer/autoload_real.php on line 66 PHP Fatal error:  require(): Failed opening required 'phar:///Users/avatec/Sites/development/git-deploy/git-deploy-php/git-deploy/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='.:') in phar:///Users/avatec/Sites/development/git-deploy/git-deploy-php/git-deploy/vendor/composer/autoload_real.php on line 66

On 23.10.2017, 14:09 +0200, Bruno De Barros notifications@github.com, wrote:

The best thing to do here is, create a fork in GitHub, clone it, do composer update and check that it all works. After that, add your code, try to run it again, and see what happens. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

pocketarc commented 7 years ago

Are you doing composer update without --no-dev? With --no-dev you won't have all the necessary libraries. I've just cloned your repo and:

$ git clone git@github.com:djmassive/git-deploy-php.git
$ cd git-deploy-php
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 29 installs, 0 updates, 0 removals
[...]
Writing lock file
Generating autoload files
> php tools/build.php
Built git-deploy successfully!
djmassive commented 7 years ago

I dont use any additional flags - I just type composer update. But those PHP Warnings was after I run git-deploy from PHP.

Building is ok, but git-deploy don’t work (missing libraries that exists in vendor folder).

On 23.10.2017, 14:21 +0200, Bruno De Barros notifications@github.com, wrote:

Are you doing composer update without --no-dev? With --no-dev you won't have all the necessary libraries. I've just cloned your repo and: $ git clone git@github.com:djmassive/git-deploy-php.git $ cd git-deploy-php $ composer update Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 29 installs, 0 updates, 0 removals [...] Writing lock file Generating autoload files

php tools/build.php Built git-deploy successfully! — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

djmassive commented 7 years ago

No dev flag helps. Thank u a lot !

This thread can be closed. Thank You again !

On 23.10.2017, 14:22 +0200, Massive djmassive@o2.pl, wrote:

I dont use any additional flags - I just type composer update. But those PHP Warnings was after I run git-deploy from PHP.

Building is ok, but git-deploy don’t work (missing libraries that exists in vendor folder).

On 23.10.2017, 14:21 +0200, Bruno De Barros notifications@github.com, wrote:

Are you doing composer update without --no-dev? With --no-dev you won't have all the necessary libraries. I've just cloned your repo and: $ git clone git@github.com:djmassive/git-deploy-php.git $ cd git-deploy-php $ composer update Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 29 installs, 0 updates, 0 removals [...] Writing lock file Generating autoload files

php tools/build.php Built git-deploy successfully! — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

pocketarc commented 7 years ago

I've just resolved the issue you were having regardless of the update-dev flag. Feel free to pull my changes and retry (if you pull my changes, don't use --no-dev because it will not work at all).