forked from germaaan/StudentsManagementSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcounter.py
More file actions
executable file
·98 lines (82 loc) · 2.65 KB
/
counter.py
File metadata and controls
executable file
·98 lines (82 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# !/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
os.chdir('SMS-Front-End')
ficherosFrontEnd = []
linesFrontEnd = 0
for root, dirs, files in os.walk(".", topdown=False):
for name in files:
fullname = os.path.join(root, name)
if not re.match('./app/css|./app/js|./app/out|./app/images|./app/fonts', root) and not re.match('LICENSE|logo.svg', name):
ficherosFrontEnd.append(fullname)
f=open(fullname)
linesFrontEnd = linesFrontEnd + len(f.readlines())
os.chdir('../SMS-Back-End')
os.chdir('apigateway')
ficherosapig = []
linesapig = 0
for root, dirs, files in os.walk(".", topdown=False):
for name in files:
fullname = os.path.join(root, name)
if not re.match('./lib', root) and not name.endswith(('pyc','jpg')):
ficherosapig.append(fullname)
#print fullname
f=open(fullname)
linesapig = linesapig + len(f.readlines())
os.chdir('..')
os.chdir('microservicio1')
ficherossbd = []
linessbd = 0
for root, dirs, files in os.walk(".", topdown=False):
for name in files:
fullname = os.path.join(root, name)
if not re.match('./docs|./lib', root) and not name.endswith('pyc'):
ficherossbd.append(fullname)
print fullname
f=open(fullname)
linessbd = linessbd + len(f.readlines())
os.chdir('..')
os.chdir('sce')
ficherossce = []
linessce = 0
for root, dirs, files in os.walk(".", topdown=False):
for name in files:
fullname = os.path.join(root, name)
if not re.match('./lib', root) and not name.endswith(('pyc','png')):
ficherossce.append(fullname)
print fullname
f=open(fullname)
linessce = linessce + len(f.readlines())
'''
print 'Tams'
print linesFrontEnd
print linesapig
print linessbd
print linessce
'''
#Extraemos el número del commit
import subprocess
cmd = "git rev-list --count HEAD"
x = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE, stderr=subprocess.PIPE)
out, error = x.communicate()
numCommit=out[:-1]
#print 'numcommit' +str(numCommit)
os.system("git checkout gh-pages")
import datetime
date = datetime.date.today()
line=str(numCommit)+';'+str(date)+';'+str(linesFrontEnd)+';'+str(linesapig)+';'+str(linessbd)+';'+str(linessce)
'''cmd="echo \""+line+"\" >> lines.txt"
print cmd
x = subprocess.Popen(cmd, shell=True, stdout = subprocess.PIPE, stderr=subprocess.PIPE)
out, error = x.communicate()
print out
print error
'''
os.chdir('../..')
f = open('lines.txt', 'a')
f.write(line+'\n')
f.close()
os.system("git commit -am \" Commit de actualizacion"+numCommit+" . \"")
cmd = "git checkout master"
os.system(cmd)