2017 © Pedro Peláez
 

library github-service

Nette Framework service to get file last modification date from GitHub

image

premekkoch/github-service

Nette Framework service to get file last modification date from GitHub

  • Thursday, June 29, 2017
  • by premekkoch
  • Repository
  • 1 Watchers
  • 0 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

PremekKoch\github-service

Use this service, if you want to find the last modification date of your repository file on github. Service uses a cache for performace reasons., (*1)

Instalation

composer require premekkoch/github-service

Configuration

1. Add section "Github" to parameters section in config.neon:

  parameters:
    GitHub:
      user: GITHUB_USER
      repo: REPOSITORY_NAME
      subdir: REPOSITORY_SUBDIRECTORY
      client_id: CLIENT_ID
      client_secret: CLIENT_SECRET

Item subdir can be empty - use it, if you're working only with one of repo directory only., (*2)

2. Register a service in config.neon:

services:
      githubService: PremekKoch\GitHub\GitHubService(%GitHub.user%, %GitHub.repo%, %GitHub.subdir%, %GitHub.client_id%, %GitHub.client_secret%)

How to use

1. Simple use:

Inject an service into presenter, (*3)

  /** @var PremekKoch\GitHub\GitHubService @inject */
  public $githubService;

and then call service method, (*4)

    :
  $file = 'test.md';
  $this->githubService->getFileLastCommit($file, TRUE);
    :

By setting second parameter "useCache" you can decide, if you want to get cashed or "live" data. If this parameter is set to FALSE, GitHub API is called and cache is refreshed automaticaly for this file., (*5)

2. Cache refresh:

Simply call, (*6)

    $this->githubService->refreshGithubCache();

to refresh cache for all files. Or you can do something like this for refresh .md files cache only:, (*7)

  $tree = $this->gitHubService->getFilesTree();
  foreach ($tree as $file) {
    if (strpos($file->path, '.md')) {
      $this->gitHubService->getFileLastCommit($file->path, FALSE);
  }

The Versions

29/06 2017

dev-master

9999999-dev

Nette Framework service to get file last modification date from GitHub

  Sources   Download

The Requires

 

by Avatar premekkoch

29/06 2017

0.1.0

0.1.0.0

Nette Framework service to get file last modification date from GitHub

  Sources   Download

The Requires

 

by Avatar premekkoch

31/05 2017

0.0.7

0.0.7.0

Nette Framework service to get file last modification date from GitHub

  Sources   Download

The Requires

 

by Avatar premekkoch

11/04 2017

0.0.6

0.0.6.0

Nette Framework service to get file last modification date from GitHub

  Sources   Download

The Requires

 

by Avatar premekkoch

17/04 2016

0.0.5

0.0.5.0

Nette Framework service to get file last modification date from GitHub

  Sources   Download

The Requires

 

by Avatar premekkoch

17/04 2016

0.05

0.05.0.0

Nette Framework service to get file last modification date from GitHub

  Sources   Download

The Requires

 

by Avatar premekkoch

05/03 2016

0.0.4

0.0.4.0

Nette Framework service to get file last modification date from GitHub

  Sources   Download

The Requires

 

by Avatar premekkoch

05/03 2016

0.0.3

0.0.3.0

Service to get files last modification date on github

  Sources   Download

The Requires

 

by Avatar premekkoch

05/03 2016

0.0.2

0.0.2.0

Service to get files last modification date on github

  Sources   Download

The Requires

 

by Avatar premekkoch

05/03 2016

0.0.1

0.0.1.0

Service to get files last modification date on github

  Sources   Download

The Requires

 

by Avatar premekkoch