Commits

Brent Tubbs committed 792a4d7

merge

Comments (0)

Files changed (3)

 	install_requires = [
         'gunicorn',
         'CherryPy',
-        'Fabric == 0.9.2',
+        'Fabric >= 0.9.2',
         'PyYAML',
         'silk-config',
 	],

silk/devserver.py

 import os
 import sys
-
 import cherrypy
 
 import silk.lib
-import yaml
 import copy
 import os
 import sys
 import pkg_resources
 
+from silk_config import *
+
 def get_gunicorn_cmd(site_config, bin_dir=''):
     gconfig = copy.copy(site_config['gunicorn'])
 
         cmd = '%s/%s' % (bin_dir, cmd)
     return cmd
 
-def get_site_root(start_dir):
-    testfile = os.path.join(start_dir, 'site.yaml')
-    if os.path.isfile(testfile):
-        return start_dir
-    else:
-        parent_dir = os.path.split(start_dir)[0]
-        if parent_dir != start_dir:
-            return get_site_root(parent_dir)
-        else:
-            return None
-
-def get_role_list(local_root):
-    """Return a list of the role names defined by yaml roles/*.yaml"""
-    return [file[:-5] for file in os.listdir(os.path.join(local_root, 'roles')) if file.endswith('.yaml')]
-
-def get_role_config(role):
-    role_file = '%s/roles/%s.yaml' % (get_site_root(os.getcwd()), role)
-    config =  yaml.safe_load(open(role_file, 'r').read())
-    return config
-    #TODO: support pulling role info from a web page
-
-def get_site_config(site_root):
-    """Parses and returns site.yaml"""
-    site_config_file = os.path.join(site_root, 'site.yaml')
-    config = yaml.safe_load(open(site_config_file, 'r').read())
-    return config
-
-def get_blame(site_root):
-    """Parses and returns blame.yaml in deployed site"""
-    blame_file = os.path.join(site_root, 'blame.yaml')
-    blame = yaml.safe_load(open(blame_file, 'r').read())
-    return blame
-
-def get_config(site_root, role=None):
-    """Returns merged site and role config.
-    Falls back to blame.yaml if no role given.
-    Falls back to just site.yaml if no role given and no blame file found"""
-    if role is None:
-        try:
-            return get_blame(site_root)[1]['config']
-        except IOError:
-            return get_site_config(site_root)
-    else:
-        config = get_site_config(site_root)
-        config.update(get_role_config(role))
-        return config
-
 def get_template_path(template, site_root=None):
     """
     Returns path of template from site conf_templates dir, if found there, else
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.