BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
Wikimedia\Composer\MergePlugin Class Reference
Inheritance diagram for Wikimedia\Composer\MergePlugin:
Collaboration diagram for Wikimedia\Composer\MergePlugin:

Public Member Functions

 activate (Composer $composer, IOInterface $io)
 
 onInstallUpdateOrDump (Event $event)
 
 onDependencySolve (InstallerEvent $event)
 
 onPostPackageInstall (PackageEvent $event)
 
 onPostInstallOrUpdate (Event $event)
 

Static Public Member Functions

static getSubscribedEvents ()
 

Public Attributes

const PACKAGE_NAME = 'wikimedia/composer-merge-plugin'
 

Protected Member Functions

 mergeFiles (array $patterns, $required=false)
 
 mergeFile (RootPackageInterface $root, $path)
 

Protected Attributes

 $composer
 
 $state
 
 $logger
 
 $loadedFiles = array()
 

Detailed Description

Composer plugin that allows merging multiple composer.json files.

When installed, this plugin will look for a "merge-plugin" key in the composer configuration's "extra" section. The value for this key is a set of options configuring the plugin.

An "include" setting is required. The value of this setting can be either a single value or an array of values. Each value is treated as a glob() pattern identifying additional composer.json style configuration files to merge into the configuration for the current compser execution.

The "autoload", "autoload-dev", "conflict", "provide", "replace", "repositories", "require", "require-dev", and "suggest" sections of the found configuration files will be merged into the root package configuration as though they were directly included in the top-level composer.json file.

If included files specify conflicting package versions for "require" or "require-dev", the normal Composer dependency solver process will be used to attempt to resolve the conflict. Specifying the 'replace' key as true will change this default behaviour so that the last-defined version of a package will win, allowing for force-overrides of package defines.

By default the "extra" section is not merged. This can be enabled by setitng the 'merge-extra' key to true. In normal mode, when the same key is found in both the original and the imported extra section, the version in the original config is used and the imported version is skipped. If 'replace' mode is active, this behaviour changes so the imported version of the key is used, replacing the version in the original config.

{
"require": {
"wikimedia/composer-merge-plugin": "dev-master"
},
"extra": {
"merge-plugin": {
"include": [
"composer.local.json"
]
}
}
}
Author
Bryan Davis bd808.nosp@m.@bd8.nosp@m.08.co.nosp@m.m

Member Function Documentation

Wikimedia\Composer\MergePlugin::activate ( Composer  $composer,
IOInterface  $io 
)

{}

static Wikimedia\Composer\MergePlugin::getSubscribedEvents ( )
static

{}

Wikimedia\Composer\MergePlugin::mergeFile ( RootPackageInterface  $root,
  $path 
)
protected

Read a JSON file and merge its contents

Parameters
RootPackageInterface$root
string$path
Wikimedia\Composer\MergePlugin::mergeFiles ( array  $patterns,
  $required = false 
)
protected

Find configuration files matching the configured glob patterns and merge their contents with the master package.

Parameters
array$patternsList of files/glob patterns
bool$requiredAre the patterns required to match files?
Exceptions
MissingFileExceptionwhen required and a pattern returns no results
Wikimedia\Composer\MergePlugin::onDependencySolve ( InstallerEvent  $event)

Handle an event callback for pre-dependency solving phase of an install or update by adding any duplicate package dependencies found during initial merge processing to the request that will be processed by the dependency solver.

Parameters
InstallerEvent$event
Wikimedia\Composer\MergePlugin::onInstallUpdateOrDump ( Event  $event)

Handle an event callback for an install, update or dump command by checking for "merge-plugin" in the "extra" data and merging package contents if found.

Parameters
Event$event
Wikimedia\Composer\MergePlugin::onPostInstallOrUpdate ( Event  $event)

Handle an event callback following an install or update command. If our plugin was installed during the run then trigger an update command to process any merge-patterns in the current config.

Parameters
Event$event
Wikimedia\Composer\MergePlugin::onPostPackageInstall ( PackageEvent  $event)

Handle an event callback following installation of a new package by checking to see if the package that was installed was our plugin.

Parameters
PackageEvent$event

Member Data Documentation

const Wikimedia\Composer\MergePlugin::PACKAGE_NAME = 'wikimedia/composer-merge-plugin'

Offical package name


The documentation for this class was generated from the following file: