Beispiel #1
0
        }
        .prompt {
            color: #6be234;
        }
        .command {
            color: #729fcf;
        }
        .output {
            color: #999;
        }
    </style>
</head>
<body>
<pre>
<?php 
$deploy = new GitDeploy($HTTP_RAW_POST_DATA);
?>
Running as <b><?php 
echo trim(shell_exec('whoami'));
?>
</b>.
Checking the environment ...
<?php 
$deploy->CheckEnvironment();
?>
Environment OK.
Start deploy.
<?php 
$deploy->RunCommands($deploy->GitPull());
$deploy->SetConfigFromJson();
$deploy->RunCommands($deploy->AfterGitPull());
Beispiel #2
0
    public function git_exec($c)
    {
        echo "<pre>" . shell_exec("cd {$this->c['local']} && git {$c} 2>&1") . "\n</pre>";
    }
    public function send()
    {
        if (file_exists($this->c['local'])) {
            $this->git_exec(" config user.name '" . USERNAME . "' ");
            $this->git_exec(" config user.email '" . USEREMAIL . "' ");
            $this->git_exec(" add . ");
            $this->git_exec(" commit -am '{$this->commit_message}' ");
            $this->git_exec(" push origin " . REPOBRANCH);
            echo "\nUpdate!";
        } else {
            $this->git_exec(" clone {$this->c['remote']} --branch " . REPOBRANCH);
            echo "\nCloned!";
        }
    }
    public function write_files()
    {
        $m = fopen($this->c['local'] . DIRECTORY_SEPARATOR . $this->data['filename'], "w") or die("Unable to open file!");
        fwrite($m, $this->data['html']);
        fclose($m);
    }
}
$x = new GitDeploy();
$x->commit_message = " This is a commit " . microtime(true);
$x->data["filename"] = "index123.html";
$x->data["html"] = "<html><head><title>Hello World!</title>\n</head>\n<body>Hello World</body>\n</html>\n<!--generated with GitDeploy by vinigomescunha -->";
$x->write_files();
$x->send();