Skip to content

Commit 1e003a8

Browse files
committed
Add tags to the composer file
1 parent 600642b commit 1e003a8

File tree

2 files changed

+133
-44
lines changed

2 files changed

+133
-44
lines changed
Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Composer\Script\Event;
77
use Symfony\Component\DependencyInjection\Container;
88

9-
class ReadMeUpdater
9+
class DocumentationUpdater
1010
{
1111
const SERVICES_TABLE_START = '<!-- BEGIN SERVICE TABLE -->';
1212
const SERVICES_TABLE_END = '<!-- END SERVICE TABLE -->';
@@ -15,21 +15,25 @@ class ReadMeUpdater
1515

1616
protected $projectRoot;
1717

18-
public static function updateReadMeFromComposer(Event $e)
18+
public static function updateFromComposer(Event $e)
1919
{
2020
$root = dirname($e->getComposer()->getConfig()->get('vendor-dir'));
2121

2222
require implode(DIRECTORY_SEPARATOR, [$root, 'vendor', 'autoload.php']);
2323

2424
(new static($root))
25-
->updateReadMe();
25+
->updateReadMe()
26+
->updateComposerJSON();
2627
}
2728

2829
public function __construct($projectRoot = '..')
2930
{
3031
$this->projectRoot = $projectRoot;
3132
}
3233

34+
/**
35+
* @return self
36+
*/
3337
public function updateReadMe()
3438
{
3539
$readMeParts = $this->getReadMeWithoutServicesTable();
@@ -43,6 +47,29 @@ public function updateReadMe()
4347
implode($servicesTable, $readMeParts)
4448
)
4549
);
50+
51+
return $this;
52+
}
53+
54+
/**
55+
* @return self
56+
*/
57+
public function updateComposerJSON()
58+
{
59+
$packageTags = ['aws', 'amazon', 'symfony', 'symfony2'];
60+
$jsonPath = $this->projectRoot . DIRECTORY_SEPARATOR . 'composer.json';
61+
$composerJson = json_decode(file_get_contents($jsonPath));
62+
63+
$composerJson->keywords = array_merge(
64+
$packageTags,
65+
array_map(function ($serviceId) {
66+
return preg_replace('/aws[\._]/', '', $serviceId);
67+
}, $this->getAWSServices($this->getContainer()))
68+
);
69+
70+
file_put_contents($jsonPath, json_encode($composerJson, JSON_PRETTY_PRINT));
71+
72+
return $this;
4673
}
4774

4875

@@ -57,7 +84,7 @@ private function getReadMeWithoutServicesTable()
5784

5885
private function getReadMePath()
5986
{
60-
return $this->projectRoot . '/README.md';
87+
return $this->projectRoot . DIRECTORY_SEPARATOR . 'README.md';
6188
}
6289

6390
private function getServicesTable()

composer.json

Lines changed: 102 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,104 @@
11
{
2-
"name": "aws/aws-sdk-php-symfony",
3-
"description": "A Symfony bundle for v3 of the AWS PHP SDK",
4-
"minimum-stability": "stable",
5-
"license": "Apache-2.0",
6-
"authors": [
7-
{
8-
"name": "Amazon Web Services",
9-
"homepage": "http://aws.amazon.com"
10-
}
11-
],
12-
"require": {
13-
"php": ">=5.5",
14-
"aws/aws-sdk-php": "^3.0.5",
15-
"symfony/config": "~2.3",
16-
"symfony/dependency-injection": "~2.3",
17-
"symfony/http-kernel": "~2.3"
18-
},
19-
"require-dev": {
20-
"phpunit/phpunit": "~4.7",
21-
"symfony/framework-bundle": "~2.3",
22-
"symfony/finder": "~2.3",
23-
"symfony/yaml": "~2.3",
24-
"squizlabs/php_codesniffer": "^2.3"
25-
},
26-
"autoload": {
27-
"psr-4": {
28-
"Aws\\Symfony\\": "src/"
29-
}
30-
},
31-
"autoload-dev": {
32-
"psr-4": {
33-
"Aws\\Symfony\\": ["build/", "tests/"]
2+
"name": "aws\/aws-sdk-php-symfony",
3+
"description": "A Symfony bundle for v3 of the AWS PHP SDK",
4+
"keywords": [
5+
"aws",
6+
"amazon",
7+
"symfony",
8+
"symfony2",
9+
"autoscaling",
10+
"cloudformation",
11+
"cloudfront",
12+
"cloudhsm",
13+
"cloudsearch",
14+
"cloudsearchdomain",
15+
"cloudtrail",
16+
"cloudwatch",
17+
"cloudwatchlogs",
18+
"codecommit",
19+
"codedeploy",
20+
"codepipeline",
21+
"cognitoidentity",
22+
"cognitosync",
23+
"configservice",
24+
"datapipeline",
25+
"devicefarm",
26+
"directconnect",
27+
"directoryservice",
28+
"dynamodb",
29+
"dynamodbstreams",
30+
"ec2",
31+
"ecs",
32+
"efs",
33+
"elasticache",
34+
"elasticbeanstalk",
35+
"elasticloadbalancing",
36+
"elastictranscoder",
37+
"emr",
38+
"glacier",
39+
"iam",
40+
"kinesis",
41+
"kms",
42+
"lambda",
43+
"machinelearning",
44+
"opsworks",
45+
"rds",
46+
"redshift",
47+
"route53",
48+
"route53domains",
49+
"s3",
50+
"ses",
51+
"sns",
52+
"sqs",
53+
"ssm",
54+
"storagegateway",
55+
"sts",
56+
"support",
57+
"swf",
58+
"workspaces",
59+
"sdk"
60+
],
61+
"minimum-stability": "stable",
62+
"license": "Apache-2.0",
63+
"authors": [
64+
{
65+
"name": "Amazon Web Services",
66+
"homepage": "http:\/\/aws.amazon.com"
67+
}
68+
],
69+
"require": {
70+
"php": ">=5.5",
71+
"aws\/aws-sdk-php": "^3.0.5",
72+
"symfony\/config": "~2.3",
73+
"symfony\/dependency-injection": "~2.3",
74+
"symfony\/http-kernel": "~2.3"
75+
},
76+
"require-dev": {
77+
"phpunit\/phpunit": "~4.7",
78+
"symfony\/framework-bundle": "~2.3",
79+
"symfony\/finder": "~2.3",
80+
"symfony\/yaml": "~2.3",
81+
"squizlabs\/php_codesniffer": "^2.3"
3482
},
35-
"classmap": ["tests/fixtures"]
36-
},
37-
"scripts": {
38-
"post-autoload-dump": [
39-
"Aws\\Symfony\\ReadMeUpdater::updateReadMeFromComposer"
40-
]
41-
}
42-
}
83+
"autoload": {
84+
"psr-4": {
85+
"Aws\\Symfony\\": "src\/"
86+
}
87+
},
88+
"autoload-dev": {
89+
"psr-4": {
90+
"Aws\\Symfony\\": [
91+
"build\/",
92+
"tests\/"
93+
]
94+
},
95+
"classmap": [
96+
"tests\/fixtures"
97+
]
98+
},
99+
"scripts": {
100+
"post-autoload-dump": [
101+
"Aws\\Symfony\\ReadMeUpdater::updateFromComposer"
102+
]
103+
}
104+
}

0 commit comments

Comments
 (0)