Exemple #1
0
def _get_project_dir(config: str):
    from os.path import abspath, dirname

    if config is not None:
        config = abspath(config)
        return dirname(config)

    from stakkr.file_utils import find_project_dir
    return find_project_dir()
Exemple #2
0
def get_config_and_project_dir(config_file: str):
    """Guess config file name and project dir"""
    if config_file is not None:
        config_file = path.abspath(config_file)
        project_dir = path.dirname(config_file)
    else:
        project_dir = find_project_dir()
        config_file = '{}/stakkr.yml'.format(project_dir)

    return config_file, project_dir
Exemple #3
0
 def test_find_project_dir_from_subdir(self):
     static_path = dirname(realpath(__file__)) + '/static'
     chdir(static_path + '/home')
     self.assertEquals(static_path, file_utils.find_project_dir())
     chdir(BASE_DIR)
 def test_find_project_dir_from_subdir(self):
     static_path = dirname(realpath(__file__)) + '/static'
     chdir(static_path + '/home')
     self.assertEquals(static_path, file_utils.find_project_dir())
Exemple #5
0
 def test_find_project_dir_from_root(self):
     static_path = dirname(realpath(__file__)) + '/static'
     chdir(static_path)
     self.assertEquals(static_path, file_utils.find_project_dir())