Browse Source

Merge pull request #54 from haydenk/master

Update Composer state file to not use curl
tags/v0.34.0
Nitin Madhok 9 years ago
parent
commit
9f84c9944f
2 changed files with 15 additions and 8 deletions
  1. +9
    -8
      php/composer.sls
  2. +6
    -0
      php/map.jinja

+ 9
- 8
php/composer.sls View File

{% from "php/map.jinja" import php with context %} {% from "php/map.jinja" import php with context %}
{% set install_file = php.local_bin + '/composer' %}
{% set install_file = php.local_bin + '/' + php.composer_bin %}


include: include:
- php - php


get-composer: get-composer:
cmd.run:
- name: 'CURL=`which curl`; $CURL -sS https://getcomposer.org/installer | php'
file.managed:
- name: {{ php.temp_dir }}/installer
- mode: 0755
- unless: test -f {{ install_file }} - unless: test -f {{ install_file }}
- cwd: {{ php.temp_dir }}
- source: https://getcomposer.org/installer
- source_hash: {{ php.composer_hash }}
- require: - require:
- pkg: php - pkg: php


install-composer: install-composer:
cmd.wait: cmd.wait:
- name: mv {{ php.temp_dir }}/composer.phar {{ install_file }}
- cwd: {{ php.temp_dir }}
- name: {{ php.temp_dir }}/installer --filename={{ php.composer_bin }} --install-dir={{ php.local_bin }}
- watch: - watch:
- cmd: get-composer
- file: get-composer


# Get COMPOSER_DEV_WARNING_TIME from the installed composer, and if that time has passed # Get COMPOSER_DEV_WARNING_TIME from the installed composer, and if that time has passed
# then it's time to run `composer selfupdate` # then it's time to run `composer selfupdate`
cmd.run: cmd.run:
- name: "{{ install_file }} selfupdate" - name: "{{ install_file }} selfupdate"
- unless: test $(grep --text COMPOSER_DEV_WARNING_TIME {{ install_file }} | egrep '^\s*define' | sed -e 's,[^[:digit:]],,g') \> $(php -r 'echo time();') - unless: test $(grep --text COMPOSER_DEV_WARNING_TIME {{ install_file }} | egrep '^\s*define' | sed -e 's,[^[:digit:]],,g') \> $(php -r 'echo time();')
- cwd: {{ php.temp_dir }}
- cwd: {{ php.local_bin }}
- require: - require:
- cmd: install-composer - cmd: install-composer

+ 6
- 0
php/map.jinja View File

'ext_conf_path': '/etc/php5/mods-available', 'ext_conf_path': '/etc/php5/mods-available',
'local_bin': '/usr/local/bin', 'local_bin': '/usr/local/bin',
'temp_dir': '/tmp', 'temp_dir': '/tmp',
'composer_bin': 'composer',
'composer_hash': 'sha256=6a1ba6495f0bdb8e7735a7a76948b61c54b4a57b56837a9e9f93b4a0ac1f83a5',
}, },
'RedHat': { 'RedHat': {
'php_pkg': 'php', 'php_pkg': 'php',
'ext_conf_path': '/etc/php5/conf.d', 'ext_conf_path': '/etc/php5/conf.d',
'local_bin': '/usr/local/bin', 'local_bin': '/usr/local/bin',
'temp_dir': '/tmp', 'temp_dir': '/tmp',
'composer_bin': 'composer',
'composer_hash': 'sha256=6a1ba6495f0bdb8e7735a7a76948b61c54b4a57b56837a9e9f93b4a0ac1f83a5',
}, },
'Suse': { 'Suse': {
'php_pkg': 'php5', 'php_pkg': 'php5',
'ext_conf_path': '/etc/php5/conf.d', 'ext_conf_path': '/etc/php5/conf.d',
'local_bin': '/usr/local/bin', 'local_bin': '/usr/local/bin',
'temp_dir': '/tmp', 'temp_dir': '/tmp',
'composer_bin': 'composer',
'composer_hash': 'sha256=6a1ba6495f0bdb8e7735a7a76948b61c54b4a57b56837a9e9f93b4a0ac1f83a5',
}, },
}, merge=salt['pillar.get']('php:lookup')) %} }, merge=salt['pillar.get']('php:lookup')) %}

Loading…
Cancel
Save