Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 224dede

Browse files
committed
building on PR #3 to get a simple multi-builder solution for now
1 parent ad7674c commit 224dede

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# the username that will run the middleman builder
22
# # user will be created along a pair of ssh key
33
builder_username: middleman_builder
4+
builder: 'middleman'
45
update_submodules: True
56
watchers: []
67
irc_server: False

files/build_deploy.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
args = parser.parse_args()
5050

5151

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+
5263
def debug_print(message):
5364
if args.debug:
5465
print message
@@ -206,16 +217,17 @@ def notify_error(stage, error):
206217
notify_error('install', C.output)
207218

208219
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)
212223
except subprocess.CalledProcessError, C:
213224
notify_error('build', C.output)
214225

215226
if not args.dry_run:
216227
syslog.syslog("Build of {}: start sync".format(name))
217228
# TODO log the message
218229
if config['remote']:
230+
build_subdir = builder_info[config['builder']]['build_subdir']
219231
subprocess.call(['rsync',
220232
'-e',
221233
'ssh '
@@ -227,7 +239,8 @@ def notify_error(stage, error):
227239
os.path.expanduser('~/.ssh/{}_id.rsa'.format(name)),
228240
'--delete-after',
229241
'-rqavz',
230-
'%s/build/' % checkout_dir, config['remote']])
242+
'%s/%s/' % (checkout_dir, build_subdir),
243+
config['remote']])
231244
else:
232245
subprocess.call(['bundle', 'exec', 'middleman', 'deploy'])
233246
syslog.syslog("Build of {}: finish sync".format(name))

templates/builder.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: {{ name }}
2+
builder: {{ builder }}
23
notification:
34
{% if irc_server %}
45
irc:

0 commit comments

Comments
 (0)