Saltstack Official PHP Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1KB

  1. {% from "php/map.jinja" import php with context %}
  2. {% set install_file = php.local_bin + '/' + php.composer_bin %}
  3. include:
  4. - php
  5. get-composer:
  6. file.managed:
  7. - name: {{ php.temp_dir }}/installer
  8. - mode: 0755
  9. - unless: test -f {{ install_file }}
  10. - source: https://getcomposer.org/installer
  11. - source_hash: {{ php.composer_hash }}
  12. - require:
  13. - pkg: php
  14. install-composer:
  15. cmd.wait:
  16. - name: {{ php.temp_dir }}/installer --filename={{ php.composer_bin }} --install-dir={{ php.local_bin }}
  17. - watch:
  18. - file: get-composer
  19. # Get COMPOSER_DEV_WARNING_TIME from the installed composer, and if that time has passed
  20. # then it's time to run `composer selfupdate`
  21. #
  22. # It would be nice if composer had a command line switch to get this, but it doesn't,
  23. # and so we just grep for it.
  24. #
  25. update-composer:
  26. cmd.run:
  27. - name: "{{ install_file }} selfupdate"
  28. - unless: test $(grep --text COMPOSER_DEV_WARNING_TIME {{ install_file }} | egrep '^\s*define' | sed -e 's,[^[:digit:]],,g') \> $(php -r 'echo time();')
  29. - cwd: {{ php.local_bin }}
  30. - require:
  31. - cmd: install-composer