@@ -94,7 +94,20 @@ def merge_pages():
94
94
shutil .copytree ('html/js' , 'build/js' )
95
95
shutil .copyfile ('html/index.html' , 'build/index.html' )
96
96
print 'Files copied sucessfully'
97
- return merge_git ()
97
+
98
+ print 'Switching to gh-pages...'
99
+ git = subprocess .Popen (['git' , 'checkout' , 'gh-pages' ],
100
+ stdout = subprocess .PIPE )
101
+
102
+ print git .communicate ()
103
+ status = merge_git ()
104
+
105
+ print 'Returning to master...'
106
+ git = subprocess .Popen (['git' , 'checkout' , 'master' ],
107
+ stdout = subprocess .PIPE )
108
+
109
+ print git .communicate ()
110
+ return status
98
111
99
112
else :
100
113
print 'ERROR: Failed to remove old build directory'
@@ -104,9 +117,16 @@ def merge_pages():
104
117
105
118
106
119
def merge_git ():
107
- git = subprocess .Popen (['git' , 'checkout' , 'gh-pages' ], stdout = subprocess .PIPE )
108
- print git .communicate ()[0 ].strip ().split ('\n ' )
109
- return 0
120
+ if os .path .exists ('build' ):
121
+ shutil .copytree ('build/css' , 'css' )
122
+ shutil .copytree ('build/js' , 'js' )
123
+ shutil .copyfile ('build/index.html' , 'index.html' )
124
+ shutil .rmtree ('build' )
125
+ return 0
126
+
127
+ else :
128
+ print 'ERROR: build directory missing'
129
+ return 1
110
130
111
131
112
132
def merge ():
0 commit comments