示例#1
0
    def update_yarn_depenencies(self, version):
        packages_path = os.path.join(settings.APP_ROOT, 'package.json')
        yarn_config_path = os.path.join(settings.APP_ROOT, '.yarnrc')

        if self.overwite_existing_file(
                yarn_config_path,
                "A .yarnrc file already exists. Would you like to overwrite it with the latest? If you have not manually modified this file since creating this project, the answer is probably 'yes'"
        ) == True:
            with open(yarn_config_path, 'w') as f:
                content = '--install.modules-folder "./media/packages"\n--add.modules-folder "./media/packages"'
                f.write(content)

        if self.overwite_existing_file(
                packages_path,
                "A package.json file already exists. Would you like to overwrite it with the latest? If you have not manually modified this file since creating this project, the answer is probably 'yes'"
        ) == True:
            url = "https://raw.githubusercontent.com/archesproject/arches/stable/{0}/package.json".format(
                version)
            response = urllib.urlopen(url)
            data = json.loads(response.read())
            with open(packages_path, 'w') as f:
                json.dump(data, f, indent=4)

        if utils.get_yn_input(
                "Would you like to update your javascript packages using yarn? Yarn v1.5.1 or greater is required"
        ) == True:
            try:
                os.chdir(settings.APP_ROOT)
                subprocess.call("yarn install", shell=True)
            except Exception as e:
                print e
示例#2
0
 def overwite_existing_file(self, path, message):
     write_file = False
     if os.path.exists(path) == True:
         if not utils.get_yn_input(message):
             return write_file
         else:
             write_file = True
     else:
         write_file = True
     return write_file
示例#3
0
    def handle(self, *args, **options):

        if options["force"] is False:
            proceed = get_yn_input(
                msg=
                "Are you sure you want to destroy and rebuild your database?",
                default="N")
            if not proceed:
                exit()

        self.setup_db()
示例#4
0
    def remove_resources(self, load_id='', force=False):
        """
        Runs the resource_remover command found in data_management.resources
        """
        # resource_remover.delete_resources(load_id)
        if not force:
            if not utils.get_yn_input("all resources will be removed. continue?"):
                return

        resource_remover.clear_resources()
        return
示例#5
0
文件: packages.py 项目: cvast/arches
    def remove_resources(self, load_id='', force=False):
        """
        Runs the resource_remover command found in data_management.resources
        """
        # resource_remover.delete_resources(load_id)
        if not force:
            if not utils.get_yn_input(
                    "all resources will be removed. continue?"):
                return

        resource_remover.clear_resources()
        return
示例#6
0
    def remove_resources(self, load_id='', graphid=None, force=False):
        """
        Runs the resource_remover command found in data_management.resources
        """
        # resource_remover.delete_resources(load_id)
        if not force:
            if graphid == None:
                if not utils.get_yn_input(
                        "all resources will be removed. continue?"):
                    return
            else:
                if not utils.get_yn_input(
                        "All resources associated with the '%s' Resource Model will be removed. continue?"
                        % Graph.objects.get(graphid=graphid).name):
                    return

        if graphid == None:
            resource_remover.clear_resources()
        else:
            graph = Graph.objects.get(graphid=graphid)
            graph.delete_instances(verbose=True)

        return