├── screenshot.png ├── .gitignore ├── easy-git-deploy ├── info.php ├── pull.php ├── push.php ├── inc │ ├── config.sample.php │ ├── VcsInterface.php │ ├── Info.php │ ├── style.css │ ├── Push.php │ ├── Pull.php │ └── VcsAbstract.php ├── bootstrap.php └── index.html ├── LICENSE └── README.md /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohannesHoppe/easy-git-deploy/HEAD/screenshot.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | easy-git-deploy/inc/config.php 2 | easy-git-deploy/inc/config.backup* 3 | .idea 4 | deployments.log 5 | */.htaccess 6 | -------------------------------------------------------------------------------- /easy-git-deploy/info.php: -------------------------------------------------------------------------------- 1 | execute(); 7 | echo $info->_log_messages; -------------------------------------------------------------------------------- /easy-git-deploy/pull.php: -------------------------------------------------------------------------------- 1 | execute(); 7 | echo $pull->_log_messages; -------------------------------------------------------------------------------- /easy-git-deploy/push.php: -------------------------------------------------------------------------------- 1 | execute(); 7 | echo $push->_log_messages; -------------------------------------------------------------------------------- /easy-git-deploy/inc/config.sample.php: -------------------------------------------------------------------------------- 1 | '../my_repo', 8 | 9 | // Used for first clone 10 | 'url' => 'https://USER:PASS@bitbucket.org/account/repo.git' 11 | 12 | // Further options: 'log', 'date_format', 'branch', 'remote' 13 | ); -------------------------------------------------------------------------------- /easy-git-deploy/bootstrap.php: -------------------------------------------------------------------------------- 1 | has_base_directory()) { 10 | $message = "Directory '{$this->_directory}' not found."; 11 | throw new Exception($message); 12 | } 13 | 14 | // Make sure we're in the right directory 15 | chdir($this->_directory); 16 | 17 | $this->exec_and_log( 18 | 'Git status:', 19 | 'git status'); 20 | 21 | $this->exec_and_log( 22 | 'Current revision:', 23 | 'git log -1'); 24 | 25 | $this->exec_and_log( 26 | 'All files that are changed locally:', 27 | 'git diff --name-only'); 28 | 29 | /* 30 | $this->exec_and_log( 31 | 'Commits you have in HEAD that are not in '.$this->_remote.'/'.$this->_branch, 32 | 'git log '.$this->_remote.'/'.$this->_branch.'..'); 33 | */ 34 | } 35 | catch (Exception $e) { 36 | $this->log($e, 'ERROR'); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /easy-git-deploy/inc/style.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | } 4 | 5 | .container { 6 | width: 700px; 7 | position: fixed; 8 | top: 50%; 9 | left: 50%; 10 | 11 | margin-top: -300px; 12 | margin-left: -350px; 13 | 14 | opacity: 0.8; 15 | } 16 | 17 | h1 { 18 | font-size: 50px; 19 | font-weight: 800; 20 | } 21 | 22 | h1 i { 23 | font-size: 100px; 24 | } 25 | 26 | .lead { 27 | font-size: 18px; 28 | margin-bottom: 30px; 29 | } 30 | 31 | .jumbotron { 32 | text-align: center; 33 | border-bottom: 1px solid #e5e5e5; 34 | 35 | background: #eeeeee; /* Old browsers */ 36 | background: -moz-linear-gradient(top, #eeeeee 0%, #cecece 100%); /* FF3.6+ */ 37 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cecece)); /* Chrome,Safari4+ */ 38 | background: -webkit-linear-gradient(top, #eeeeee 0%,#cecece 100%); /* Chrome10+,Safari5.1+ */ 39 | background: -o-linear-gradient(top, #eeeeee 0%,#cecece 100%); /* Opera 11.10+ */ 40 | background: -ms-linear-gradient(top, #eeeeee 0%,#cecece 100%); /* IE10+ */ 41 | background: linear-gradient(to bottom, #eeeeee 0%,#cecece 100%); /* W3C */ 42 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cecece',GradientType=0 ); /* IE6-9 */ 43 | } 44 | 45 | .jumbotron .btn { 46 | font-size: 21px; 47 | padding: 14px 24px; 48 | margin: 10px; 49 | } 50 | 51 | .jumbotron .btn small { 52 | display:block; 53 | font-size: 12px; 54 | } 55 | 56 | iframe { 57 | width: 100%; 58 | height: 99%; 59 | } -------------------------------------------------------------------------------- /easy-git-deploy/inc/Push.php: -------------------------------------------------------------------------------- 1 | has_base_directory()) { 10 | $message = "Commit directory '{$this->_directory}' not found."; 11 | throw new Exception($message); 12 | } 13 | 14 | // Make sure we're in the right directory 15 | chdir($this->_directory); 16 | 17 | // Add files to repository. 18 | $this->exec_and_log('Adding untracked files.', 'git add -A .'); 19 | 20 | // Move changes to stash. 21 | $this->exec_and_log('Stashing changes.', 'git stash'); 22 | 23 | // Create a new branch. 24 | $branchName = 'productive_system_' . date('Y-m-d_H-i-s'); 25 | $this->exec_and_log( 26 | "Creating new branch '{$branchName}'.", 27 | "git checkout -b {$branchName}" 28 | ); 29 | 30 | // Unstash changes in new branch. 31 | $this->exec_and_log('Unstashing changes.', 'git stash pop'); 32 | 33 | // Create commit. 34 | $commitMessage = 'HTTP triggered server commit; ' . date('Y-m-d H:i:s'); 35 | $this->exec_and_log('Creating commit.', "git commit -am '{$commitMessage}'"); 36 | 37 | // Push changes to remote repository. 38 | $this->exec_and_log('Pushing in changes.', 'git push ' . $this->_remote . ' ' . $branchName); 39 | 40 | $this->log('PUSH successful.'); 41 | } 42 | catch (Exception $e) { 43 | $this->log($e, 'ERROR'); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /easy-git-deploy/inc/Pull.php: -------------------------------------------------------------------------------- 1 | has_base_directory()) { 10 | mkdir($this->_directory, 0777, true); 11 | } 12 | 13 | // Make sure we're in the right directory 14 | chdir($this->_directory); 15 | 16 | // only first run 17 | if (!is_dir('./.git')) { 18 | // The "." at the end specifies the current folder as the checkout folder! 19 | $this->exec_and_log('Cloning repo for the first time.', "git clone '" . $this->_url . "' ."); 20 | } 21 | 22 | // normal run 23 | else { 24 | 25 | // 1. Move to master branch. 26 | $this->exec_and_log('Switching to master branch.', 'git checkout ' . $this->_branch); 27 | 28 | // 2. Update the local repository 29 | $this->exec_and_log('Pulling in changes.', 'git pull'); 30 | 31 | // hidden feature: checkout special revision 32 | 33 | if (isset($_GET['hash']) && $this->is_sha1($_GET['hash'])) { 34 | $hash = $_GET['hash']; 35 | $this->exec_and_log('Checkout previous revision '. $hash.':', 'git checkout '. $hash); 36 | } 37 | } 38 | 39 | // Secure the .git directory 40 | $this->exec_and_log('Securing .git directory.', 'chmod -R og-rx .git'); 41 | 42 | $this->log('PULL successful.'); 43 | } 44 | catch (Exception $e) { 45 | $this->log($e, 'ERROR'); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /easy-git-deploy/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 |28 | Tired of complex shell scripts for managing GIT on your web server? 29 | This tool has exactly one button for each direction. That's all! 30 |
31 | 32 | 33 | 34 | PUSH 35 | to remote 36 | 37 | 38 | 39 | 40 | PULL 41 | from remote 42 | 43 |