Permalink
Browse files

moved update function into helpers

  • Loading branch information...
1 parent 441c40d commit 61f7dbaa43a7cc5d38b136bf0f7f48ae6319331b @blturner committed Mar 16, 2012
Showing with 18 additions and 16 deletions.
  1. +2 −16 stitch/fabfile.py
  2. +16 −0 stitch/helpers.py
View
18 stitch/fabfile.py
@@ -1,4 +1,3 @@
-import collections
import os
import pprint
import shutil
@@ -12,6 +11,8 @@
from fabric.operations import put
from jinja2 import Environment, FileSystemLoader
+from stitch.helpers import update
+
"""
Usage:
`fab stage`
@@ -56,21 +57,6 @@ def render_jinja(template, context, filename):
f.write(t.render(c))
-def update(d, u):
- """
- Utility function that takes a dictionary and updates keys with values from a
- second dictionary.
- http://stackoverflow.com/a/3233356
- """
- for k, v in u.iteritems():
- if isinstance(v, collections.Mapping):
- r = update(d.get(k, {}), v)
- d[k] = r
- else:
- d[k] = u[k]
- return d
-
-
def restart():
if is_local(env.host):
local('sudo apachectl graceful')
View
16 stitch/helpers.py
@@ -0,0 +1,16 @@
+import collections
+
+
+def update(d, u):
+ """
+ Utility function that takes a dictionary and updates keys with values from a
+ second dictionary.
+ http://stackoverflow.com/a/3233356
+ """
+ for k, v in u.iteritems():
+ if isinstance(v, collections.Mapping):
+ r = update(d.get(k, {}), v)
+ d[k] = r
+ else:
+ d[k] = u[k]
+ return d

0 comments on commit 61f7dba

Please sign in to comment.