コード例 #1
0
    def generate(self):
        sysConf = SYSConf()
        if self.path and LocalOperation.exist(self.path):
            Log.fatal(Status["STAT_GPM_CONF_EXIST"])

            #key            prompt                         default                          verify
        sections = [("name", "project name", self.name or None, VerifyName),
                    ("language", "project language", self.language
                     or None, VerifyName),
                    ("author", "author name", self.author
                     or sysConf.author, None),
                    ("version", "initial version", self.version or 0.1, None),
                    ("email", "author email", self.email
                     or sysConf.email, VerifyEmail),
                    ("description", "project description", self.description
                     or "", None),
                    ("git_url", "git url[[email protected]:name/project.git]",
                     sysConf.git_url or None, None)]

        for section in sections:
            while (1):
                self._content[section[0]] = gets("Input %s" % section[1],
                                                 section[2])
                if section[3] and not self._content[section[0]]:
                    Log.warn(Status["STAT_INPUT_EMPTY"] % section[0])
                    continue
                elif section[3] and not VerifyName(self._content[section[0]]):
                    Log.warn(Status["STAT_INPUT_INVALID"] % section[0])
                    continue
                else:
                    break

        pkg_path = os.path.join(LocalOperation.pwd(), self.name)
        self._path = os.path.join(pkg_path, GPM_YML)
        self.write(self._path, self._content)
コード例 #2
0
ファイル: conf.py プロジェクト: galileo-project/Galileo-gpm
    def generate(self):
        sysConf = SYSConf()
        if self.path and LocalOperation.exist(self.path):
            Log.fatal(Status["STAT_GPM_CONF_EXIST"])

                      #key            prompt                         default                          verify
        sections = [("name",        "project name",                             self.name or None,               VerifyName),
                    ("language",    "project language",                         self.language or None,           VerifyName),
                    ("author",      "author name",                              self.author or sysConf.author,   None),
                    ("version",     "initial version",                          self.version or 0.1,             None),
                    ("email",       "author email",                             self.email or sysConf.email,     VerifyEmail),
                    ("description", "project description",                      self.description or "",          None),
                    ("git_url",     "git url[[email protected]:name/project.git]", sysConf.git_url or None,         None)]

        for section in sections:
            while(1):
                self._content[section[0]] = gets("Input %s" % section[1], section[2])
                if section[3] and not self._content[section[0]]:
                    Log.warn(Status["STAT_INPUT_EMPTY"] % section[0])
                    continue
                elif section[3] and not VerifyName(self._content[section[0]]):
                    Log.warn(Status["STAT_INPUT_INVALID"] % section[0])
                    continue
                else:
                    break

        pkg_path    = os.path.join(LocalOperation.pwd(), self.name)
        self._path = os.path.join(pkg_path, GPM_YML)
        self.write(self._path, self._content)
コード例 #3
0
 def read(self):
     if LocalOperation.exist(self._path):
         with open(self._path, "r") as stream:
             self._content = yaml.load(stream)
コード例 #4
0
def _init():
    if not LocalOperation.exist(GPM_SRC):
        LocalOperation.mkdir(GPM_SRC)
コード例 #5
0
ファイル: sdb.py プロジェクト: galileo-project/Galileo-gpm
 def __file_exist(self):
     db_dir = os.path.dirname(self.__path)
     if not LocalOperation.exist(db_dir):
         LocalOperation.mkdir(db_dir)
     return LocalOperation.exist(self.__path)
コード例 #6
0
ファイル: sdb.py プロジェクト: galileo-project/Galileo-gpm
 def __file_exist(self):
     db_dir = os.path.dirname(self.__path)
     if not LocalOperation.exist(db_dir):
         LocalOperation.mkdir(db_dir)
     return LocalOperation.exist(self.__path)
コード例 #7
0
ファイル: conf.py プロジェクト: galileo-project/Galileo-gpm
 def read(self):
     if LocalOperation.exist(self._path):
         with open(self._path, "r") as stream:
             self._content = yaml.load(stream)