Merge branches 'add_exclude' and 'master' of https://github.com/trivago/composer into add_exclude
* 'add_exclude' of https://github.com/trivago/composer: # By Jordi Boggiano (239) and others # Via Jordi Boggiano (184) and others * 'master' of https://github.com/trivago/composer: (638 commits) Simplified syntax github deprecation changes fix bug in GitDriver::supports for remote repo strict check, testcase(s) Fix regex matching and add more tests for addSubNode, refs #3721, fixes #3716 solve edge case for `composer remove vendor/pkg` chmod 644 src/Composer/Command/RemoveCommand.php Avoid failing on composer show of lazy providers Show more info when a download fails Add notion of autoloader skipping autoload-dev rules Satis grammar fix. remove unused statements removed needless output param + limit git ls-remote to heads + escape repo url add check for remote Repository in GitDriver::supports suppress the prefix Improve notice about /usr/local/bin Reuse current file permissions Add the P character to the regex pattern Added deprecated warning for the dev option ... Conflicts: src/Composer/Autoload/AutoloadGenerator.php src/Composer/Autoload/ClassMapGenerator.phpmain
commit
f28785a49d
@ -0,0 +1,29 @@
|
||||
Contributing to Composer
|
||||
========================
|
||||
|
||||
Installation from Source
|
||||
------------------------
|
||||
|
||||
Prior to contributing to Composer, you must use be able to run the tests.
|
||||
To achieve this, you must use the sources and not the phar file.
|
||||
|
||||
1. Run `git clone https://github.com/composer/composer.git`
|
||||
2. Download the [`composer.phar`](https://getcomposer.org/composer.phar) executable
|
||||
3. Run Composer to get the dependencies: `cd composer && php ../composer.phar install`
|
||||
|
||||
You can now run Composer by executing the `bin/composer` script: `php /path/to/composer/bin/composer`
|
||||
|
||||
Contributing policy
|
||||
-------------------
|
||||
|
||||
All code contributions - including those of people having commit access -
|
||||
must go through a pull request and approved by a core developer before being
|
||||
merged. This is to ensure proper review of all the code.
|
||||
|
||||
Fork the project, create a feature branch, and send us a pull request.
|
||||
|
||||
To ensure a consistent code base, you should make sure the code follows
|
||||
the [Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html)
|
||||
which we borrowed from Symfony.
|
||||
|
||||
If you would like to help, take a look at the [list of issues](http://github.com/composer/composer/issues).
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,59 @@
|
||||
<!--
|
||||
tagline: Access privately hosted packages
|
||||
-->
|
||||
|
||||
# HTTP basic authentication
|
||||
|
||||
Your [Satis or Toran Proxy](handling-private-packages-with-satis.md) server
|
||||
could be secured with http basic authentication. In order to allow your project
|
||||
to have access to these packages you will have to tell composer how to
|
||||
authenticate with your credentials.
|
||||
|
||||
The simplest way to provide your credentials is providing your set
|
||||
of credentials inline with the repository specification such as:
|
||||
|
||||
```json
|
||||
{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "http://extremely:secret@repo.example.org"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This will basically teach composer how to authenticate automatically
|
||||
when reading packages from the provided composer repository.
|
||||
|
||||
This does not work for everybody especially when you don't want to
|
||||
hard code your credentials into your composer.json. There is a second
|
||||
way to provide these details and it is via interaction. If you don't
|
||||
provide the authentication credentials composer will prompt you upon
|
||||
connection to enter the username and password.
|
||||
|
||||
The third way if you want to pre-configure it is via an `auth.json` file
|
||||
located in your `COMPOSER_HOME` or besides your `composer.json`.
|
||||
|
||||
The file should contain a set of hostnames followed each with their own
|
||||
username/password pairs, for example:
|
||||
|
||||
```json
|
||||
{
|
||||
"basic-auth": {
|
||||
"repo.example1.org": {
|
||||
"username": "my-username1",
|
||||
"password": "my-secret-password1"
|
||||
},
|
||||
"repo.example2.org": {
|
||||
"username": "my-username2",
|
||||
"password": "my-secret-password2"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The main advantage of the auth.json file is that it can be gitignored so
|
||||
that every developer in your team can place their own credentials in there,
|
||||
which makes revokation of credentials much easier than if you all share the
|
||||
same.
|
@ -0,0 +1,21 @@
|
||||
# Why are unbound version constraints a bad idea?
|
||||
|
||||
A version constraint without an upper bound such as `*`, `>=3.4` or
|
||||
`dev-master` will allow updates to any future version of the dependency.
|
||||
This includes major versions breaking backward compatibility.
|
||||
|
||||
Once a release of your package is tagged, you cannot tweak its dependencies
|
||||
anymore in case a dependency breaks BC - you have to do a new release but the
|
||||
previous one stays broken.
|
||||
|
||||
The only good alternative is to define an upper bound on your constraints,
|
||||
which you can increase in a new release after testing that your package is
|
||||
compatible with the new major version of your dependency.
|
||||
|
||||
For example instead of using `>=3.4` you should use `~3.4` which allows all
|
||||
versions up to `3.999` but does not include `4.0` and above. The `~` operator
|
||||
works very well with libraries follow [semantic versioning](http://semver.org).
|
||||
|
||||
**Note:** As a package maintainer, you can make the life of your users easier
|
||||
by providing an [alias version](../articles/aliases.md) for your development
|
||||
branch to allow it to match bound constraints.
|
@ -0,0 +1,20 @@
|
||||
`Composer` type repository fixtures
|
||||
=======================
|
||||
|
||||
This directory contains some examples of what `composer` type repositories can look like. They serve as illustrating examples accompanying the docs, but can also be used as (initial) fixtures for tests.
|
||||
|
||||
* `repo-composer-plain` is a simple, plain `packages.json` file
|
||||
* `repo-composer-with-includes` uses the `includes` mechanism
|
||||
* `repo-composer-with-providers` uses the `providers` mechanism
|
||||
|
||||
Sample Packages used in these fixtures
|
||||
-------
|
||||
|
||||
All these repositories contain the following packages.
|
||||
|
||||
* `foo/bar` versions 1.0.0, 1.0.1 and 1.1.0; dev-default and 1.0.x-dev branches. On dev-default and in 1.1.0, `bar/baz` ~1.0 is required.
|
||||
* `qux/quux` only has a dev-default branch. It `replace`s `gar/nix`.
|
||||
* `gar/nix` has a 1.0.0 version and a dev-default branch. It is being replaced by `qux/quux`.
|
||||
* `bar/baz` has a 1.0.0 version and 1.0.x-dev as well as dev-default branches. Additionally, 1.1.x-dev is a branch alias for dev-default.
|
||||
|
||||
|
@ -0,0 +1,158 @@
|
||||
{
|
||||
"packages": {
|
||||
"bar/baz": {
|
||||
"1.0.0": {
|
||||
"name": "bar/baz",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "35810817c14d"
|
||||
},
|
||||
"time": "2014-10-13 12:04:55",
|
||||
"type": "library"
|
||||
},
|
||||
"1.0.x-dev": {
|
||||
"name": "bar/baz",
|
||||
"version": "1.0.x-dev",
|
||||
"version_normalized": "1.0.9999999.9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "ffff9aae6ed5"
|
||||
},
|
||||
"time": "2014-10-13 12:05:37",
|
||||
"type": "library"
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "bar/baz",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "f317e556f2e2"
|
||||
},
|
||||
"time": "2014-10-13 12:06:45",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-default": "1.1.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"foo/bar": {
|
||||
"1.0.0": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "249dec95a52a"
|
||||
},
|
||||
"time": "2014-10-11 15:42:00",
|
||||
"type": "library"
|
||||
},
|
||||
"1.0.1": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.0.1",
|
||||
"version_normalized": "1.0.1.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "21e3328295d4"
|
||||
},
|
||||
"time": "2014-10-11 15:45:56",
|
||||
"type": "library"
|
||||
},
|
||||
"1.0.x-dev": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.0.x-dev",
|
||||
"version_normalized": "1.0.9999999.9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "14dc17c8e860"
|
||||
},
|
||||
"time": "2014-10-11 15:45:59",
|
||||
"type": "library"
|
||||
},
|
||||
"1.1.0": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.1.0",
|
||||
"version_normalized": "1.1.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "d2fa3e69ad5b"
|
||||
},
|
||||
"require": {
|
||||
"bar/baz": "~1.0"
|
||||
},
|
||||
"time": "2014-10-11 15:43:16",
|
||||
"type": "library"
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "foo/bar",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "8e5a5c224336"
|
||||
},
|
||||
"require": {
|
||||
"bar/baz": "~1.0"
|
||||
},
|
||||
"time": "2014-10-11 15:43:18",
|
||||
"type": "library"
|
||||
}
|
||||
},
|
||||
"gar/nix": {
|
||||
"1.0.0": {
|
||||
"name": "gar/nix",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "44977145d64e"
|
||||
},
|
||||
"time": "2014-10-13 12:03:33",
|
||||
"type": "library"
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "gar/nix",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "51cca95a31c2"
|
||||
},
|
||||
"time": "2014-10-13 12:03:35",
|
||||
"type": "library"
|
||||
}
|
||||
},
|
||||
"qux/quux": {
|
||||
"dev-default": {
|
||||
"name": "qux/quux",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "4a10a567baa5"
|
||||
},
|
||||
"replace": {
|
||||
"gar/nix": "1.0.*"
|
||||
},
|
||||
"time": "2014-10-11 15:48:15",
|
||||
"type": "library"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
{
|
||||
"packages": {
|
||||
"bar/baz": {
|
||||
"1.0.0": {
|
||||
"name": "bar/baz",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "35810817c14d"
|
||||
},
|
||||
"time": "2014-10-13 12:04:55",
|
||||
"type": "library"
|
||||
},
|
||||
"1.0.x-dev": {
|
||||
"name": "bar/baz",
|
||||
"version": "1.0.x-dev",
|
||||
"version_normalized": "1.0.9999999.9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "ffff9aae6ed5"
|
||||
},
|
||||
"time": "2014-10-13 12:05:37",
|
||||
"type": "library"
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "bar/baz",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "f317e556f2e2"
|
||||
},
|
||||
"time": "2014-10-13 12:06:45",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-default": "1.1.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"foo/bar": {
|
||||
"1.0.0": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "249dec95a52a"
|
||||
},
|
||||
"time": "2014-10-11 15:42:00",
|
||||
"type": "library"
|
||||
},
|
||||
"1.0.1": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.0.1",
|
||||
"version_normalized": "1.0.1.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "21e3328295d4"
|
||||
},
|
||||
"time": "2014-10-11 15:45:56",
|
||||
"type": "library"
|
||||
},
|
||||
"1.0.x-dev": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.0.x-dev",
|
||||
"version_normalized": "1.0.9999999.9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "14dc17c8e860"
|
||||
},
|
||||
"time": "2014-10-11 15:45:59",
|
||||
"type": "library"
|
||||
},
|
||||
"1.1.0": {
|
||||
"name": "foo/bar",
|
||||
"version": "1.1.0",
|
||||
"version_normalized": "1.1.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "d2fa3e69ad5b"
|
||||
},
|
||||
"require": {
|
||||
"bar/baz": "~1.0"
|
||||
},
|
||||
"time": "2014-10-11 15:43:16",
|
||||
"type": "library"
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "foo/bar",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "8e5a5c224336"
|
||||
},
|
||||
"require": {
|
||||
"bar/baz": "~1.0"
|
||||
},
|
||||
"time": "2014-10-11 15:43:18",
|
||||
"type": "library"
|
||||
}
|
||||
},
|
||||
"gar/nix": {
|
||||
"1.0.0": {
|
||||
"name": "gar/nix",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "44977145d64e"
|
||||
},
|
||||
"time": "2014-10-13 12:03:33",
|
||||
"type": "library"
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "gar/nix",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "51cca95a31c2"
|
||||
},
|
||||
"time": "2014-10-13 12:03:35",
|
||||
"type": "library"
|
||||
}
|
||||
},
|
||||
"qux/quux": {
|
||||
"dev-default": {
|
||||
"name": "qux/quux",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http://some.where/over/the/rainbow/",
|
||||
"reference": "4a10a567baa5"
|
||||
},
|
||||
"replace": {
|
||||
"gar/nix": "1.0.*"
|
||||
},
|
||||
"time": "2014-10-11 15:48:15",
|
||||
"type": "library"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"packages": [
|
||||
|
||||
],
|
||||
"includes": {
|
||||
"include/all$5fa86b937f0502d92f776072cd49c002dca742b9.json": {
|
||||
"sha1": "5fa86b937f0502d92f776072cd49c002dca742b9"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
{
|
||||
"packages": {
|
||||
"bar\/baz": {
|
||||
"1.0.0": {
|
||||
"name": "bar\/baz",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "35810817c14d"
|
||||
},
|
||||
"time": "2014-10-13 12:04:55",
|
||||
"type": "library",
|
||||
"uid": 0
|
||||
},
|
||||
"1.0.x-dev": {
|
||||
"name": "bar\/baz",
|
||||
"version": "1.0.x-dev",
|
||||
"version_normalized": "1.0.9999999.9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "ffff9aae6ed5"
|
||||
},
|
||||
"time": "2014-10-13 12:05:37",
|
||||
"type": "library",
|
||||
"uid": 1
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "bar\/baz",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "f317e556f2e2"
|
||||
},
|
||||
"time": "2014-10-13 12:06:45",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-default": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"uid": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
{
|
||||
"packages": {
|
||||
"foo\/bar": {
|
||||
"1.0.0": {
|
||||
"name": "foo\/bar",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "249dec95a52a"
|
||||
},
|
||||
"time": "2014-10-11 15:42:00",
|
||||
"type": "library",
|
||||
"uid": 3
|
||||
},
|
||||
"1.0.1": {
|
||||
"name": "foo\/bar",
|
||||
"version": "1.0.1",
|
||||
"version_normalized": "1.0.1.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "21e3328295d4"
|
||||
},
|
||||
"time": "2014-10-11 15:45:56",
|
||||
"type": "library",
|
||||
"uid": 4
|
||||
},
|
||||
"1.0.x-dev": {
|
||||
"name": "foo\/bar",
|
||||
"version": "1.0.x-dev",
|
||||
"version_normalized": "1.0.9999999.9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "14dc17c8e860"
|
||||
},
|
||||
"time": "2014-10-11 15:45:59",
|
||||
"type": "library",
|
||||
"uid": 5
|
||||
},
|
||||
"1.1.0": {
|
||||
"name": "foo\/bar",
|
||||
"version": "1.1.0",
|
||||
"version_normalized": "1.1.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "d2fa3e69ad5b"
|
||||
},
|
||||
"require": {
|
||||
"bar\/baz": "~1.0"
|
||||
},
|
||||
"time": "2014-10-11 15:43:16",
|
||||
"type": "library",
|
||||
"uid": 6
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "foo\/bar",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "8e5a5c224336"
|
||||
},
|
||||
"require": {
|
||||
"bar\/baz": "~1.0"
|
||||
},
|
||||
"time": "2014-10-11 15:43:18",
|
||||
"type": "library",
|
||||
"uid": 7
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
{
|
||||
"packages": {
|
||||
"qux\/quux": {
|
||||
"dev-default": {
|
||||
"name": "qux\/quux",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "4a10a567baa5"
|
||||
},
|
||||
"replace": {
|
||||
"gar\/nix": "1.0.*"
|
||||
},
|
||||
"time": "2014-10-11 15:48:15",
|
||||
"type": "library",
|
||||
"uid": 10
|
||||
}
|
||||
},
|
||||
"gar\/nix": {
|
||||
"1.0.0": {
|
||||
"name": "gar\/nix",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "44977145d64e"
|
||||
},
|
||||
"time": "2014-10-13 12:03:33",
|
||||
"type": "library",
|
||||
"uid": 8
|
||||
},
|
||||
"dev-default": {
|
||||
"name": "gar\/nix",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "51cca95a31c2"
|
||||
},
|
||||
"time": "2014-10-13 12:03:35",
|
||||
"type": "library",
|
||||
"uid": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"providers": {
|
||||
"bar\/baz": {
|
||||
"sha256": "923363b3c22e73abb2e3fd891c8156dd4d0821a97fd3e428bc910833e3e46dbe"
|
||||
},
|
||||
"foo\/bar": {
|
||||
"sha256": "4baabb3303afa3e34a4d3af18fb138e5f3b79029c1f8d9ab5b477ea15776ba0a"
|
||||
},
|
||||
"gar\/nix": {
|
||||
"sha256": "5d210670cb46c8364c8e3fb449967b9bea558b971e5b082f330ae4f1d484c321"
|
||||
},
|
||||
"qux\/quux": {
|
||||
"sha256": "c142d1a07ca354be46b613f59f1d601923a5a00ccc5fcce50a77ecdd461eb72d"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"packages": {
|
||||
"qux\/quux": {
|
||||
"dev-default": {
|
||||
"name": "qux\/quux",
|
||||
"version": "dev-default",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "hg",
|
||||
"url": "http:\/\/some.where\/over\/the\/rainbow\/",
|
||||
"reference": "4a10a567baa5"
|
||||
},
|
||||
"replace": {
|
||||
"gar\/nix": "1.0.*"
|
||||
},
|
||||
"time": "2014-10-11 15:48:15",
|
||||
"type": "library",
|
||||
"uid": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"packages": [],
|
||||
"providers-url": "\/p\/%package%$%hash%.json",
|
||||
"provider-includes": {
|
||||
"p\/provider-active$1893a061e579543822389ecd12d791c612db0c05e22d90e9286e233cacd86ed8.json": {
|
||||
"sha256": "1893a061e579543822389ecd12d791c612db0c05e22d90e9286e233cacd86ed8"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +1,59 @@
|
||||
[
|
||||
"AFL-1.1", "AFL-1.2", "AFL-2.0", "AFL-2.1", "AFL-3.0", "APL-1.0", "Aladdin",
|
||||
"ANTLR-PD", "Apache-1.0", "Apache-1.1", "Apache-2.0", "APSL-1.0",
|
||||
"APSL-1.1", "APSL-1.2", "APSL-2.0", "Artistic-1.0", "Artistic-2.0", "AAL",
|
||||
"BitTorrent-1.0", "BitTorrent-1.1", "BSL-1.0", "BSD-3-Clause-Clear",
|
||||
"BSD-2-Clause", "BSD-2-Clause-FreeBSD", "BSD-2-Clause-NetBSD",
|
||||
"BSD-3-Clause", "BSD-4-Clause", "BSD-4-Clause-UC", "CECILL-1.0",
|
||||
"CECILL-1.1", "CECILL-2.0", "CECILL-B", "CECILL-C", "ClArtistic",
|
||||
"CNRI-Python", "CNRI-Python-GPL-Compatible", "CDDL-1.0", "CDDL-1.1",
|
||||
"CPAL-1.0", "CPL-1.0", "CATOSL-1.1", "Condor-1.1", "CC-BY-1.0", "CC-BY-2.0",
|
||||
"CC-BY-2.5", "CC-BY-3.0", "CC-BY-ND-1.0", "CC-BY-ND-2.0", "CC-BY-ND-2.5",
|
||||
"CC-BY-ND-3.0", "CC-BY-NC-1.0", "CC-BY-NC-2.0", "CC-BY-NC-2.5",
|
||||
"CC-BY-NC-3.0", "CC-BY-NC-ND-1.0", "CC-BY-NC-ND-2.0", "CC-BY-NC-ND-2.5",
|
||||
"CC-BY-NC-ND-3.0", "CC-BY-NC-SA-1.0", "CC-BY-NC-SA-2.0", "CC-BY-NC-SA-2.5",
|
||||
"CC-BY-NC-SA-3.0", "CC-BY-SA-1.0", "CC-BY-SA-2.0", "CC-BY-SA-2.5",
|
||||
"CC-BY-SA-3.0", "CC0-1.0", "CUA-OPL-1.0", "WTFPL", "EPL-1.0", "eCos-2.0",
|
||||
"ECL-1.0", "ECL-2.0", "EFL-1.0", "EFL-2.0", "Entessa", "ErlPL-1.1",
|
||||
"EUDatagrid", "EUPL-1.0", "EUPL-1.1", "Fair", "Frameworx-1.0", "FTL",
|
||||
"AGPL-3.0", "GFDL-1.1", "GFDL-1.2", "GFDL-1.3", "GPL-1.0", "GPL-1.0+",
|
||||
"GPL-2.0", "GPL-2.0+", "GPL-2.0-with-autoconf-exception",
|
||||
"Glide", "Abstyles", "AFL-1.1", "AFL-1.2", "AFL-2.0", "AFL-2.1", "AFL-3.0",
|
||||
"AMPAS", "APL-1.0", "Adobe-Glyph", "APAFML", "Adobe-2006", "AGPL-1.0",
|
||||
"Afmparse", "Aladdin", "ADSL", "AMDPLPA", "ANTLR-PD", "Apache-1.0",
|
||||
"Apache-1.1", "Apache-2.0", "AML", "APSL-1.0", "APSL-1.1", "APSL-1.2",
|
||||
"APSL-2.0", "Artistic-1.0", "Artistic-1.0-Perl", "Artistic-1.0-cl8",
|
||||
"Artistic-2.0", "AAL", "Bahyph", "Barr", "Beerware", "BitTorrent-1.0",
|
||||
"BitTorrent-1.1", "BSL-1.0", "Borceux", "BSD-2-Clause",
|
||||
"BSD-2-Clause-FreeBSD", "BSD-2-Clause-NetBSD", "BSD-3-Clause",
|
||||
"BSD-3-Clause-Clear", "BSD-4-Clause", "BSD-Protection",
|
||||
"BSD-3-Clause-Attribution", "BSD-4-Clause-UC", "bzip2-1.0.5", "bzip2-1.0.6",
|
||||
"Caldera", "CECILL-1.0", "CECILL-1.1", "CECILL-2.0", "CECILL-B", "CECILL-C",
|
||||
"ClArtistic", "MIT-CMU", "CNRI-Python", "CNRI-Python-GPL-Compatible",
|
||||
"CPOL-1.02", "CDDL-1.0", "CDDL-1.1", "CPAL-1.0", "CPL-1.0", "CATOSL-1.1",
|
||||
"Condor-1.1", "CC-BY-1.0", "CC-BY-2.0", "CC-BY-2.5", "CC-BY-3.0",
|
||||
"CC-BY-4.0", "CC-BY-ND-1.0", "CC-BY-ND-2.0", "CC-BY-ND-2.5", "CC-BY-ND-3.0",
|
||||
"CC-BY-ND-4.0", "CC-BY-NC-1.0", "CC-BY-NC-2.0", "CC-BY-NC-2.5",
|
||||
"CC-BY-NC-3.0", "CC-BY-NC-4.0", "CC-BY-NC-ND-1.0", "CC-BY-NC-ND-2.0",
|
||||
"CC-BY-NC-ND-2.5", "CC-BY-NC-ND-3.0", "CC-BY-NC-ND-4.0", "CC-BY-NC-SA-1.0",
|
||||
"CC-BY-NC-SA-2.0", "CC-BY-NC-SA-2.5", "CC-BY-NC-SA-3.0", "CC-BY-NC-SA-4.0",
|
||||
"CC-BY-SA-1.0", "CC-BY-SA-2.0", "CC-BY-SA-2.5", "CC-BY-SA-3.0",
|
||||
"CC-BY-SA-4.0", "CC0-1.0", "Crossword", "CUA-OPL-1.0", "Cube", "D-FSL-1.0",
|
||||
"diffmark", "WTFPL", "DOC", "Dotseqn", "DSDP", "dvipdfm", "EPL-1.0",
|
||||
"eCos-2.0", "ECL-1.0", "ECL-2.0", "eGenix", "EFL-1.0", "EFL-2.0",
|
||||
"MIT-advertising", "MIT-enna", "Entessa", "ErlPL-1.1", "EUDatagrid",
|
||||
"EUPL-1.0", "EUPL-1.1", "Eurosym", "Fair", "MIT-feh", "Frameworx-1.0",
|
||||
"FTL", "FSFUL", "FSFULLR", "Giftware", "GL2PS", "Glulxe", "AGPL-3.0",
|
||||
"GFDL-1.1", "GFDL-1.2", "GFDL-1.3", "GPL-1.0", "GPL-1.0+", "GPL-2.0",
|
||||
"GPL-2.0+", "GPL-2.0-with-autoconf-exception",
|
||||
"GPL-2.0-with-bison-exception", "GPL-2.0-with-classpath-exception",
|
||||
"GPL-2.0-with-font-exception", "GPL-2.0-with-GCC-exception", "GPL-3.0",
|
||||
"GPL-3.0+", "GPL-3.0-with-autoconf-exception", "GPL-3.0-with-GCC-exception",
|
||||
"LGPL-2.1", "LGPL-2.1+", "LGPL-3.0", "LGPL-3.0+", "LGPL-2.0", "LGPL-2.0+",
|
||||
"gSOAP-1.3b", "HPND", "IPL-1.0", "Imlib2", "IJG", "Intel", "IPA", "ISC",
|
||||
"JSON", "LPPL-1.3a", "LPPL-1.0", "LPPL-1.1", "LPPL-1.2", "LPPL-1.3c",
|
||||
"Libpng", "LPL-1.02", "LPL-1.0", "MS-PL", "MS-RL", "MirOS", "MIT",
|
||||
"Motosoto", "MPL-1.0", "MPL-1.1", "MPL-2.0",
|
||||
"MPL-2.0-no-copyleft-exception", "Multics", "NASA-1.3", "Naumen",
|
||||
"NBPL-1.0", "NGPL", "NOSL", "NPL-1.0", "NPL-1.1", "Nokia", "NPOSL-3.0",
|
||||
"NTP", "OCLC-2.0", "ODbL-1.0", "PDDL-1.0", "OGTSL", "OLDAP-2.2.2",
|
||||
"gnuplot", "gSOAP-1.3b", "HaskellReport", "HPND", "IBM-pibs", "IPL-1.0",
|
||||
"ImageMagick", "iMatix", "Imlib2", "IJG", "Intel-ACPI", "Intel", "IPA",
|
||||
"ISC", "JasPer-2.0", "JSON", "LPPL-1.3a", "LPPL-1.0", "LPPL-1.1",
|
||||
"LPPL-1.2", "LPPL-1.3c", "Latex2e", "BSD-3-Clause-LBNL", "Leptonica",
|
||||
"Libpng", "libtiff", "LPL-1.02", "LPL-1.0", "MakeIndex", "MTLL", "MS-PL",
|
||||
"MS-RL", "MirOS", "MITNFA", "MIT", "Motosoto", "MPL-1.0", "MPL-1.1",
|
||||
"MPL-2.0", "MPL-2.0-no-copyleft-exception", "mpich2", "Multics", "Mup",
|
||||
"NASA-1.3", "Naumen", "NBPL-1.0", "NetCDF", "NGPL", "NOSL", "NPL-1.0",
|
||||
"NPL-1.1", "Newsletr", "NLPL", "Nokia", "NPOSL-3.0", "Noweb", "NRL", "NTP",
|
||||
"Nunit", "OCLC-2.0", "ODbL-1.0", "PDDL-1.0", "OGTSL", "OLDAP-2.2.2",
|
||||
"OLDAP-1.1", "OLDAP-1.2", "OLDAP-1.3", "OLDAP-1.4", "OLDAP-2.0",
|
||||
"OLDAP-2.0.1", "OLDAP-2.1", "OLDAP-2.2", "OLDAP-2.2.1", "OLDAP-2.3",
|
||||
"OLDAP-2.4", "OLDAP-2.5", "OLDAP-2.6", "OLDAP-2.7", "OPL-1.0", "OSL-1.0",
|
||||
"OSL-2.0", "OSL-2.1", "OSL-3.0", "OLDAP-2.8", "OpenSSL", "PHP-3.0",
|
||||
"PHP-3.01", "PostgreSQL", "Python-2.0", "QPL-1.0", "RPSL-1.0", "RPL-1.5",
|
||||
"RHeCos-1.1", "RSCPL", "Ruby", "SAX-PD", "SGI-B-1.0", "SGI-B-1.1",
|
||||
"SGI-B-2.0", "OFL-1.0", "OFL-1.1", "SimPL-2.0", "Sleepycat", "SMLNJ",
|
||||
"SugarCRM-1.1.3", "SISSL", "SPL-1.0", "Watcom-1.0", "NCSA", "VSL-1.0",
|
||||
"W3C", "WXwindows", "Xnet", "X11", "XFree86-1.1", "YPL-1.0", "YPL-1.1",
|
||||
"Zimbra-1.3", "Zlib", "ZPL-1.1", "ZPL-2.0", "ZPL-2.1"
|
||||
]
|
||||
"OLDAP-2.4", "OLDAP-2.5", "OLDAP-2.6", "OLDAP-2.7", "OML", "OPL-1.0",
|
||||
"OSL-1.0", "OSL-1.1", "OSL-2.0", "OSL-2.1", "OSL-3.0", "OLDAP-2.8",
|
||||
"OpenSSL", "PHP-3.0", "PHP-3.01", "Plexus", "PostgreSQL", "psfrag",
|
||||
"psutils", "Python-2.0", "QPL-1.0", "Qhull", "Rdisc", "RPSL-1.0", "RPL-1.1",
|
||||
"RPL-1.5", "RHeCos-1.1", "RSCPL", "Ruby", "SAX-PD", "Saxpath", "SCEA",
|
||||
"SWL", "SGI-B-1.0", "SGI-B-1.1", "SGI-B-2.0", "OFL-1.0", "OFL-1.1",
|
||||
"SimPL-2.0", "Sleepycat", "SNIA", "SMLNJ", "StandardML-NJ",
|
||||
"SugarCRM-1.1.3", "SISSL", "SISSL-1.2", "SPL-1.0", "Watcom-1.0", "TCL",
|
||||
"Unlicense", "TMate", "TORQUE-1.1", "TOSL", "Unicode-TOU", "NCSA", "Vim",
|
||||
"VOSTROM", "VSL-1.0", "W3C", "Wsuipa", "WXwindows", "Xnet", "X11", "Xerox",
|
||||
"XFree86-1.1", "xinetd", "xpp", "XSkat", "YPL-1.0", "YPL-1.1", "Zed",
|
||||
"Zend-2.0", "Zimbra-1.3", "Zlib", "zlib-acknowledgement", "ZPL-1.1",
|
||||
"ZPL-2.0", "ZPL-2.1"
|
||||
]
|
||||
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Command;
|
||||
|
||||
use Composer\Cache;
|
||||
use Composer\Factory;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @author David Neilsen <petah.p@gmail.com>
|
||||
*/
|
||||
class ClearCacheCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('clear-cache')
|
||||
->setAliases(array('clearcache'))
|
||||
->setDescription('Clears composer\'s internal package cache.')
|
||||
->setHelp(<<<EOT
|
||||
The <info>clear-cache</info> deletes all cached packages from composer's
|
||||
cache directory.
|
||||
EOT
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$config = Factory::createConfig();
|
||||
$io = $this->getIO();
|
||||
|
||||
$cachePaths = array(
|
||||
'cache-dir' => $config->get('cache-dir'),
|
||||
'cache-files-dir' => $config->get('cache-files-dir'),
|
||||
'cache-repo-dir' => $config->get('cache-repo-dir'),
|
||||
'cache-vcs-dir' => $config->get('cache-vcs-dir'),
|
||||
);
|
||||
|
||||
foreach ($cachePaths as $key => $cachePath) {
|
||||
$cachePath = realpath($cachePath);
|
||||
if (!$cachePath) {
|
||||
$io->write("<info>Cache directory does not exist ($key): $cachePath</info>");
|
||||
|
||||
return;
|
||||
}
|
||||
$cache = new Cache($io, $cachePath);
|
||||
if (!$cache->isEnabled()) {
|
||||
$io->write("<info>Cache is not enabled ($key): $cachePath</info>");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$io->write("<info>Clearing cache ($key): $cachePath</info>");
|
||||
$cache->gc(0, 0);
|
||||
}
|
||||
|
||||
$io->write('<info>All caches cleared.</info>');
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Command;
|
||||
|
||||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\Factory;
|
||||
use Composer\Package\CompletePackageInterface;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @author Robert Schönthal <seroscho@googlemail.com>
|
||||
*/
|
||||
class HomeCommand extends Command
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('browse')
|
||||
->setAliases(array('home'))
|
||||
->setDescription('Opens the package\'s repository URL or homepage in your browser.')
|
||||
->setDefinition(array(
|
||||
new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package(s) to browse to.'),
|
||||
new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
|
||||
new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
|
||||
))
|
||||
->setHelp(<<<EOT
|
||||
The home command opens or shows a package's repository URL or
|
||||
homepage in your default browser.
|
||||
|
||||
To open the homepage by default, use -H or --homepage.
|
||||
To show instead of open the repository or homepage URL, use -s or --show.
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$repo = $this->initializeRepo();
|
||||
$return = 0;
|
||||
|
||||
foreach ($input->getArgument('packages') as $packageName) {
|
||||
$package = $this->getPackage($repo, $packageName);
|
||||
|
||||
if (!$package instanceof CompletePackageInterface) {
|
||||
$return = 1;
|
||||
$output->writeln('<warning>Package '.$packageName.' not found</warning>');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$support = $package->getSupport();
|
||||
$url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
|
||||
if (!$url || $input->getOption('homepage')) {
|
||||
$url = $package->getHomepage();
|
||||
}
|
||||
|
||||
if (!filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
$return = 1;
|
||||
$output->writeln('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($input->getOption('show')) {
|
||||
$output->writeln(sprintf('<info>%s</info>', $url));
|
||||
} else {
|
||||
$this->openBrowser($url);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* finds a package by name
|
||||
*
|
||||
* @param RepositoryInterface $repos
|
||||
* @param string $name
|
||||
* @return CompletePackageInterface
|
||||
*/
|
||||
protected function getPackage(RepositoryInterface $repos, $name)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
$pool = new Pool('dev');
|
||||
$pool->addRepository($repos);
|
||||
$matches = $pool->whatProvides($name);
|
||||
|
||||
foreach ($matches as $index => $package) {
|
||||
// skip providers/replacers
|
||||
if ($package->getName() !== $name) {
|
||||
unset($matches[$index]);
|
||||
continue;
|
||||
}
|
||||
|
||||
return $package;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* opens a url in your system default browser
|
||||
*
|
||||
* @param string $url
|
||||
*/
|
||||
private function openBrowser($url)
|
||||
{
|
||||
$url = ProcessExecutor::escape($url);
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||
return passthru('start "web" explorer "' . $url . '"');
|
||||
}
|
||||
|
||||
passthru('which xdg-open', $linux);
|
||||
passthru('which open', $osx);
|
||||
|
||||
if (0 === $linux) {
|
||||
passthru('xdg-open ' . $url);
|
||||
} elseif (0 === $osx) {
|
||||
passthru('open ' . $url);
|
||||
} else {
|
||||
$this->getIO()->write('no suitable browser opening command found, open yourself: ' . $url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the repo
|
||||
*
|
||||
* @return CompositeRepository
|
||||
*/
|
||||
private function initializeRepo()
|
||||
{
|
||||
$composer = $this->getComposer(false);
|
||||
|
||||
if ($composer) {
|
||||
$repo = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
|
||||
} else {
|
||||
$defaultRepos = Factory::createDefaultRepositories($this->getIO());
|
||||
$repo = new CompositeRepository($defaultRepos);
|
||||
}
|
||||
|
||||
return $repo;
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Command;
|
||||
|
||||
use Composer\Config\JsonConfigSource;
|
||||
use Composer\Installer;
|
||||
use Composer\Plugin\CommandEvent;
|
||||
use Composer\Plugin\PluginEvents;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Factory;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @author Pierre du Plessis <pdples@gmail.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
class RemoveCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('remove')
|
||||
->setDescription('Removes a package from the require or require-dev')
|
||||
->setDefinition(array(
|
||||
new InputArgument('packages', InputArgument::IS_ARRAY, 'Packages that should be removed.'),
|
||||
new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
|
||||
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
|
||||
new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
|
||||
new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
|
||||
new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies.'),
|
||||
new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
|
||||
))
|
||||
->setHelp(<<<EOT
|
||||
The <info>remove</info> command removes a package from the current
|
||||
list of installed packages
|
||||
|
||||
<info>php composer.phar remove</info>
|
||||
|
||||
EOT
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$packages = $input->getArgument('packages');
|
||||
|
||||
$file = Factory::getComposerFile();
|
||||
|
||||
$jsonFile = new JsonFile($file);
|
||||
$composer = $jsonFile->read();
|
||||
$composerBackup = file_get_contents($jsonFile->getPath());
|
||||
|
||||
$json = new JsonConfigSource($jsonFile);
|
||||
|
||||
$type = $input->getOption('dev') ? 'require-dev' : 'require';
|
||||
$altType = !$input->getOption('dev') ? 'require-dev' : 'require';
|
||||
|
||||
foreach ($packages as $package) {
|
||||
if (isset($composer[$type][$package])) {
|
||||
$json->removeLink($type, $package);
|
||||
} elseif (isset($composer[$altType][$package])) {
|
||||
$output->writeln('<warning>'.$package.' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
|
||||
$dialog = $this->getHelperSet()->get('dialog');
|
||||
if ($this->getIO()->isInteractive()) {
|
||||
if ($dialog->askConfirmation($output, $dialog->getQuestion('Do you want to remove it from '.$altType, 'yes', '?'), true)) {
|
||||
$json->removeLink($altType, $package);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$output->writeln('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
|
||||
}
|
||||
}
|
||||
|
||||
if ($input->getOption('no-update')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Update packages
|
||||
$composer = $this->getComposer();
|
||||
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
|
||||
$io = $this->getIO();
|
||||
|
||||
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
|
||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||
|
||||
$install = Installer::create($io, $composer);
|
||||
|
||||
$updateDevMode = !$input->getOption('update-no-dev');
|
||||
$install
|
||||
->setVerbose($input->getOption('verbose'))
|
||||
->setDevMode($updateDevMode)
|
||||
->setUpdate(true)
|
||||
->setUpdateWhitelist($packages)
|
||||
->setWhitelistDependencies($input->getOption('update-with-dependencies'))
|
||||
->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
|
||||
;
|
||||
|
||||
$status = $install->run();
|
||||
if ($status !== 0) {
|
||||
$output->writeln("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
|
||||
file_put_contents($jsonFile->getPath(), $composerBackup);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
class ScriptAliasCommand extends Command
|
||||
{
|
||||
private $script;
|
||||
|
||||
public function __construct($script)
|
||||
{
|
||||
$this->script = $script;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName($this->script)
|
||||
->setDescription('Run the '.$this->script.' script as defined in composer.json.')
|
||||
->setDefinition(array(
|
||||
new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
|
||||
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
|
||||
new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
|
||||
))
|
||||
->setHelp(<<<EOT
|
||||
The <info>run-script</info> command runs scripts defined in composer.json:
|
||||
|
||||
<info>php composer.phar run-script post-update-cmd</info>
|
||||
EOT
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$composer = $this->getComposer();
|
||||
|
||||
// add the bin dir to the PATH to make local binaries of deps usable in scripts
|
||||
$binDir = $composer->getConfig()->get('bin-dir');
|
||||
if (is_dir($binDir)) {
|
||||
putenv('PATH='.realpath($binDir).PATH_SEPARATOR.getenv('PATH'));
|
||||
}
|
||||
|
||||
$args = $input->getArguments();
|
||||
|
||||
return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Downloader;
|
||||
|
||||
use Composer\Config;
|
||||
use Composer\Cache;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\IO\IOInterface;
|
||||
|
||||
/**
|
||||
* GZip archive downloader.
|
||||
*
|
||||
* @author Pavel Puchkin <i@neoascetic.me>
|
||||
*/
|
||||
class GzipDownloader extends ArchiveDownloader
|
||||
{
|
||||
protected $process;
|
||||
|
||||
public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
||||
{
|
||||
$this->process = $process ?: new ProcessExecutor($io);
|
||||
parent::__construct($io, $config, $eventDispatcher, $cache);
|
||||
}
|
||||
|
||||
protected function extract($file, $path)
|
||||
{
|
||||
$targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
|
||||
|
||||
// Try to use gunzip on *nix
|
||||
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
|
||||
|
||||
if (0 === $this->process->execute($command, $ignoredOutput)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
|
||||
throw new \RuntimeException($processError);
|
||||
}
|
||||
|
||||
// Windows version of PHP has built-in support of gzip functions
|
||||
$archiveFile = gzopen($file, 'rb');
|
||||
$targetFile = fopen($targetFilepath, 'wb');
|
||||
while ($string = gzread($archiveFile, 4096)) {
|
||||
fwrite($targetFile, $string, strlen($string));
|
||||
}
|
||||
gzclose($archiveFile);
|
||||
fclose($targetFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getFileName(PackageInterface $package, $path)
|
||||
{
|
||||
return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
|
||||
}
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Installer;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\DependencyResolver\PolicyInterface;
|
||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\DependencyResolver\Request;
|
||||
use Composer\EventDispatcher\Event;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
|
||||
/**
|
||||
* An event for all installer.
|
||||
*
|
||||
* @author François Pluchino <francois.pluchino@gmail.com>
|
||||
*/
|
||||
class InstallerEvent extends Event
|
||||
{
|
||||
/**
|
||||
* @var Composer
|
||||
*/
|
||||
private $composer;
|
||||
|
||||
/**
|
||||
* @var IOInterface
|
||||
*/
|
||||
private $io;
|
||||
|
||||
/**
|
||||
* @var PolicyInterface
|
||||
*/
|
||||
private $policy;
|
||||
|
||||
/**
|
||||
* @var Pool
|
||||
*/
|
||||
private $pool;
|
||||
|
||||
/**
|
||||
* @var CompositeRepository
|
||||
*/
|
||||
private $installedRepo;
|
||||
|
||||
/**
|
||||
* @var Request
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* @var OperationInterface[]
|
||||
*/
|
||||
private $operations;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $eventName
|
||||
* @param Composer $composer
|
||||
* @param IOInterface $io
|
||||
* @param PolicyInterface $policy
|
||||
* @param Pool $pool
|
||||
* @param CompositeRepository $installedRepo
|
||||
* @param Request $request
|
||||
* @param OperationInterface[] $operations
|
||||
*/
|
||||
public function __construct($eventName, Composer $composer, IOInterface $io, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
|
||||
{
|
||||
parent::__construct($eventName);
|
||||
|
||||
$this->composer = $composer;
|
||||
$this->io = $io;
|
||||
$this->policy = $policy;
|
||||
$this->pool = $pool;
|
||||
$this->installedRepo = $installedRepo;
|
||||
$this->request = $request;
|
||||
$this->operations = $operations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Composer
|
||||
*/
|
||||
public function getComposer()
|
||||
{
|
||||
return $this->composer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IOInterface
|
||||
*/
|
||||
public function getIO()
|
||||
{
|
||||
return $this->io;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PolicyInterface
|
||||
*/
|
||||
public function getPolicy()
|
||||
{
|
||||
return $this->policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Pool
|
||||
*/
|
||||
public function getPool()
|
||||
{
|
||||
return $this->pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompositeRepository
|
||||
*/
|
||||
public function getInstalledRepo()
|
||||
{
|
||||
return $this->installedRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Request
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OperationInterface[]
|
||||
*/
|
||||
public function getOperations()
|
||||
{
|
||||
return $this->operations;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Installer;
|
||||
|
||||
/**
|
||||
* The Installer Events.
|
||||
*
|
||||
* @author François Pluchino <francois.pluchino@gmail.com>
|
||||
*/
|
||||
class InstallerEvents
|
||||
{
|
||||
/**
|
||||
* The PRE_DEPENDENCIES_SOLVING event occurs as a installer begins
|
||||
* resolve operations.
|
||||
*
|
||||
* The event listener method receives a
|
||||
* Composer\Installer\InstallerEvent instance.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
|
||||
|
||||
/**
|
||||
* The POST_DEPENDENCIES_SOLVING event occurs as a installer after
|
||||
* resolve operations.
|
||||
*
|
||||
* The event listener method receives a
|
||||
* Composer\Installer\InstallerEvent instance.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue