Skip to content

Commit 662f31d

Browse files
committed
Resolves acquia#219: Documenting committing dependencies.
1 parent 3f059ce commit 662f31d

File tree

3 files changed

+65
-8
lines changed

3 files changed

+65
-8
lines changed

phing/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ composer:
1818
bin: ${repo.root}/vendor/bin
1919

2020
deploy:
21+
build-dependencies: true
2122
dir: ${repo.root}/deploy
2223
exclude_file: ${blt.root}/phing/files/deploy-exclude.txt
2324
gitignore_file: ${blt.root}/phing/files/.gitignore

phing/tasks/deploy.xml

+19-8
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,25 @@
8787
</target>
8888

8989
<target name="deploy:composer:install" description="Downloads core and contrib to deploy folder.">
90-
<delete dir="${deploy.dir}/vendor"/>
91-
<copy todir="${deploy.dir}" overwrite="true">
92-
<fileset dir="${repo.root}">
93-
<include name="composer.json"/>
94-
<include name="composer.lock"/>
95-
</fileset>
96-
</copy>
97-
<exec dir="${deploy.dir}" command="export COMPOSER_EXIT_ON_PATCH_FAILURE=1; composer install --no-dev --prefer-dist --no-interaction" passthru="true" logoutput="true" checkreturn="true"/>
90+
<if>
91+
<equals arg1="${deploy.build-dependencies}" arg2="true"/>
92+
<then>
93+
<echo>Rebuilding composer dependencies without require-dev.</echo>
94+
<delete dir="${deploy.dir}/vendor"/>
95+
<copy todir="${deploy.dir}" overwrite="true">
96+
<fileset dir="${repo.root}">
97+
<include name="composer.json"/>
98+
<include name="composer.lock"/>
99+
</fileset>
100+
</copy>
101+
<exec dir="${deploy.dir}" command="export COMPOSER_EXIT_ON_PATCH_FAILURE=1; composer install --no-dev --prefer-dist --no-interaction" passthru="true" logoutput="true" checkreturn="true"/>
102+
</then>
103+
<else>
104+
<echo>Dependencies will not be built because deploy.build-dependencies is not enabled.</echo>
105+
<echo>You should define a custom deploy.exclude_file to ensure that dependecies are copied from the root repository.</echo>
106+
</else>
107+
</if>
108+
98109
</target>
99110

100111
<target name="deploy:copy" description="Copy required files from /docroot/sites to /deploy/docroot/sites.">

readme/committing-dependencies.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Committing Dependencies
2+
3+
Composer's official stance is that you should not commit dependencies.
4+
5+
However, there are sometimes extenuating circumstances that require you to commit your dependencies. In this case, you can commit your dependencies by following these steps:
6+
7+
* Modify your project's `.gitignore` by removing the following lines:
8+
9+
docroot/core
10+
docroot/modules/contrib
11+
docroot/themes/contrib
12+
docroot/profiles/contrib
13+
docroot/libraries
14+
drush/contrib
15+
vendor
16+
17+
* Create a custom deploy.exclude_file and reference its location in your project.yml
18+
19+
mkdir blt/deploy && cp vendor/acquia/blt/scripts/files/deploy-exclude.txt blt/deploy/deploy-exclude.txt
20+
21+
deploy:
22+
exclude_file: ${repo.root}/blt/deploy/deploy_exclude.txt
23+
24+
* Modify your custom deploy_exclude.txt file by removing the following lines:
25+
26+
/docroot/core
27+
/docroot/libraries/contrib
28+
/docroot/modules/contrib
29+
/docroot/sites/*/files
30+
/docroot/sites/*/private
31+
/docroot/themes/contrib
32+
/drush/contrib
33+
/vendor
34+
35+
* Set `deploy.build-dependencies` to `false` in your `project.yml` file:
36+
37+
deploy:
38+
build-dependencies: false
39+
40+
* Commit your changes and dependencies:
41+
42+
git add -A
43+
git commit -m 'Committing dependencies.'
44+
45+
Your dependencies will now be committed to your repository and copied to your deployment artifact.

0 commit comments

Comments
 (0)