|
| 1 | +<project name="simplesamlphp" default="simplesamlphp:init"> |
| 2 | + |
| 3 | + <target name="simplesamlphp:init" description="Initializes SimpleSAMLphp for project."> |
| 4 | + |
| 5 | + <!-- Adds simplesamlphp_auth as a dependency. --> |
| 6 | + <available property="simplesamlphp" file="${blt.root}/settings/simplesamlphp.settings.php"/> |
| 7 | + |
| 8 | + <if> |
| 9 | + <not><equals arg1="${simplesamlphp}" arg2="true"/></not> |
| 10 | + <then> |
| 11 | + <phingcall target="simplesamlphp:lib:init"/> |
| 12 | + |
| 13 | + <!-- Copies the configuration templates from the library to a simplesamlphp directory located in the project root. --> |
| 14 | + <phingcall target="simplesamlphp:config:init"/> |
| 15 | + |
| 16 | + <!-- Copies a settings file used by the simplesamlphp_auth module to blt's settings dir. --> |
| 17 | + <phingcall target="simplesamlphp:settings"/> |
| 18 | + |
| 19 | + <!-- Creates a symlink from the docroot to the web accessible library dir. --> |
| 20 | + <echo>Creating a symbolic link from ${docroot}/simplesaml to web accessible directory in the simplesamlphp library</echo> |
| 21 | + <symlink target="../vendor/simplesamlphp/simplesamlphp/www/" link="${docroot}/simplesaml" overwrite="true" /> |
| 22 | + |
| 23 | + <!-- Outputs a message to edit the new config files. --> |
| 24 | + <phingcall target="simplesamlphp:init:complete"/> |
| 25 | + </then> |
| 26 | + <else> |
| 27 | + <echo>SimpleSAMLphp has already been initialized by BLT.</echo> |
| 28 | + </else> |
| 29 | + </if> |
| 30 | + </target> |
| 31 | + |
| 32 | + <!-- Adds simplesamlphp_auth as a dependency. --> |
| 33 | + <target name="simplesamlphp:lib:init" hidden="true"> |
| 34 | + <echo>Adding SimpleSAMLphp Auth module as a dependency.</echo> |
| 35 | + <exec dir="${repo.root}" command="composer require drupal/simplesamlphp_auth:8.3.x-dev#283994f" logoutput="true" checkreturn="true" passthru="true" level="info"/> |
| 36 | + </target> |
| 37 | + |
| 38 | + <!-- Copies the configuration templates from the library to a simplesamlphp directory located in the project root. --> |
| 39 | + <target name="simplesamlphp:config:init" hidden="true"> |
| 40 | + <echo>Copying config files to ${repo.root}/simplesamlphp/config.</echo> |
| 41 | + <copy todir="${repo.root}/simplesamlphp/config" overwrite="false"> |
| 42 | + <filelist dir="${repo.root}/vendor/simplesamlphp/simplesamlphp/config-templates" files="authsources.php, config.php"/> |
| 43 | + </copy> |
| 44 | + <exec dir="${repo.root}/simplesamlphp/config" command="curl https://gist.githubusercontent.com/acquialibrary/8059715/raw/a6dc376bfb5068a2c7fe01be315d13bd47d4c10b/9191_config.php > acquia_config.php" passthru="true"/> |
| 45 | + <append destFile="${repo.root}/simplesamlphp/config/config.php" file="${repo.root}/simplesamlphp/config/acquia_config.php"> |
| 46 | + <filterchain> |
| 47 | + <replaceregexp> |
| 48 | + <regexp pattern=".*php\n" replace="" ignoreCase="true"/> |
| 49 | + </replaceregexp> |
| 50 | + </filterchain> |
| 51 | + </append> |
| 52 | + <echo>Copying config files to ${repo.root}/simplesamlphp/metadata.</echo> |
| 53 | + <copy todir="${repo.root}/simplesamlphp/metadata" file="${repo.root}/vendor/simplesamlphp/simplesamlphp/metadata-templates/saml20-idp-remote.php" overwrite="false"/> |
| 54 | + </target> |
| 55 | + |
| 56 | + <!-- Copies a settings file used by simplesamlphp_auth to blt settings dir. --> |
| 57 | + <target name="simplesamlphp:settings" hidden="true"> |
| 58 | + <echo>Adding a simplesamlphp.settings.php file.</echo> |
| 59 | + <copy file="${blt.root}/scripts/simplesamlphp/simplesamlphp.settings.php" tofile="${blt.root}/settings/simplesamlphp.settings.php" overwrite="false"/> |
| 60 | + </target> |
| 61 | + |
| 62 | + <!-- Copies customized config files into the library on deployments. --> |
| 63 | + <target name="simplesamlphp:deploy:config" description="Copies config template files to the appropriate place in simplesamlphp library." hidden="true"> |
| 64 | + <echo>Copying config files to the appropriate place in simplesamlphp library in the deploy artifact.</echo> |
| 65 | + <copy todir="${repo.root}/deploy/vendor/simplesamlphp/simplesamlphp" overwrite="true"> |
| 66 | + <fileset dir="${repo.root}/simplesamlphp/" /> |
| 67 | + </copy> |
| 68 | + <copy file="${blt.root}/scripts/simplesamlphp/gitignore.txt" tofile="${repo.root}/deploy/vendor/simplesamlphp/simplesamlphp/.gitignore" overwrite="true"/> |
| 69 | + </target> |
| 70 | + |
| 71 | + <!-- Copies customized config files into the library on builds. --> |
| 72 | + <target name="simplesamlphp:build:config" description="Copies config template files to the appropriate place in simplesamlphp library."> |
| 73 | + <echo>Copying config files to the appropriate place in simplesamlphp library.</echo> |
| 74 | + <copy todir="${repo.root}/vendor/simplesamlphp/simplesamlphp" overwrite="true"> |
| 75 | + <fileset dir="${repo.root}/simplesamlphp/" /> |
| 76 | + </copy> |
| 77 | + <copy file="${blt.root}/scripts/simplesamlphp/gitignore.txt" tofile="${repo.root}/vendor/simplesamlphp/simplesamlphp/.gitignore" overwrite="true"/> |
| 78 | + </target> |
| 79 | + |
| 80 | + <!-- Outputs a message to edit the new config files. --> |
| 81 | + <target name="simplesamlphp:init:complete" hidden="true"> |
| 82 | + <echo> |
| 83 | + |
| 84 | + |
| 85 | + ============================================================================ |
| 86 | + To complete the setup you must manually modify several files. |
| 87 | + ============================================================================ |
| 88 | + |
| 89 | + * ${docroot}/.htaccess |
| 90 | + * ${repo.root}/simplesamlphp/config/config.php |
| 91 | + * ${repo.root}/simplesamlphp/config/authsources.php |
| 92 | + * ${repo.root}/simplesamlphp/metadata/saml20-idp-remote.php |
| 93 | + |
| 94 | + |
| 95 | + After editting these files execute the following command to copy the |
| 96 | + modified files to the correct location in the SimpleSAMLphp library |
| 97 | + |
| 98 | + 'blt simplesamlphp:build:config' |
| 99 | + |
| 100 | + ============================================================================ |
| 101 | + See simplesamlphp-setup.md for details on how to modify the files. |
| 102 | + ============================================================================ |
| 103 | + |
| 104 | + |
| 105 | + </echo> |
| 106 | + </target> |
| 107 | + |
| 108 | +</project> |
0 commit comments