Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

66 linhas
1.7 KiB

  1. #!/bin/bash
  2. set -e
  3. if [[ -z "$1" ]]; then
  4. echo "Usage: vendor_hex_core.sh PATH_TO_HEX_CORE"
  5. exit 1
  6. fi
  7. source_dir=$1/src
  8. target_dir=src
  9. prefix=r3_
  10. hex_core_version=`cat $source_dir/hex_core.hrl | grep HEX_CORE_VERSION | cut -d'"' -f2`
  11. filenames="hex_core.hrl \
  12. hex_core.erl \
  13. hex_erl_tar.erl \
  14. hex_erl_tar.hrl \
  15. hex_filename.erl \
  16. hex_pb_names.erl \
  17. hex_pb_package.erl \
  18. hex_pb_signed.erl \
  19. hex_pb_versions.erl \
  20. hex_tarball.erl \
  21. hex_registry.erl \
  22. hex_http_httpc.erl \
  23. hex_http.erl \
  24. hex_repo.erl \
  25. hex_api.erl \
  26. hex_api_key.erl \
  27. hex_api_package.erl \
  28. hex_api_package_owner.erl \
  29. hex_api_release.erl \
  30. hex_api_user.erl \
  31. safe_erl_term.xrl"
  32. search_to_replace="hex_core: \
  33. hex_core) \
  34. hex_core.hrl \
  35. hex_erl_tar \
  36. hex_filename \
  37. hex_pb_names \
  38. hex_pb_package \
  39. hex_pb_signed \
  40. hex_pb_versions \
  41. hex_registry \
  42. hex_tarball \
  43. hex_http \
  44. hex_repo \
  45. hex_api \
  46. safe_erl_term"
  47. rm -f $target_dir/$prefix*
  48. for filename in $filenames; do
  49. source_path=$source_dir/$filename
  50. target_path=$target_dir/$prefix$filename
  51. echo "%% Vendored from hex_core v$hex_core_version, do not edit manually" > $target_path
  52. echo >> $target_path
  53. cat $source_path >> $target_path
  54. for word in $search_to_replace; do
  55. sed -i.bak s/$word/$prefix$word/g $target_path
  56. rm $target_path.bak
  57. done
  58. done