def create_html(project_name=None, dir_to_create=None): if dir_to_create == None: dir_to_create = select_dir() os.chdir(dir_to_create) while (True): if project_name ==None: print(colors.yellow, "Enter Project Name") print(colors.reset) project_name = input() project_name.replace(' ', '_') if (project_name == ''): print(colors.red,"Please Enter a valid Project Name to continue") print(colors.reset) continue else: print(colors.bold, colors.blue, "Creating Your Awesome HTML Project") print(colors.reset) try: os.makedirs(project_name) os.chdir(project_name) with open("README.md", 'a') as f: f.write(readme.format(project_name, project_name, "HTML")) with open('index.html', 'w') as file: file.write(HTML_STRING.format(project_name.title(),project_name.title())) print(colors.bold, colors.yellow, "Project Created Sucessfully") print(colors.reset) sys.exit() except FileExistsError as e: print(colors.bold, colors.red, project_name + " already exists please mention a different name ") print(colors.reset) break
def create_extension(project_name=None, dir_to_create=None): if dir_to_create == None: dir_to_create = select_dir() os.chdir(dir_to_create) while (True): if project_name ==None: print("Enter Project name: ") project_name = input() project_name.replace(' ', '_') if (project_name == ''): print("Please Enter a valid Project Name to continue") continue else: print("Creating Your Awesome HTML Project") try: os.makedirs(project_name) os.chdir(project_name) with open("README.md", 'a') as f: f.write(readme.format(project_name, project_name, "Chrome Extension")) with open('index.html', 'w') as f: f.write(extension_html.format(project_name.title())) with open('popup.js') as f: f.write(popupfile) print("Project Created Sucessfully") sys.exit() except FileExistsError as e: print(project_name + " already exists please mention a different name ") break
def create_ml(project_name=None, dir_to_create=None): DEVNULL = open(os.devnull, 'wb') if dir_to_create == None: dir_to_create = select_dir() os.chdir(select_dir) print(colors.yellow, "Is the PC setup with all dependencies [Yes/No] ? \n") choice = input() if choice.lower() == 'yes' or choice.lower() == 'y': print(colors.reset, colors.red, "The following packages will be installed 1) Sci- Kit Learn \n 2) Numpy \n 3) Matplotlib \n 4)Pandas \n [Yes/No]") option = input() if option.lower == 'yes' or option.lower() == 'y': project_dir= os.mkdir("BoilerML") os.chdir(project_dir) print(colors.lightgreen, "Installing Numpy ... ") print(colors.reset) p = subprocess.Popen(['pip3 install numpy'], stdout=DEVNULL, stderr=subprocess.STDOUT, shell=True) output = p.communicate()[0] if p.returncode == 0: print("Installed Numpy") else: print("Unexpected Error occured, Please try again later") sys.exit() p = subprocess.Popen(['pip3 install matplotlib'], stdout=DEVNULL, stderr=subprocess.STDOUT, shell=True) output = p.communicate()[0] if p.returncode == 0: print("Installed Matplotlib") else: print("Unexpected Error occure") sys.exit() p = subprocess.Popen(['pip3 install sklearn'], stdout=DEVNULL, stderr=subprocess.STDOUT, shell=True) output = p.communicate()[0] if p.returncode == 0: print("Installed sucessfully al the Pakcages") print(colors.yellow, "Powerboiling Please wait ....") with open("README.md ", 'a') as f: f.write(readme.format(project_name, project_name, "ML Project")) with open("basic_model.py", 'a') as f: f.write(linearRegression) with open("basic_plot.py") as f: f.write(basic_plot)
def create_django(project_name=None, dir_to_create=None,app_name=None): if(dir_to_create == None): dir_to_create = select_dir() os.chdir(dir_to_create) while (True): if(project_name ==None): print(colors.yellow, " 1) Enter the Project Name \n") print(colors.reset) project_name = input() project_name.replace(' ', '_') if (project_name == ''): print(colors.red,"Please Enter a valid Project Name to continue") print(colors.reset) continue project_name = project_name.strip().lower() if(app_name ==None): print(colors.yellow,"2) Enter the App Name") app_name=input() app_name.replace(' ', '_') if (app_name == ''): print(colors.red,"Please Enter a valid Project Name to continue") print(colors.reset) continue app_name = app_name.strip().lower() try: print(colors.bold, colors.blue, "Please Wait Creating Your Awesome Django Project... ") print(colors.reset) DEVNULL= open(os.devnull,'wb') p = subprocess.Popen(['django-admin startproject '+project_name ], stdout=DEVNULL, stderr=subprocess.STDOUT,shell=True) output=p.communicate() os.chdir(project_name) with open("README.md", 'a') as f: f.write(readme.format(project_name, project_name, "Django")) with open('.gitignore', 'a') as f: f.write(gitignore.DJANGO_GIT_IGNORE) pr = subprocess.Popen(['django-admin startapp '+ app_name], stdout=DEVNULL, stderr=subprocess.STDOUT,shell=True) out = pr.communicate()[0] if pr.returncode == 0: print(colors.green, "Project Created Succesfully") print(colors.reset) sys.exit() DEVNULL.close() except subprocess.CalledProcessError as e: if p.returncode != 0: print("It seems you have not Installed Django in Your System do you want to install and continue[Yes/No]") choice = input() if (not choice.lower() == 'yes'): sys.exit() if (choice.lower() == 'yes'): print(colors.blue, "Installing Django ..") print(colors.reset) p=subprocess.Popen(['pip3 install django'], stdout=DEVNULL, shell=True, stderr=subprocess.STDOUT) output = p.communicate() if p.returncode == 0: print(colors.black, "Django installed Succesfully rerun command to create project") break else: print(colors.cyan,"Couldn't install Django please Try again") print(colors.reset) sys.exit()