Tools used by OpenStack Documentation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

96 lines
2.4 KiB

  1. #!/bin/bash
  2. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  3. # not use this file except in compliance with the License. You may obtain
  4. # a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  10. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  11. # License for the specific language governing permissions and limitations
  12. # under the License.
  13. if [[ $# -ne 1 ]]; then
  14. echo "usage: $0 PROJECT"
  15. echo
  16. echo "PROJECT = something like openstack, nova, or neutron"
  17. exit 1
  18. fi
  19. project=$1
  20. # checks command exist or not
  21. function does_exist {
  22. which $@ > /dev/null 2>&1
  23. local status=$?
  24. if [[ $status -ne 0 ]]; then
  25. echo "error: $1 not installed"
  26. exit 1
  27. fi
  28. }
  29. does_exist virtualenv
  30. does_exist pip
  31. does_exist git
  32. if [[ ! -e $HOME/.gitconfig ]]; then
  33. echo "note: ~/.gitconfig does not exist"
  34. fi
  35. if [[ ! -e .venv ]]; then
  36. virtualenv -p python2.7 .venv
  37. fi
  38. source .venv/bin/activate
  39. pip install --upgrade openstack-doc-tools
  40. pip install --upgrade pbr
  41. # Cliff can optionally output HTML - if cliff-tablib is installed.
  42. pip install --upgrade cliff-tablib
  43. # OSProfiler is an OpenStack cross-project profiling library.
  44. pip install --upgrade osprofiler
  45. if [[ $project == 'gnocchi' ]]; then
  46. pip install --upgrade ${project}client
  47. else
  48. pip install --upgrade python-${project}client
  49. fi
  50. # python-openstackclient has plugin interface.
  51. # It needs to install plugin packages
  52. # (i.e. python-ironicclient).
  53. osc_plugins=(barbican congress designate heat ironic ironic-inspector- sahara zaqar)
  54. if [[ $project == 'openstack' ]]; then
  55. for p in "${osc_plugins[@]}"
  56. do
  57. pip install --upgrade python-${p}client
  58. done
  59. fi
  60. rm -rf output
  61. mkdir output
  62. openstack-auto-commands --output-dir output $project
  63. if [[ ! -e openstack-manuals ]]; then
  64. git clone git://git.openstack.org/openstack/openstack-manuals
  65. fi
  66. cd openstack-manuals
  67. ( git remote -v | grep -q gerrit ) || git review -s
  68. git checkout master
  69. git pull
  70. branch=cli-reference
  71. git branch --list $branch && git branch -D $branch
  72. git checkout -b $branch
  73. mv ../output/${project}.rst "doc/cli-reference/source"
  74. rm -rf ../output
  75. version=$($project --version 2>&1)
  76. version=${version##*\)}
  77. git commit -a -m "[cli-ref] Update python-${project}client to ${version##* }"