Last active
August 29, 2015 14:05
-
-
Save tomjn/772b12a1f393eca845c1 to your computer and use it in GitHub Desktop.
Revisions
-
tomjn revised this gist
Aug 15, 2014 . 2 changed files with 23 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ <?php // this file goes inside the src/cftp folder namespace cftp; use Composer\Script\Event; class composer_checker { public static function post(Event $event) { unlink('.composerrunning'); } public static function pre( Event $event ) { touch('.composerrunning'); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Here the composer file has a script that hooks into pre and post update/install commands. The logic is as follows: - Composer fires the pre method, which touches a file - Composer does its business - When finished, it fires the post method which removes the touched file If for some reason the file still exists, then something went wrong. Either composer is still running, or it ran and encountered a fatal error, e.g. missing package, no internet connection, version lock, etc. This can now be picked up by the PHP application by testing for the presence of the file. -
tomjn created this gist
Aug 15, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ { "require": { "justinrainsdasdfbow/json-schema": "~1.1" }, "scripts": { "post-update-cmd": "cftp\\composer_checker::post", "post-install-cmd": "cftp\\composer_checker::post", "pre-install-cmd": "cftp\\composer_checker::pre", "pre-update-cmd": "cftp\\composer_checker::pre" }, "autoload": { "psr-0": { "cftp": "src/" } } }