2015-02-20 11:12:19 +01:00
|
|
|
{% from "php/map.jinja" import php with context %}
|
2015-07-20 01:00:44 +02:00
|
|
|
{% set install_file = php.local_bin + '/' + php.composer_bin %}
|
2015-02-20 11:12:19 +01:00
|
|
|
|
|
|
|
include:
|
|
|
|
- php
|
|
|
|
|
|
|
|
get-composer:
|
2015-07-20 01:00:44 +02:00
|
|
|
file.managed:
|
|
|
|
- name: {{ php.temp_dir }}/installer
|
|
|
|
- mode: 0755
|
2015-02-20 11:12:19 +01:00
|
|
|
- unless: test -f {{ install_file }}
|
2015-07-20 01:00:44 +02:00
|
|
|
- source: https://getcomposer.org/installer
|
|
|
|
- source_hash: {{ php.composer_hash }}
|
2015-02-20 11:12:19 +01:00
|
|
|
- require:
|
|
|
|
- pkg: php
|
|
|
|
|
2015-03-06 11:56:35 +01:00
|
|
|
install-composer:
|
2015-09-28 19:39:20 +02:00
|
|
|
cmd.run:
|
2016-02-29 18:08:55 +01:00
|
|
|
- name: php {{ php.temp_dir }}/installer --filename={{ php.composer_bin }} --install-dir={{ php.local_bin }}
|
2015-09-28 19:39:20 +02:00
|
|
|
- unless: test -f {{ install_file }}
|
|
|
|
- require:
|
2015-07-20 01:00:44 +02:00
|
|
|
- file: get-composer
|
2015-03-06 11:56:35 +01:00
|
|
|
|
2015-02-20 11:12:19 +01:00
|
|
|
# Get COMPOSER_DEV_WARNING_TIME from the installed composer, and if that time has passed
|
|
|
|
# then it's time to run `composer selfupdate`
|
|
|
|
#
|
|
|
|
# It would be nice if composer had a command line switch to get this, but it doesn't,
|
|
|
|
# and so we just grep for it.
|
|
|
|
#
|
|
|
|
update-composer:
|
|
|
|
cmd.run:
|
|
|
|
- name: "{{ install_file }} selfupdate"
|
2015-02-21 12:43:51 +01:00
|
|
|
- unless: test $(grep --text COMPOSER_DEV_WARNING_TIME {{ install_file }} | egrep '^\s*define' | sed -e 's,[^[:digit:]],,g') \> $(php -r 'echo time();')
|
2015-07-20 01:00:44 +02:00
|
|
|
- cwd: {{ php.local_bin }}
|
2015-02-20 11:12:19 +01:00
|
|
|
- require:
|
2015-03-06 11:56:35 +01:00
|
|
|
- cmd: install-composer
|