@@ -28,6 +28,7 @@ Options:
28
28
-v, --verbose Enable verbose output
29
29
-vv Enable debug output
30
30
-s, --silent Silence output
31
+ --composer Enable Composer registry
31
32
--pip Enable PIP registry
32
33
--deb Enable Debian registry
33
34
-k, --keep Keep temporary files
@@ -60,6 +61,10 @@ while [[ $# -gt 0 ]]; do
60
61
LOGLEVEL=$LOGLEVEL_WARN
61
62
shift
62
63
;;
64
+ --composer)
65
+ REGISTRIES+=(" composer" )
66
+ shift
67
+ ;;
63
68
--pip)
64
69
REGISTRIES+=(" pip" )
65
70
shift
@@ -362,6 +367,38 @@ function teardown_deb {
362
367
rm -rf " $ROOT /etc/apt/sources.list.d/$CLOUDSMITH_ORG -$CLOUDSMITH_REPO .list"
363
368
}
364
369
370
+ # ###############################
371
+ # PHP Composer
372
+ # ###############################
373
+
374
+ function setup_composer {
375
+ local auth_file=" $ROOT$HOME /.config/composer/auth.json"
376
+ if [ -f " $auth_file " ]; then
377
+ mv " $auth_file " " $auth_file .bak"
378
+ fi
379
+
380
+ mkdir -p " $( dirname " $auth_file " ) "
381
+
382
+ cat > " $auth_file " << EOF
383
+ {
384
+ "http-basic": {
385
+ "dl.cloudsmith.io": {
386
+ "username": "$CLOUDSMITH_USER ",
387
+ "password": "$CLOUDSMITH_PASSWORD "
388
+ }
389
+ }
390
+ }
391
+ EOF
392
+ }
393
+
394
+ function teardown_composer {
395
+ local auth_file=" $ROOT$HOME /.config/composer/auth.json"
396
+ rm -rf " $auth_file "
397
+ if [ -f " $auth_file .bak" ]; then
398
+ mv " $auth_file .bak" " $auth_file "
399
+ fi
400
+ }
401
+
365
402
# ###############################
366
403
# Python PIP
367
404
# ###############################
@@ -394,6 +431,7 @@ function teardown_pip {
394
431
function setup {
395
432
load_creds
396
433
if have_creds; then
434
+ if registry_enabled composer; then setup_composer; fi
397
435
if registry_enabled deb; then setup_deb; fi
398
436
if registry_enabled pip; then setup_pip; fi
399
437
else
@@ -402,6 +440,7 @@ function setup {
402
440
}
403
441
404
442
function cleanup {
443
+ if registry_enabled composer; then teardown_composer; fi
405
444
if registry_enabled pip; then teardown_pip; fi
406
445
if registry_enabled deb; then teardown_deb; fi
407
446
}
0 commit comments