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.

37 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.run:
  16. - name: {{ php.temp_dir }}/installer --filename={{ php.composer_bin }} --install-dir={{ php.local_bin }}
  17. - unless: test -f {{ install_file }}
  18. - require:
  19. - file: get-composer
  20. # Get COMPOSER_DEV_WARNING_TIME from the installed composer, and if that time has passed
  21. # then it's time to run `composer selfupdate`
  22. #
  23. # It would be nice if composer had a command line switch to get this, but it doesn't,
  24. # and so we just grep for it.
  25. #
  26. update-composer:
  27. cmd.run:
  28. - name: "{{ install_file }} selfupdate"
  29. - unless: test $(grep --text COMPOSER_DEV_WARNING_TIME {{ install_file }} | egrep '^\s*define' | sed -e 's,[^[:digit:]],,g') \> $(php -r 'echo time();')
  30. - cwd: {{ php.local_bin }}
  31. - require:
  32. - cmd: install-composer