ride/lib-vcs 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ride/lib-vcs

Composer 安装命令:

composer require ride/lib-vcs

包简介

Version control abstraction library of the Ride framework

README 文档

README

Simple version control abstraction library of the PHP Ride framework.

What's In This Library

Repository

The Repository interface represents a repository in any version control system. You can use it to get information about or to manipulate the repository.

Currently only git is implemented through the GitRepository class.

CommitLog

The CommitLog class is used as a data container of a single commit.

Code Sample

Check this code sample to see the possibilities of this library:

<?php

use ride\library\system\System;
use ride\library\vcs\git\GenericGitLogParser;
use ride\library\vcs\git\GitClient;
use ride\library\vcs\git\GitRepository;
use ride\library\vcs\Respository;

function createGitRepository(System $system) {
    $gitClient = new GitClient($system);
    $gitLogParser = new GenericGitLogParser();

    $gitRepository = new GitRepository($gitClient, $gitLogParser);
    $gitRepository->setUrl('git@github.com:all-ride/ride-lib-vcs.git');
    $gitRepository->setWorkingCopy($system->getFileSystem()->getFile('/path/to/local/copy'));
    
    // optionally, set a private key
    $gitRepository->setPrivateKey('/path/to/private.key');
    
    return $gitRepository;
}

function useRepository(Repository $repository) {
    if (!$repository->isCreated()) {
        // create the working copy the first time
        $repository->create();
        
        // perform the initial checkout to retrieve everything in the local copy
        $repository->checkout();
    }
    
    // perform an update or pull
    $repository->update();
    
    // deal with branches
    $currentBranch = $repository->getBranch();
    $availableBranches = $repository->getBranches();
    
    if (!$repository->hasBranch('my-branch')) {
        $repository->createBranch('my-branch');
    }
    
    // retrieve information about commits
    $currentRevision = $repository->getRevision();
    
    $commit = $repository->getCommit($currentRevision);
    if ($commit) {
        echo $commit->message;
        echo $commit->author;
    }
    
    $commits = $repository->getCommits();
    $commits = $repository->getCommits('src/ride/library/vcs/Repository.php');
    
    $sinceCommit = 'a1b2c3';
    $untilCommit = 'z9y8x7';
    $commits = $repository->getCommits('src/ride/library/vcs/Repository.php', 5, $sinceCommit, $untilCommit);
    
    // perform commits
    $repository->add('src/ride/library/vcs/git'); // a folder
    $repository->add('src/ride/library/vcs/git/git-ssh.sh'); // a directory
    
    $repository->remove('.gitignore');
    
    $repository->commit('added git implementation');
}

Implementations

For more examples, you can check the following implementations of this library:

Installation

You can use Composer to install this library.

composer require ride/lib-vcs

统计信息

  • 总下载量: 3.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 8
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固