Skip to content

Commit 3c17abc

Browse files
committed
Copy files to build directory
1 parent 82ae239 commit 3c17abc

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

make

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import sys
66
import subprocess
77

88
def create_index():
9+
print 'Generating index...'
910
articles = []
1011

1112
page = {}
@@ -81,27 +82,48 @@ def merge_pages():
8182
result = git.communicate()[0].strip().split('\n')
8283
if not result[-1].startswith('nothing to commit'):
8384
print 'ERROR: Please commit to master first'
84-
print 'Merge aborted.'
85+
return 1
8586

8687
else:
87-
print 'Copying files...'
88+
shutil.rmtree('build')
8889
if not os.path.exists('build'):
90+
print 'Copying files...'
8991
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+
90117

91118
if __name__ == '__main__':
92119
if len(sys.argv) > 1:
93120
if sys.argv[1] == 'pages':
94-
print 'Merging into pages...'
95-
merge_pages()
121+
merge()
96122

97123
elif sys.argv[1] == 'all':
98-
print 'Generating index...'
99124
create_index()
100-
101-
print 'Merging into pages...'
102-
merge_pages()
125+
merge()
103126

104127
else:
105-
print 'Generating index...'
106128
create_index()
107129

0 commit comments

Comments
 (0)