示例#1
0
def main(project):
    py_path = Paths.program(project=project, program=project)
    ProjectCreator.create_path(py_path)
    with open(os.path.join(py_path, '__init__.py'), 'w'):
        pass
    with open(os.path.join(py_path, '{}.py'.format(project)), 'w'):
        pass

    tests = Paths.program(project=project, program='tests')
    ProjectCreator.create_path(tests)
    with open(os.path.join(tests, '__init__.py'), 'w'):
        pass

    with open(os.path.join(Paths.project(project=project), 'requirements.txt'),
              'w'):
        pass
示例#2
0
    def create(name, description='', template='base'):
        """Create a new Project on disc."""
        if template not in ProjectCreator.templates():
            raise Exception('Invalid project template.')
        # end if
        path = Paths.project(project=name)
        if not os.path.exists(path):
            os.makedirs(path)
        else:
            raise Exception('Project already exists.')
        # end if

        # The config file
        data = dict(description=description, template=template)
        with open(Paths.project_config(project=name), 'w') as cfg:
            json.dump(data, cfg, indent=4)
        # end with

        # Create the other bootstrap folders, based on the given template
        template = importlib.import_module(
            'project_templates.{0}'.format(template))
        template.main(name)
        return True
示例#3
0
 def update_path(self, text):
     """Update the path display."""
     self.path_lbl.setText(Paths.project(project=text))