Skip to content

Commit

Permalink
Resolves acquia#219: Documenting committing dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Aug 10, 2016
1 parent 3f059ce commit 93a687a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 8 deletions.
1 change: 1 addition & 0 deletions phing/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ composer:
bin: ${repo.root}/vendor/bin

deploy:
build-dependencies: true
dir: ${repo.root}/deploy
exclude_file: ${blt.root}/phing/files/deploy-exclude.txt
gitignore_file: ${blt.root}/phing/files/.gitignore
Expand Down
27 changes: 19 additions & 8 deletions phing/tasks/deploy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,25 @@
</target>

<target name="deploy:composer:install" description="Downloads core and contrib to deploy folder.">
<delete dir="${deploy.dir}/vendor"/>
<copy todir="${deploy.dir}" overwrite="true">
<fileset dir="${repo.root}">
<include name="composer.json"/>
<include name="composer.lock"/>
</fileset>
</copy>
<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"/>
<if>
<equals arg1="build-dependencies" arg2="true"/>
<then>
<echo>Rebuilding composer dependencies without require-dev.</echo>
<delete dir="${deploy.dir}/vendor"/>
<copy todir="${deploy.dir}" overwrite="true">
<fileset dir="${repo.root}">
<include name="composer.json"/>
<include name="composer.lock"/>
</fileset>
</copy>
<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"/>
</then>
<else>
<echo>Dependencies will not be built because deploy.build-dependencies is not enabled.</echo>
<echo>You should define a custom deploy.exclude_file to ensure that dependecies are copied from the root repository.</echo>
</else>
</if>

</target>

<target name="deploy:copy" description="Copy required files from /docroot/sites to /deploy/docroot/sites.">
Expand Down
45 changes: 45 additions & 0 deletions readme/committing-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Committing Dependencies

Composer's official stance is that you should not commit dependencies.

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:

* Modify your project's `.gitignore` by removing the following lines:

docroot/core
docroot/modules/contrib
docroot/themes/contrib
docroot/profiles/contrib
docroot/libraries
drush/contrib
vendor

* Create a custom deploy.exclude_file and reference its location in your project.yml

mkdir blt/deploy && cp vendor/acquia/blt/scripts/files/deploy-exclude.txt blt/deploy/deploy-exclude.txt
deploy:
exclude_file: ${repo.root}/blt/deploy/deploy_exclude.txt

* Modify your custom deploy_exclude.txt file by removing the following lines:

/docroot/core
/docroot/libraries/contrib
/docroot/modules/contrib
/docroot/sites/*/files
/docroot/sites/*/private
/docroot/themes/contrib
/drush/contrib
/vendor

* Set `deploy.build-dependencies` to `false` in your `project.yml` file:

deploy:
build-dependencies: false

* Commit your changes and dependencies:

git add -A
git commit -m 'Committing dependencies.'

Your dependencies will now be committed to your repository and copied to your deployment artifact.

0 comments on commit 93a687a

Please sign in to comment.