Ejemplo n.º 1
0
    def get_recover_data(self):
        returnvals = []
        # Basic instructions
        self.print_line()
        printout(
            _("""Starting Interactive environment recovering at <%(envname)s>

Follow the instructions to recover environment!""",
              envname=self.envname))
        self.print_line()

        # Env path
        printout(
            _(""" Now enter the absolute path where your environment should be created."""
              ))
        path = self.envname
        returnvals.append(
            raw_input(_("</path/to/project> [%(default)s]> ",
                        default=path)).strip() or path)
        self.print_line()

        # Environment app
        printout(_(""" Enter path where the backup file is locates"""))
        prompt = _("Backup File [</path/to/file>]> ")
        returnvals.append(raw_input(prompt).strip())

        return returnvals
Ejemplo n.º 2
0
    def get_createenv_data(self):
        returnvals = []

        # Basic instructions
        self.print_line()
        printout(
            _("""Starting Interactive environment creation at <%(envname)s>

This is the interactive guide on environment creation.
Just follow the instructions.""",
              envname=self.envname))
        self.print_line()

        # Env path
        printout(
            _(""" Now enter the absolute path where your environment should be created."""
              ))
        path = self.envname
        returnvals.append(
            raw_input(_("</path/to/project> [%(default)s]> ",
                        default=path)).strip() or path)
        self.print_line()

        # Environment app
        printout(
            _(""" Enter the name of the project you are about to create"""))
        path = "My Project"
        returnvals.append(
            raw_input(_("project_name [%(default)s]> ", default=path)).strip()
            or path)
        self.print_line()
        return returnvals
Ejemplo n.º 3
0
    def get_backup_data(self):
        returnvals = []
        # Basic instructions
        self.print_line()
        printout(
            _("""Starting Interactive environment backup at <%(envname)s>

Follow the instructions to backup the environment!""",
              envname=self.envname))
        self.print_line()

        # Env path
        printout(
            _(""" Now enter the absolute path to the environment that you will backup."""
              ))
        path = self.envname
        returnvals.append(
            raw_input(_("</path/to/project> [%(default)s]> ",
                        default=path)).strip() or path)
        self.print_line()

        # Environment app
        printout(_(""" Destination file for tghe backup"""))
        dest = self.__env.backup_get_default_file_name()
        returnvals.append(
            raw_input(_("</dest/file> [%(default)s]> ", default=dest)).strip()
            or dest)

        return returnvals
Ejemplo n.º 4
0
    def get_createenv_data(self):
        returnvals = []

        # Basic instructions
        self.print_line()
        printout(_("""Starting Interactive environment creation at <%(envname)s>

This is the interactive guide on environment creation.
Just follow the instructions.""",
                   envname=self.envname))
        self.print_line()

        # Env path
        printout(_(""" Now enter the absolute path where your environment should be created."""))
        path = self.envname
        returnvals.append(raw_input(_("</path/to/project> [%(default)s]> ",
                                      default=path)).strip() or path)
        self.print_line()

        # Environment app
        printout(_(""" Enter the name of the project you are about to create"""))
        path = "My Project"
        returnvals.append(raw_input(_("project_name [%(default)s]> ",
                                      default=path)).strip() or path)
        self.print_line()
        return returnvals
Ejemplo n.º 5
0
    def do_delete(self, line):
        def delete_error(msg):
            printerr(_("Delete for '%(env)s' failed:", env=self.envname), "\n",
                     msg)

        # get arguments
        env_dir = None
        args = self.unicod_safe_split(line)

        # Interactive or not
        interactive_delete = False

        if len(args) == 1 and not args[0]:
            returnvals = self.get_delete_data()
            env_dir = returnvals[0]
            interactive_delete = True
        elif len(args) != 1:
            delete_error('Wrong number of arguments: %d' % len(args))
            return 2
        else:
            env_dir = args[0]

        # Set the right env dir
        self.envname = env_dir

        if self.__env and self.__env.basepath == self.envname:
            delete_error(
                "Can not delete currently open environment! Close and open the admin!"
            )
            return 2

        # Open env
        if not self.ceck_env():
            delete_error("Environment not created or corrupted!")
            return 2

        if interactive_delete:
            no_option = "no"
            value = raw_input(
                _("Delete Environment? [%(default)s]> ",
                  default=no_option)).strip() or no_option
            # Ask again if we want to delete the env!
            value = value.lower() in get_true_values()
            if not value:
                printout(_("Delete Canceled!"))
                return

        # Delete it!
        printout(_("Starting Delete Process"))
        self.__env.delete()

        # Close environment!
        self.__env.shutdown()

        # It's deleted, so purge it!
        printout(
            _(" Purge env directory %(purge_dir)s", purge_dir=self.envname))
        purge_dir(self.envname)
        printout(_("Environment successfully deleted"))
