Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 215ecd0

Browse files
committed
Resolves #219: Documenting committing dependencies.
1 parent adf7c6d commit 215ecd0

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
@@ -89,14 +89,25 @@
8989
</target>
9090

9191
<target name="deploy:composer:install" description="Downloads core and contrib to deploy folder.">
92-
<delete dir="${deploy.dir}/vendor"/>
93-
<copy todir="${deploy.dir}" overwrite="true">
94-
<fileset dir="${repo.root}">
95-
<include name="composer.json"/>
96-
<include name="composer.lock"/>
97-
</fileset>
98-
</copy>
99-
<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"/>
92+
<if>
93+
<equals arg1="build-dependencies" arg2="true"/>
94+
<then>
95+
<echo>Rebuilding composer dependencies without require-dev.</echo>
96+
<delete dir="${deploy.dir}/vendor"/>
97+
<copy todir="${deploy.dir}" overwrite="true">
98+
<fileset dir="${repo.root}">
99+
<include name="composer.json"/>
100+
<include name="composer.lock"/>
101+
</fileset>
102+
</copy>
103+
<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"/>
104+
</then>
105+
<else>
106+
<echo>Dependencies will not be built because deploy.build-dependencies is not enabled.</echo>
107+
<echo>You should define a custom deploy.exclude_file to ensure that dependecies are copied from the root repository.</echo>
108+
</else>
109+
</if>
110+
100111
</target>
101112

102113
<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)