Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
composer.json Utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Composer
library
composer.json Utils
Commits
957fb15a
Commit
957fb15a
authored
6 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Implement support for Composer commands
parent
afa504b9
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
BaseCommand.php
+32
-0
32 additions, 0 deletions
BaseCommand.php
BaseCommandInterface.php
+17
-0
17 additions, 0 deletions
BaseCommandInterface.php
BaseHandler.php
+43
-0
43 additions, 0 deletions
BaseHandler.php
BaseHandlerInterface.php
+18
-0
18 additions, 0 deletions
BaseHandlerInterface.php
with
110 additions
and
0 deletions
BaseCommand.php
0 → 100644
+
32
−
0
View file @
957fb15a
<?php
namespace
LakeDrops\Component\Composer
;
use
Composer\Command\BaseCommand
as
ComposerBaseCommand
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
/**
* Class BaseCommand.
*
* @package LakeDrops\Component\Composer
*/
abstract
class
BaseCommand
extends
ComposerBaseCommand
implements
BaseCommandInterface
{
/**
* The handler object to do the real work then.
*
* @var \LakeDrops\Component\Composer\BaseHandlerInterface
*/
protected
$handler
;
/**
* {@inheritdoc}
*/
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
{
$class
=
$this
->
getHandlerClass
();
$this
->
handler
=
new
$class
(
$this
->
getComposer
(),
$this
->
getIO
());
$this
->
handler
->
setInput
(
$input
);
}
}
This diff is collapsed.
Click to expand it.
BaseCommandInterface.php
0 → 100644
+
17
−
0
View file @
957fb15a
<?php
namespace
LakeDrops\Component\Composer
;
/**
* Interface for BaseCommand.
*
* @package LakeDrops\Component\Composer
*/
interface
BaseCommandInterface
{
/**
* @return \LakeDrops\Component\Composer\BaseHandlerInterface
*/
public
function
getHandlerClass
();
}
This diff is collapsed.
Click to expand it.
BaseHandler.php
+
43
−
0
View file @
957fb15a
...
...
@@ -4,6 +4,8 @@ namespace LakeDrops\Component\Composer;
use
Composer\Composer
;
use
Composer\IO\IOInterface
;
use
Composer\Script\Event
;
use
Symfony\Component\Console\Input\InputInterface
;
/**
* Class BaseHandler.
...
...
@@ -26,6 +28,18 @@ abstract class BaseHandler implements BaseHandlerInterface {
*/
protected
$io
;
/**
* @var \Symfony\Component\Console\Input\InputInterface
*/
protected
$input
;
/**
* The event that triggered the action.
*
* @var \Composer\Script\Event
*/
protected
$event
;
/**
* The Drupal core package.
*
...
...
@@ -46,6 +60,22 @@ abstract class BaseHandler implements BaseHandlerInterface {
$this
->
io
=
$io
;
}
/**
* {@inheritdoc}
*/
public
function
setEvent
(
Event
$event
)
{
$this
->
event
=
$event
;
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
setInput
(
InputInterface
$input
)
{
$this
->
input
=
$input
;
return
$this
;
}
/**
* {@inheritdoc}
*/
...
...
@@ -63,6 +93,19 @@ abstract class BaseHandler implements BaseHandlerInterface {
return
$this
->
composer
->
getRepositoryManager
()
->
getLocalRepository
()
->
findPackage
(
$name
,
'*'
);
}
/**
* {@inheritdoc}
*/
public
function
isDevMode
()
{
if
(
$this
->
event
!==
NULL
)
{
return
$this
->
event
->
isDevMode
();
}
if
(
$this
->
input
!==
NULL
)
{
return
!
$this
->
input
->
hasOption
(
'no-dev'
);
}
return
FALSE
;
}
/**
* {@inheritdoc}
*/
...
...
This diff is collapsed.
Click to expand it.
BaseHandlerInterface.php
+
18
−
0
View file @
957fb15a
...
...
@@ -2,6 +2,9 @@
namespace
LakeDrops\Component\Composer
;
use
Composer\Script\Event
;
use
Symfony\Component\Console\Input\InputInterface
;
/**
* Interface for BaseHandler.
*
...
...
@@ -9,6 +12,16 @@ namespace LakeDrops\Component\Composer;
*/
interface
BaseHandlerInterface
{
/**
* @param \Composer\Script\Event $event
*/
public
function
setEvent
(
Event
$event
);
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
*/
public
function
setInput
(
InputInterface
$input
);
/**
* Look up the Drupal core package object.
*
...
...
@@ -28,6 +41,11 @@ interface BaseHandlerInterface {
*/
public
function
getPackage
(
$name
);
/**
* @return bool
*/
public
function
isDevMode
();
/**
* Determine if the current process runs in a CI/CD context.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment