File tree Expand file tree Collapse file tree 1 file changed +31
-9
lines changed Expand file tree Collapse file tree 1 file changed +31
-9
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import sys
6
6
import subprocess
7
7
8
8
def create_index ():
9
+ print 'Generating index...'
9
10
articles = []
10
11
11
12
page = {}
@@ -81,27 +82,48 @@ def merge_pages():
81
82
result = git .communicate ()[0 ].strip ().split ('\n ' )
82
83
if not result [- 1 ].startswith ('nothing to commit' ):
83
84
print 'ERROR: Please commit to master first'
84
- print 'Merge aborted.'
85
+ return 1
85
86
86
87
else :
87
- print 'Copying files...'
88
+ shutil . rmtree ( 'build' )
88
89
if not os .path .exists ('build' ):
90
+ print 'Copying files...'
89
91
os .mkdir ('build' )
92
+ shutil .copytree ('html/css' , 'build/css' )
93
+ shutil .copytree ('html/js' , 'build/js' )
94
+ shutil .copyfile ('html/index.html' , 'build/index.html' )
95
+ print 'Files copied sucessfully'
96
+ return merge_git ()
97
+
98
+ else :
99
+ print 'ERROR: Failed to remove old build directory'
100
+ return 1
101
+
102
+ return 0
103
+
104
+
105
+ def merge_git ():
106
+ return 0
107
+
108
+
109
+ def merge ():
110
+ print 'Merging into pages...'
111
+ if merge_pages () == 1 :
112
+ print 'Merge aborted.'
113
+
114
+ else :
115
+ print 'Merge successful'
116
+
90
117
91
118
if __name__ == '__main__' :
92
119
if len (sys .argv ) > 1 :
93
120
if sys .argv [1 ] == 'pages' :
94
- print 'Merging into pages...'
95
- merge_pages ()
121
+ merge ()
96
122
97
123
elif sys .argv [1 ] == 'all' :
98
- print 'Generating index...'
99
124
create_index ()
100
-
101
- print 'Merging into pages...'
102
- merge_pages ()
125
+ merge ()
103
126
104
127
else :
105
- print 'Generating index...'
106
128
create_index ()
107
129
You can’t perform that action at this time.
0 commit comments