Просмотр исходного кода

Added Composer support

tags/v0.34.0
Ross Perkins 9 лет назад
Родитель
Сommit
2780ad7e77
3 измененных файлов: 43 добавлений и 0 удалений
  1. +5
    -0
      README.rst
  2. +34
    -0
      php/composer.sls
  3. +4
    -0
      php/map.jinja

+ 5
- 0
README.rst Просмотреть файл

@@ -40,6 +40,11 @@ Installs the php-cgi package.

Installs the php-cli package.

``php.composer``
-----------

Installs [composer](https://getcomposer.org) and keeps it updated.

``php.curl``
------------


+ 34
- 0
php/composer.sls Просмотреть файл

@@ -0,0 +1,34 @@
{% from "php/map.jinja" import php with context %}
{% set install_file = php.local_bin + '/composer' %}

include:
- php

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

# 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"
- unless: "WARNING_TIME=$(grep --text COMPOSER_DEV_WARNING_TIME {{ install_file }} | egrep '^\s*define' | sed -e 's,[^[:digit:]],,g'); php -r \"exit($WARNING_TIME > time() ? 0 : 1);\""
- cwd: {{ php.temp_dir }}
- require:
- cmd: get-composer

install-composer:
cmd.wait:
- name: install -m 0755 {{ php.temp_dir }}/composer.phar {{ install_file }}
- cwd: {{ php.temp_dir }}
- watch:
- cmd: get-composer

+ 4
- 0
php/map.jinja Просмотреть файл

@@ -31,6 +31,8 @@
'mongo_pecl': 'mongo',
'mongo_ext': 'mongo.so',
'ext_conf_path': '/etc/php5/mods-available',
'local_bin': '/usr/local/bin',
'temp_dir': '/tmp',
},
'RedHat': {
'php_pkg': 'php',
@@ -64,5 +66,7 @@
'mongo_pecl': 'mongo',
'mongo_ext': 'mongo.so',
'ext_conf_path': '/etc/php5/conf.d',
'local_bin': '/usr/local/bin',
'temp_dir': '/tmp',
},
}, merge=salt['pillar.get']('php:lookup')) %}

Загрузка…
Отмена
Сохранить