49
49
args = parser .parse_args ()
50
50
51
51
52
+ builder_info = {
53
+ 'middleman' : {
54
+ 'build_command' : ['bundle' , 'exec' , 'middleman' 'build' , '--verbose' ],
55
+ 'build_subdir' : 'build'
56
+ },
57
+ 'jekyll' : {
58
+ 'build_command' : ['bundle' , 'exec' , 'jekyll' , 'build' , '--incremental' , '--verbose' , '--trace' ],
59
+ 'build_subdir' : '_site'
60
+ }
61
+ }
62
+
52
63
def debug_print (message ):
53
64
if args .debug :
54
65
print message
@@ -206,16 +217,17 @@ def notify_error(stage, error):
206
217
notify_error ('install' , C .output )
207
218
208
219
try :
209
- syslog . syslog ( "Build of {}: bundle exec middleman build" . format ( name ))
210
- result = subprocess . check_output ([ 'bundle' , 'exec' , 'middleman' ,
211
- 'build' , '--verbose' ] )
220
+ command = builder_info [ config [ 'builder' ]][ 'build_command' ]
221
+ syslog . syslog ( "Build of {}: {}" . format ( name , ' ' . join ( command )))
222
+ result = subprocess . check_output ( command )
212
223
except subprocess .CalledProcessError , C :
213
224
notify_error ('build' , C .output )
214
225
215
226
if not args .dry_run :
216
227
syslog .syslog ("Build of {}: start sync" .format (name ))
217
228
# TODO log the message
218
229
if config ['remote' ]:
230
+ build_subdir = builder_info [config ['builder' ]]['build_subdir' ]
219
231
subprocess .call (['rsync' ,
220
232
'-e' ,
221
233
'ssh '
@@ -227,7 +239,8 @@ def notify_error(stage, error):
227
239
os .path .expanduser ('~/.ssh/{}_id.rsa' .format (name )),
228
240
'--delete-after' ,
229
241
'-rqavz' ,
230
- '%s/build/' % checkout_dir , config ['remote' ]])
242
+ '%s/%s/' % (checkout_dir , build_subdir ),
243
+ config ['remote' ]])
231
244
else :
232
245
subprocess .call (['bundle' , 'exec' , 'middleman' , 'deploy' ])
233
246
syslog .syslog ("Build of {}: finish sync" .format (name ))
0 commit comments