Guest User

Untitled

a guest
Oct 16th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. add_composer_repository () {
  3. name=$1
  4. type=$2
  5. url=$3
  6. echo "adding composer repository ${url}"
  7. ${composer} config ${composerParams} repositories.${name} ${type} ${url}
  8. }
  9.  
  10. add_venia_sample_data_repository () {
  11. name=$1
  12. add_composer_repository ${name} github "${githubBaseUrl}/${name}.git"
  13. }
  14.  
  15. execute_install () {
  16. composer='/usr/bin/env composer'
  17. composerParams='--no-interaction --ansi'
  18. moduleVendor='magento'
  19. moduleList=(
  20. module-catalog-sample-data-venia
  21. module-configurable-sample-data-venia
  22. module-customer-sample-data-venia
  23. module-sales-sample-data-venia
  24. module-tax-sample-data-venia
  25. sample-data-media-venia
  26. )
  27. githubBaseUrl='git@github.com:PMET-public'
  28.  
  29. cd $install_path
  30.  
  31. for moduleName in "${moduleList[@]}"
  32. do
  33. add_venia_sample_data_repository ${moduleName}
  34. done
  35.  
  36. ${composer} require ${composerParams} $(printf "${moduleVendor}/%s:dev-master@dev " "${moduleList[@]}")
  37. }
  38.  
  39.  
  40. skip_interactive=0
  41. install_path=./
  42.  
  43. while test $# -gt 0; do
  44. case "$1" in
  45. --help)
  46. echo "Magento 2 Venia Sample data script install."
  47. echo "if no options are passed, it will start interactive mode and ask for your Magento absolute path"
  48. echo ""
  49. echo "Usage:"
  50. echo " deployVeniaSampleData.sh [options]"
  51. echo "Options:"
  52. echo " --help Displays this!"
  53. echo " --yes Skip interactive mode and installs data"
  54. echo " --path your Magento 2 absolute path, otherwise will install in current directory."
  55. echo ""
  56.  
  57. exit 0
  58. ;;
  59. --yes) skip_interactive=1
  60. shift
  61. ;;
  62. --path*) if test $# -gt 0; then
  63. install_path=`echo $1 | sed -e 's/^[^=]*=//g'`
  64. fi
  65. shift
  66. ;;
  67. *) break
  68. ;;
  69. esac
  70.  
  71. done
  72.  
  73.  
  74. if [ "$skip_interactive" == 1 ]; then
  75. echo "Skipping interactive mode.."
  76. echo "Install path ${install_path}"
  77. execute_install
  78. else
  79. echo "Please specify absolute path to your Magento 2 instance"
  80. read -p 'Magento root folder: ' install_path
  81.  
  82. echo "Sample data will be installed there."
  83. echo ""
  84. read -p "Are you sure you want to continue? [y/n]" yn
  85.  
  86. case $yn in
  87. y )
  88. execute_install
  89. ;;
  90. n )
  91. echo "Sample Data instalation failed."
  92. exit 0
  93. ;;
  94. * )
  95. echo "Exiting..."
  96. exit 1
  97. ;;
  98. esac
  99.  
  100. fi
Add Comment
Please, Sign In to add comment