2017 © Pedro Peláez
 

library lib-vcs

Version control abstraction library of the Ride framework

image

ride/lib-vcs

Version control abstraction library of the Ride framework

  • Friday, October 7, 2016
  • by ride-user
  • Repository
  • 8 Watchers
  • 0 Stars
  • 2,124 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 2 % Grown

The README.md

Ride: Verson Control System Library

Simple version control abstraction library of the PHP Ride framework., (*1)

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., (*2)

Currently only git is implemented through the GitRepository class., (*3)

CommitLog

The CommitLog class is used as a data container of a single commit., (*4)

Code Sample

Check this code sample to see the possibilities of this library:, (*5)

<?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: - ride/app-vcs - ride/web-cms-vcs, (*6)

Installation

You can use Composer to install this library., (*7)

composer require ride/lib-vcs

The Versions

07/10 2016

dev-master

9999999-dev

Version control abstraction library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

07/10 2016

dev-develop

dev-develop

Version control abstraction library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

07/10 2016

1.0.0

1.0.0.0

Version control abstraction library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

12/05 2014

0.2.8

0.2.8.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

24/04 2014

0.2.7

0.2.7.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

24/04 2014

0.2.6

0.2.6.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

24/04 2014

0.2.5

0.2.5.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

17/04 2014

0.2.4

0.2.4.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

17/04 2014

0.2.3

0.2.3.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

16/04 2014

0.2.2

0.2.2.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

25/03 2014

0.2.1

0.2.1.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

25/03 2014

0.2.0

0.2.0.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

21/03 2014

0.1.4

0.1.4.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

21/03 2014

0.1.3

0.1.3.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

21/03 2014

0.1.2

0.1.2.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

20/03 2014

0.1.1

0.1.1.0

Version control library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

20/03 2014

0.1.0

0.1.0.0

Version control library of the Ride framework

  Sources   Download

MIT

by Joris Vandeweerd