Beispiel #1
0
    def make_structure(self):
        try:
            #define working directory from congif var
            os.chdir(self.mypath)
            #create root project directory
            os.mkdir(self.project_name, self.access_rights)
        except OSError:
            print ("Creation of the directory %s failed" % self.project_name)
        else:
            print ("Successfully created the directory %s " % self.project_name)

        # Creating all default structure
        try:
            #working on root directory
            os.chdir(self.project_name)

            os.mkdir('docs', self.access_rights)
            Path('docs/index.md').touch()
            print("Creating documentation folder")

            os.mkdir('include', self.access_rights)
            os.mkdir('include/'+self.project_name, self.access_rights)
            Path('include/'+self.project_name+'/public_header.h').touch()
            print("Creating include folder")

            os.mkdir('src', self.access_rights)
            Path('src/private_header.h').touch()
            Path('src/code.cpp').touch()
            print("Creating src folder")

            os.mkdir('libs', self.access_rights)
            Path('libs/.gitkeep').touch()
            print("Creating libs folder")

            os.mkdir('test', self.access_rights)
            Path('test/.gitkeep').touch()
            print("Creating test folder")


            Path('.gitignore').touch()
            add_gitignore = self.git_ignore()

            Path('README.md').touch()

            if self.license is not None:
                Path('LICENSE').touch()
                get_license = common.generate_license(self.license)
                print("Creating default files")

        except OSError:
            print ("Creation of the structure for project %s failed" % self.project_name)
            os.chdir(self.mypath)
            shutil.rmtree(self.project_name)
        else:
            print ("Successfully created the structure for project %s " % self.project_name)
    def make_structure(self):
        try:
            #define working directory from congif var
            os.chdir(self.mypath)
            #create root project directory
            os.mkdir(self.project_name, self.access_rights)
        except OSError:
            print ("Creation of the directory %s failed" % self.project_name)
        else:
            print ("Successfully created the directory %s " % self.project_name)

        # Creating all default structure
        try:
            #working on root directory
            os.chdir(self.project_name)

            os.mkdir('docs', self.access_rights)
            Path('docs/index.md').touch()
            print("Creating documentation folder")

            os.mkdir('test', self.access_rights)
            Path('test/.gitkeep').touch()
            print("Creating test folder")

            projectfolder = self.project_name.lower()
            os.mkdir(projectfolder, self.access_rights)
            Path(projectfolder+'/__init__.py').touch()
            Path(projectfolder+'/app.py').touch()
            print("Creating src folder")

            Path('requirements.txt').touch()
            Path('.gitignore').touch()
            add_gitignore = self.git_ignore()
            Path('setup.py').touch()
            add_setup_content = self.setup_file()

            Path('README.md').touch()

            if self.license is not None:
                Path('LICENSE').touch()
                get_license = common.generate_license(self.license)
                print("Creating default files")

        except OSError:
            print ("Creation of the structure for project %s failed" % self.project_name)
            os.chdir(self.mypath)
            shutil.rmtree(self.project_name)
        else:
            print ("Successfully created the structure for project %s " % self.project_name)
    def make_structure(self):
        try:
            #define working directory from congif var
            os.chdir(self.mypath)
            #create root project directory
            os.mkdir(self.project_name, self.access_rights)
        except OSError:
            print("Creation of the directory %s failed" % self.project_name)
        else:
            print("Successfully created the directory %s " % self.project_name)

        # Creating all default structure
        try:
            #working on root directory
            os.chdir(self.project_name)

            os.mkdir('css', self.access_rights)
            Path('css/style.css').touch()
            content = "h1 {text-align: center;}\np {text-align: center;}\n.center {\n  display: block;\n  margin-left: auto;\n  margin-right: auto;\n  width: 30%;\n}"
            f = open("css/style.css", "w+")
            f.write(content)
            f.close()
            print("Creating css folder")

            os.mkdir('docs', self.access_rights)
            Path('docs/index.md').touch()
            print("Creating documentation folder")

            os.mkdir('js', self.access_rights)
            Path('js/main.js').touch()
            print("Creating js folder")

            os.mkdir('img', self.access_rights)
            os.mkdir('img/favicon', self.access_rights)
            Path('img/favicon/.gitkeep').touch()
            os.mkdir('img/home', self.access_rights)
            Path('img/home/.gitkeep').touch()
            print("Creating img folder")

            os.mkdir('fonts', self.access_rights)
            Path('fonts/.gitkeep').touch()
            print("Creating fonts folder")

            os.mkdir('scss', self.access_rights)
            Path('scss/main.scss').touch()
            print("Creating scss folder")

            Path('index.html').touch()
            add_index_content = self.index_file()

            if self.license is not None:
                Path('LICENSE').touch()
                get_license = common.generate_license(self.license)

            print("Creating default files")

        except OSError:
            print("Creation of the structure for project %s failed" %
                  self.project_name)
            os.chdir(self.mypath)
            shutil.rmtree(self.project_name)
        else:
            print("Successfully created the structure for project %s " %
                  self.project_name)