Skip to content
This repository has been archived by the owner on Mar 13, 2019. It is now read-only.

Persistent mode with config watching #27

Closed
andreyantipov opened this issue Nov 3, 2015 · 3 comments
Closed

Persistent mode with config watching #27

andreyantipov opened this issue Nov 3, 2015 · 3 comments

Comments

@andreyantipov
Copy link

Hello. I'd like propose idea about persistent mode whenever something like gulp will watch that composer config has changed, and composer will re-update vendor components. It's useful for development stage.

@andreyantipov
Copy link
Author

Workaround example with shell script and composer hooks without queue.

composer.json

{
  "scripts":
  {
    "post-install-cmd":
    [
      "/scripts/composer-watch-update.sh _COMPOSER_JSON_CONFIG_PATH_"
    ]
  },
  "config":
  {
    "process-timeout": 0,
  },

composer-watch-update.sh

#!/bin/bash

FILE="$1"
CMD="$2"
DIR=$(dirname "${FILE}")

LAST=`ls -l "$FILE"`
while true; do
  sleep 1
  NEW=`ls -l "$FILE"`
  if [ "$NEW" != "$LAST" ]; then
    cd $DIR
    composer update
    LAST="$NEW"
  fi
done

docker-compose.yml

application:
  image: busybox
  volumes:
    - ./scripts/:/scripts/:ro
    - ./tmp/development/payload/:/app/
    - ./config/development/composer.json:/app/composer.json:ro
  command: "true"
payload:
  image: composer/composer
  command: 'install'
  volumes_from:
    - application

@RobLoach
Copy link
Owner

RobLoach commented Nov 4, 2015

Oh, very interesting. Does Composer natively have something along these lines? composer watch --something

@andreyantipov
Copy link
Author

Hello! :)
No, there is no native feature like that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants