shineunited/conductor-gitignore-addon 问题修复 & 功能扩展

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

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

shineunited/conductor-gitignore-addon

最新稳定版本:1.0.1

Composer 安装命令:

composer require shineunited/conductor-gitignore-addon

包简介

Addon for Conductor to support managing project gitignore file.

README 文档

README

License Latest Version PHP Version Main Status Release Status Develop Status

Description

In conjunction with Conductor, this addon will automatically modify the project's .gitignore file to exclude paths installed with the Conductor or specified explicitly by other packages.

Installation

To add conductor-gitignore-addon, the recommended method via composer.

$ composer require shineunited/conductor-gitignore-addon

Configuration

The gitignore addon uses the Conductor configuration framework to parse parameters in the 'extra' section of the project's composer.json file.

Parameters

gitignore.ignore-lockfile

(boolean) If true, add the composer lockfile (composer.lock) to the gitignore file. Defaults to false.

gitignore.ignore-pharfile

(boolean) If true, add the composer pharfile (composer.phar) to the gitignore file. Defaults to true.

gitignore.ignore-vendordir

(boolean) If true, add the entire vendor directory to the gitignore file. Defaults to true.

gitignore.ignore-packages

(boolen) If true, automatically add any packages installed with conductor installers outside of the vendor directory to the gitignore file. Defaults to true.

Example

{
	"name": "example/project",
	"type": "project",
	"extra": {
		"gitignore": {
			"ignore-lockfile": true,
			"ignore-pharfile": false,
			"ignore-vendordir": true,
			"ignore-packages": true
		}
	}
}

Usage

GitignoreProvider Capability

In addition to the automatically added gitignore rules based on the project's config, a composer plugin can explicitly add various rules via the GitignoreProvider capability.

Example Plugin

The plugin must implement Capable and provide the GitignoreProvider capability.

<?php

namespace Example\Project;

use Composer\Composer;
use Composer\IO\IOInterface;
use ShineUnited\Conductor\Addon\Gitignore\Capability\GitignoreProvider;

class ComposerPlugin implements PluginInterface, Capable {

	public function activate(Composer $composer, IOInterface $io): void {
		// ...
	}

	public function deactivate(Composer $composer, IOInterface $io): void {
		// ...
	}

	public function uninstall(Composer $composer, IOInterface $io): void {
		// ...
	}

	public function getCapabilities(): array {
		return [
			GitignoreProvider::class => ExampleGitignoreProvider::class
		];
	}
}

Example Provider

The provider must implement the capability, and return a list of gitignore RuleInterface objects.

<?php

namespace Example\Project;

use ShineUnited\Conductor\Addon\Gitignore\Capability\GitignoreProvider;
use ShineUnited\Conductor\Addon\Gitignore\Pattern\Rule;

class ExampleGitignoreProvider implements GitignoreProvider {

	public function getGitignores(): array {
		return [
			new Rule('path/to/ignore'),
			new Rule('another/path/to/ignore')
		];
	}
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-16