Ejemplo n.º 6
0
    def do_delete(self, line):
        def delete_error(msg):
            printerr(_("Delete for '%(env)s' failed:", env=self.envname),
                     "\n", msg)

        # get arguments
        env_dir = None
        args = self.unicod_safe_split(line)

        # Interactive or not
        interactive_delete = False

        if len(args) == 1 and not args[0]:
            returnvals = self.get_delete_data()
            env_dir = returnvals[0]
            interactive_delete = True
        elif len(args) != 1:
            delete_error('Wrong number of arguments: %d' % len(args))
            return 2
        else:
            env_dir = args[0]

        # Set the right env dir
        self.envname = env_dir

        if self.__env and self.__env.basepath == self.envname:
            delete_error("Can not delete currently open environment! Close and open the admin!")
            return 2

        # Open env
        if not self.ceck_env():
            delete_error("Environment not created or corrupted!")
            return 2

        if interactive_delete:
            no_option = "no"
            value = raw_input(_("Delete Environment? [%(default)s]> ",
                                default=no_option)).strip() or no_option
            # Ask again if we want to delete the env!
            value = value.lower() in get_true_values()
            if not value:
                printout(_("Delete Canceled!"))
                return

        # Delete it!
        printout(_("Starting Delete Process"))
        self.__env.delete()

        # Close environment!
        self.__env.shutdown()

        # It's deleted, so purge it!
        printout(_(" Purge env directory %(purge_dir)s", purge_dir=self.envname))
        purge_dir(self.envname)
        printout(_("Environment successfully deleted"))
Ejemplo n.º 7
0
    def get_recover_data(self):
        returnvals = []
        # Basic instructions
        self.print_line()
        printout(_("""Starting Interactive environment recovering at <%(envname)s>

Follow the instructions to recover environment!""",
                   envname=self.envname))
        self.print_line()

        # Env path
        printout(_(""" Now enter the absolute path where your environment should be created."""))
        path = self.envname
        returnvals.append(raw_input(_("</path/to/project> [%(default)s]> ",
                                      default=path)).strip() or path)
        self.print_line()

        # Environment app
        printout(_(""" Enter path where the backup file is locates"""))
        prompt = _("Backup File [</path/to/file>]> ")
        returnvals.append(raw_input(prompt).strip())

        return returnvals
Ejemplo n.º 8
0
    def get_backup_data(self):
        returnvals = []
        # Basic instructions
        self.print_line()
        printout(_("""Starting Interactive environment backup at <%(envname)s>

Follow the instructions to backup the environment!""",
                   envname=self.envname))
        self.print_line()

        # Env path
        printout(_(""" Now enter the absolute path to the environment that you will backup."""))
        path = self.envname
        returnvals.append(raw_input(_("</path/to/project> [%(default)s]> ",
                                      default=path)).strip() or path)
        self.print_line()

        # Environment app
        printout(_(""" Destination file for tghe backup"""))
        dest = self.__env.backup_get_default_file_name()
        returnvals.append(raw_input(_("</dest/file> [%(default)s]> ",
                                      default=dest)).strip() or dest)

        return returnvals
Ejemplo n.º 9
0
    def get_delete_data(self):
        returnvals = []
        # Basic instructions
        self.print_line()
        printout(_("""Starting Interactive environment deletion at <%(envname)s>""",
                   envname=self.envname))
        self.print_line()

        # Env path
        printout(_(""" Now enter the absolute path to the environment that will be deleted."""))
        path = self.envname
        returnvals.append(raw_input(_("</path/to/project> [%(default)s]> ",
                                      default=path)).strip() or path)
        self.print_line()
        return returnvals
Ejemplo n.º 10
0
    def get_delete_data(self):
        returnvals = []
        # Basic instructions
        self.print_line()
        printout(
            _("""Starting Interactive environment deletion at <%(envname)s>""",
              envname=self.envname))
        self.print_line()

        # Env path
        printout(
            _(""" Now enter the absolute path to the environment that will be deleted."""
              ))
        path = self.envname
        returnvals.append(
            raw_input(_("</path/to/project> [%(default)s]> ",
                        default=path)).strip() or path)
        self.print_line()
        return returnvals