Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""LICENSE 

2Copyright 2017 Hermann Krumrey <hermann@krumreyh.com> 

3 

4This file is part of ci-scripts. 

5 

6ci-scripts is free software: you can redistribute it and/or modify 

7it under the terms of the GNU General Public License as published by 

8the Free Software Foundation, either version 3 of the License, or 

9(at your option) any later version. 

10 

11ci-scripts is distributed in the hope that it will be useful, 

12but WITHOUT ANY WARRANTY; without even the implied warranty of 

13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

14GNU General Public License for more details. 

15 

16You should have received a copy of the GNU General Public License 

17along with ci-scripts. If not, see <http://www.gnu.org/licenses/>. 

18LICENSE""" 

19 

20 

21import os 

22from shutil import copyfile 

23from urllib.request import urlretrieve 

24from ci_scripts.common import process_call 

25 

26 

27def install_composer(): 

28 """ 

29 Installs composer locally 

30 :return: None 

31 """ 

32 urlretrieve("https://getcomposer.org/installer", "install-composer") 

33 process_call(["php", "install-composer"]) 

34 os.remove("install-composer") 

35 

36 

37def checkstyle(): 

38 """ 

39 Runs checkstyle on the PHP project 

40 :return: None 

41 """ 

42 process_call(["./composer.phar", "update"]) 

43 process_call([ 

44 "php", "vendor/phpcheckstyle/phpcheckstyle/run.php", 

45 "--src", "src", "--src", "test", "--config", "config/checkstyle.xml" 

46 ]) 

47 

48 

49def unittest(): 

50 """ 

51 Runs PHP unit tests 

52 :return: None 

53 """ 

54 process_call(["./composer.phar", "update"]) 

55 copyfile("config/phpunit.xml", "phpunit.xml") 

56 process_call([ 

57 "vendor/bin/phpunit", "test", "--coverage-html=coverage" 

58 ]) 

59 os.remove("phpunit.xml") 

60 

61 dest = os.path.join( 

62 os.environ["PROGSTATS_DATA_PATH"], 

63 "coverage", 

64 os.environ["CI_PROJECT_NAME"] 

65 ) 

66 process_call(["rsync", "-a", "--delete-after", "coverage/", dest]) 

67 

68 

69def docgen(): 

70 """ 

71 Generates documentation 

72 :return: None 

73 """ 

74 process_call(["./composer.phar", "update"]) 

75 process_call(["vendor/bin/phpdoc", "-d", "src"]) 

76 

77 dest = os.path.join( 

78 os.environ["PROGSTATS_DATA_PATH"], 

79 "doc_html", 

80 os.environ["CI_PROJECT_NAME"] 

81 ) 

82 process_call(["rsync", "-a", "--delete-after", "output/", dest])