def ignoreExpression(self, expression): from ui import prompt_user import fnmatch matches = list() if not os.path.isfile(expression): for root, dirs, files in os.walk(self.root): for filename in files: # print filename if fnmatch.fnmatch(filename, expression): # print ('match'+filename) matches.append(os.path.join(root, filename)) else: matches.append(expression) # probably need to doctor the syntax here debug.log("The following files match the expression:") debug.log(matches) ignore = prompt_user("Would you like to ignore all of these files?") if ignore: self._writeGitIgnore(expression) cmd = "git update-index --assume-unchanged" self._native_exec(cmd) delete = prompt_user("Would you like to delete all of these files?\n" + str(matches)) else: delete = False if delete: self._removeFiles(matches)
def setup_gitconfig(repo): debug.log("Setting up git configuration") guessedRight=prompt_user("Is your (full) name \""+guessUsername()+"\"?") if(not guessedRight): username=prompt_user("Please enter your name",False) else: username=guessUsername()
def loadOpts(self): configpath = os.path.join(os.path.dirname(__file__),"config.json") if (os.path.exists(configpath)): info("Using configuration arguments from file "+configpath) else: from ui import prompt_user info("No configuration file specified, falling back to interactive setup") self.admin_email = prompt_user("What is the administrator's email?",isbool=False) while( not validateEmail(self.admin_email)): info(self.admin_email+" is an invalid email address, please specify a valid one.") self.admin_email = prompt_user("What is the administrator's email?",isbool=False)
def configure_repo(repo): debug.log("stub!") if(prompt_user("Do you want to change to root path?")): newpath= prompt_user("What should the root path be?",isbool=False) while (not os.path.exists(newpath)): newpath= prompt_user("Invalid path. What should the root path be?",isbool=False) repo.rootpath=newpath for remote in repo.remotes: writeable = prompt_user("Do you have write access to the remote \""+remote.name+"\" ("+remote.url+") for this repository?") repo.gkremotes[remote.name].setWriteable(writeable) repo.cachemeta = prompt_user("Do you want to track metadata (filesystem attributes like date modified, octal permiossions) for this repository?") import gkconfig gkconfig.writeRepoToJson(repo)
def _handHold(repos, **kwargs): print "Handholding" global METHODS handhold = prompt_user("No arguments eh? Want some help?", default="Y") if not handhold: return choice = prompt_user("Enter choice from: ", isbool=False, opts=METHODS) choiceFunc = globals()[choice] if prompt_user("Do you want to supply arguments to " + choice + "?"): args = prompt_user("Please provide arguments for " + choice, isbool=False) else: args = None if args == None: choiceFunc(repos) else: choiceFunc(repos, args)
def setup_repos(opts=list()): if (len(opts)>=0): for each in opts: #do opt pass createRepo = prompt_user("Would you like to configure a new repository? ") if (createRepo): rootPath = prompt_user ("Please enter the root path of the repository",isbool=False) rootPath= os.path.abspath(rootPath) while (not os.path.exists (rootPath)): rootPath = prompt_user ("Please enter a valid path, "+rootPath+" does not exist, or contains envalid syntax.",isbool=False) create_repo( rootPath ) repos = getRepos() selection = prompt_user("Which repo would you like to configure?",opts=repos,isbool=False) configure_repo(selection)
def create_repo(rootPath): import gkconfig reponame= prompt_user("What would you like to call this repo?",isbool=False) repo = GKRepo(GKRepoConfig(reponame,rootPath)) gkconfig.writeRepoToJson(repo)