Skip to content

Commit 886c2ec

Browse files
committed
Merge pull request #13 from drupal-composer/cleanup-readme
Fixes JSON formatting in README.md
2 parents 8832093 + 91154cc commit 886c2ec

File tree

1 file changed

+82
-71
lines changed

1 file changed

+82
-71
lines changed

README.md

Lines changed: 82 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A Drupal project usually consists of the following:
1919
* Perhaps even some PHP libraries found on GitHub
2020
* Custom code written by you and your team mates
2121

22-
The most popular approach to assembling these parts is using [Drush Make](http://drush.ws/docs/make.txt).
22+
The most popular approach to assembling these parts is using [Drush Make](http://drush.ws/docs/make.txt).
2323

2424
Meanwhile the PHP Community has gathered around another dependency manager, [Composer](https://getcomposer.org/). It is even used for [managing dependencies for Drupal 8 Core](https://drupal.org/node/1764330).
2525

@@ -51,34 +51,36 @@ The core version of Drupal to be used with the project is specified using the [C
5151

5252
Adding the following package to the `repositories` and `requires` sections will download Drupal 7.28 to the root of the Composer project:
5353

54-
```json
55-
"repositories": [
56-
{
57-
"type": "package",
58-
"package": {
59-
"name": "drupal/drupal",
60-
"type": "non-destructive-archive-installer",
61-
"version": "7.28",
62-
"dist": {
63-
"url": "http://ftp.drupal.org/files/projects/drupal-7.28.zip",
64-
"type": "zip"
65-
},
66-
"require": {
67-
"azt3k/non-destructive-archive-installer" : "*"
68-
},
69-
"extra": {
70-
"target-dir": ".",
71-
"omit-first-directory": "true"
72-
},
73-
"replace": {
74-
}
75-
}
76-
}
77-
],
78-
"require": {
79-
"azt3k/non-destructive-archive-installer" : "0.2.*",
80-
"drupal/drupal": "7.*",
81-
}
54+
```json
55+
{
56+
"repositories": [
57+
{
58+
"type": "package",
59+
"package": {
60+
"name": "drupal/drupal",
61+
"type": "non-destructive-archive-installer",
62+
"version": "7.28",
63+
"dist": {
64+
"url": "http://ftp.drupal.org/files/projects/drupal-7.28.zip",
65+
"type": "zip"
66+
},
67+
"require": {
68+
"azt3k/non-destructive-archive-installer" : "*"
69+
},
70+
"extra": {
71+
"target-dir": ".",
72+
"omit-first-directory": "true"
73+
},
74+
"replace": {
75+
}
76+
}
77+
}
78+
],
79+
"require": {
80+
"azt3k/non-destructive-archive-installer" : "0.2.*",
81+
"drupal/drupal": "7.*"
82+
}
83+
}
8284
```
8385

8486
Using Composer to manage Drupal projects has so far been tested with Drupal 7 projects. It may or may not work for Drupal 6 and 8.
@@ -99,10 +101,12 @@ All Drupal projects to be retrieved should be added as dependencies in the forma
99101
The following will download the [Chaos tool suite (ctools)](https://drupal.org/project/ctools) module version 1.4 for Drupal 7.
100102

101103

102-
```json
103-
"require": {
104-
"drupal/ctools": "7.1.4",
105-
}
104+
```json
105+
{
106+
"require": {
107+
"drupal/ctools": "7.1.4"
108+
}
109+
}
106110
```
107111

108112
The module will be placed under `sites/all/modules/contrib/`.
@@ -114,12 +118,14 @@ You can also run `php composer.phar require drupal/ctools` from the command line
114118
Drupal projects are normally not available from the default Composer package repository Packagist. In order to for this to work a custom repository must be added:
115119

116120
```json
117-
"repositories": [
118-
{
119-
"type": "composer",
120-
"url": "http://packagist.drupal-composer.org"
121-
}
122-
]
121+
{
122+
"repositories": [
123+
{
124+
"type": "composer",
125+
"url": "http://packagist.drupal-composer.org"
126+
}
127+
]
128+
}
123129
```
124130

125131
This repository is generated using the [drupal-parse-composer project](https://github.com/drupal-composer/drupal-parse-composer).
@@ -133,16 +139,18 @@ You specify the version of each project using [Composer package version constrai
133139

134140
In this example the following releases of Drupal 7 modules will be downloaded:
135141

136-
* Latest stable minor release of Chaos tool suite 1.x
142+
* Latest stable minor release of Chaos tool suite 1.x
137143
* Latest stable release of Features
138144
* Latest development release of Views 3.x
139145

140-
```json
141-
"require": {
142-
"drupal/ctools": "7.1.*",
143-
"drupal/features": "7.*"
144-
"drupal/views": "7.3-dev",
145-
}
146+
```json
147+
{
148+
"require": {
149+
"drupal/ctools": "7.1.*",
150+
"drupal/features": "7.*",
151+
"drupal/views": "7.3-dev"
152+
}
153+
}
146154
```
147155

148156
#### Patch
@@ -154,6 +162,7 @@ To apply a patch to a project a `patches` section must be added to the `extras`
154162
The following will patch the Chaos tool suite version 7.1.4 with [this patch](https://drupal.org/files/issues/ctools-deleted-not-needed-element-from-array-in-node-plugin.patch):
155163

156164
```json
165+
{
157166
"repositories": [
158167
{
159168
"type": "package",
@@ -180,9 +189,10 @@ The following will patch the Chaos tool suite version 7.1.4 with [this patch](ht
180189
}
181190
],
182191
"require": {
183-
"netresearch/composer-patches-plugin": "~1.0"
192+
"netresearch/composer-patches-plugin": "~1.0",
184193
"reload/drupal-composer-project-patches": "*"
185194
}
195+
}
186196
```
187197

188198
The important parts about a package containing patches are:
@@ -206,12 +216,14 @@ The plugin does not generate a `PATCHES.txt` file for each patched project as Dr
206216
The location of projects can be changed in the `installer-paths` section of `composer.json` either by individual project or by type.
207217

208218
```json
209-
"extra": {
210-
"installer-paths": {
211-
"sites/all/modules/contrib/{$name}/": ["type:drupal-module"],
212-
"sites/all/themes/{$name}/": ["drupal/zen"]
213-
}
219+
{
220+
"extra": {
221+
"installer-paths": {
222+
"sites/all/modules/contrib/{$name}/": ["type:drupal-module"],
223+
"sites/all/themes/{$name}/": ["drupal/zen"]
214224
}
225+
}
226+
}
215227
```
216228

217229
Custom location of packages are handled by [the Composer Installers project](https://github.com/composer/installers).
@@ -264,26 +276,26 @@ Example downloading jQuery UI 1.10.4:
264276

265277
```json
266278
{
267-
"repositories": [
268-
{
269-
"type": "package",
270-
"package": {
271-
"name": "jquery/jqueryui",
272-
"version": "1.10.4",
273-
"type": "drupal-library",
274-
"dist": {
275-
"url": "http://jqueryui.com/resources/download/jquery-ui-1.10.4.zip",
276-
"type": "zip"
277-
},
278-
"require": {
279-
"composer/installers": "~1.0",
280-
}
281-
}
279+
"repositories": [
280+
{
281+
"type": "package",
282+
"package": {
283+
"name": "jquery/jqueryui",
284+
"version": "1.10.4",
285+
"type": "drupal-library",
286+
"dist": {
287+
"url": "http://jqueryui.com/resources/download/jquery-ui-1.10.4.zip",
288+
"type": "zip"
289+
},
290+
"require": {
291+
"composer/installers": "~1.0"
282292
}
283-
],
284-
"require": {
285-
"jquery/jquery.ui": "1.10.4",
293+
}
286294
}
295+
],
296+
"require": {
297+
"jquery/jquery.ui": "1.10.4"
298+
}
287299
}
288300
```
289301

@@ -357,4 +369,3 @@ Using Composer to manage a Drupal project would not be possible without the work
357369
* [Non-destructive archive installer](https://github.com/azt3k/non-destructive-archive-installer) used to install Drupal Core.
358370
* [Composer installers](https://github.com/composer/installers) used to specify custom location of packages.
359371
* [Netresearch patches plugin](https://github.com/netresearch/composer-patches-plugin) for applying patches to Composer projects.
360-

0 commit comments

Comments
 (0)