CN113778477A - File processing method and device, computer readable storage medium and electronic device - Google Patents

File processing method and device, computer readable storage medium and electronic device Download PDF

Info

Publication number
CN113778477A
CN113778477A CN202010691169.1A CN202010691169A CN113778477A CN 113778477 A CN113778477 A CN 113778477A CN 202010691169 A CN202010691169 A CN 202010691169A CN 113778477 A CN113778477 A CN 113778477A
Authority
CN
China
Prior art keywords
file
directory
called
local disk
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010691169.1A
Other languages
Chinese (zh)
Inventor
张亮
戚依楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Shangke Information Technology Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Shangke Information Technology Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Shangke Information Technology Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Shangke Information Technology Co Ltd
Priority to CN202010691169.1A priority Critical patent/CN113778477A/en
Publication of CN113778477A publication Critical patent/CN113778477A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The embodiment of the invention relates to a file processing method and device, a computer readable storage medium and electronic equipment, which relate to the technical field of computers, and the method comprises the following steps: reading a script file of a file to be called, obtaining a file name and a version number of the file to be called, and updating the file name and the version number into a preset batch processing script file; executing the updated batch processing script file, and establishing a mapping relation between the file name and the version number and a file directory in the local disk; the file directory in the local disk is obtained by mounting the file directory of the managed script file in the server to the local disk; and when receiving the update information of the file directory sent by the server, automatically updating the file directory in the local disk according to the update information based on the mapping relation so as to call the file to be called by the updated file directory. The embodiment of the invention improves the development efficiency of the project.

Description

File processing method and device, computer readable storage medium and electronic device
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a file processing method, a file processing device, a computer readable storage medium and electronic equipment.
Background
With the development of computer technology, more and more software development projects are provided. In the process of project development, in order to better meet the business requirements or the requirements of users for the developed project, the performance of software is improved, the defects of the software are corrected, and the software may need to be updated.
Currently, front ends are typically developed using modularity. Therefore, after the package is relied on for modification, all project developers need to renew the latest version information to the local development environment, so that the referenced package version information is consistent, and unpredictable errors are prevented.
However, the above solution has the following drawbacks: when the version information of the dependency package is updated, if other developers of the project do not update the version information of the local package in time, the version information is inconsistent, so that the condition of abnormal system operation occurs in the development process, and the development efficiency of the project is reduced.
Therefore, it is desirable to provide a new method and apparatus for managing project dependency packages.
It is to be noted that the information invented in the above background section is only for enhancing the understanding of the background of the present invention, and therefore, may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present invention is directed to a method for managing a project dependent package, a device for managing a project dependent package, a computer readable storage medium, and an electronic device, which overcome at least some of the problems of low project development efficiency due to limitations and disadvantages of the related art.
According to one aspect of the present disclosure, a file processing method is provided, which is applied to a client, where a script file of a file to be called is configured in a local disk of the client, and the file processing method includes:
reading the script file of the file to be called to obtain the file name and the version number of the file to be called, and updating the file name and the version number into a preset batch processing script file;
executing the updated batch processing script file, and establishing a mapping relation between the file name and the version number and a file directory in the local disk; the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file to the local disk;
and when receiving the update information of the file directory sent by the server, automatically updating the file directory in the local disk according to the update information based on the mapping relation so as to call the file to be called by the updated file directory.
In an exemplary embodiment of the present disclosure, the executing the updated batch script file, and establishing a mapping relationship between the file name and the version number and the file directory in the local disk includes:
acquiring a storage path of the file directory in the local disk, and writing the storage path into a preset mapping script file to obtain a mapping path;
and executing the mapping commands in the updated batch processing script files in batch, and establishing the mapping relation between the file names and the version numbers and the file directories in the local disk based on the mapping paths.
In an exemplary embodiment of the present disclosure, the updating the file name and the version number to a preset batch script file includes:
creating a preset batch processing script file, and judging whether the file name and the version number exist in the preset batch processing script file or not;
and updating the file name and the version number which do not exist in the preset batch script file into the preset batch script file when judging that the file name and the version number do not exist in the preset batch script file.
In an exemplary embodiment of the present disclosure, the mounting a file directory in a server hosting the script file to the local disk includes:
and mounting a file directory hosting the script file in the server to the local disk through a network file system service provided by the server.
In an exemplary embodiment of the present disclosure, the file processing method further includes:
installing the script file of the file to be called into the server based on a preset management tool; wherein the preset management tool comprises an NPM packet manager and/or a YARN resource manager.
According to one aspect of the present disclosure, a file processing method is provided, which is applied to a server, in which a network file service system is configured, and the file processing method includes:
running a script file of a file to be called, wherein the client is installed under a shared directory of a server, and generating a file directory of the file to be called;
based on the network file service system, mounting the file directory of the file to be called to a local disk of the client, so that the client establishes a mapping relation between the file directory of the file to be called and the file name and the version number included in the script file in the local disk;
when detecting that the file directory of the file to be called is updated, generating update information according to the updated file directory, and sending the update information to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relation, and further the updated file directory is called from the local disk conveniently.
According to an aspect of the present disclosure, a file processing apparatus is provided, which is applied to a client, a script file of a file to be called is configured in a local disk of the client, and the file processing apparatus includes:
the script file reading module is used for reading the script file of the file to be called, obtaining the file name and the version number of the file to be called and updating the file name and the version number into a preset batch processing script file;
the mapping relation establishing module is used for executing the updated batch processing script file and establishing the mapping relation between the file name and the version number and the file directory in the local disk; the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file to the local disk;
and the file directory updating module is used for automatically updating the file directory in the local disk according to the updating information based on the mapping relation when receiving the updating information of the file directory sent by the server, so as to call the file to be called according to the updated file directory.
According to an aspect of the present disclosure, there is provided a file processing apparatus applied to a server in which a network file service system is configured, the file processing apparatus including:
the script file running module is used for running a script file of a file to be called under a shared directory of the server at the client side and generating a file directory of the file to be called;
the file directory mounting module is used for mounting the file directory of the file to be called to a local disk of the client based on the network file service system so that the client establishes a mapping relation between the file directory of the file to be called and a file name and a version number included in the script file in the local disk;
and the update information sending module is used for generating update information according to the updated file directory when detecting that the file directory of the file to be called is updated, and sending the update information to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relation, and the updated file directory is called from the local disk conveniently.
According to an aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the file processing method of any one of the above.
According to an aspect of the present disclosure, there is provided an electronic device including:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform any of the file processing methods described above via execution of the executable instructions.
On one hand, the method for managing the project dependency package, provided by the embodiment of the invention, obtains the file name and the version number of the file to be called by reading the script file of the file to be called, and updates the file name and the version number to a preset batch processing script file; then executing the updated batch processing script file, and establishing a mapping relation between the file name and the version number and a file directory in the local disk; finally, when the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relation so as to call the updated file directory to the file to be called, and the problem that when the version information of the dependency package is updated in the prior art, if other developers of the project do not update the version information of the local package in time, the version information is inconsistent, so that the abnormal operation of the system occurs in the development process, the development efficiency of the project is reduced, and the development efficiency of the project is improved is solved; on the other hand, the updated batch processing script file is executed, and the mapping relation between the file name and the version number and the file directory in the local disk is established, so that the establishing efficiency of the mapping relation is improved; on the other hand, the file directory in the local disk is automatically updated according to the updating information based on the mapping relation, so that the updating efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 schematically shows a flowchart of a file processing method according to an exemplary embodiment of the present invention.
FIG. 2 schematically shows a block diagram of a file processing system according to an example embodiment of the present invention.
Fig. 3 is a flowchart schematically illustrating a method for executing an updated batch script file and establishing a mapping relationship between the file name and version number and a file directory in the local disk according to an exemplary embodiment of the present invention.
Fig. 4 is a diagram schematically illustrating an application scenario for establishing a mapping relationship between name information and version number information and a file directory in a local disk according to an exemplary embodiment of the present invention.
Fig. 5 is a flowchart schematically illustrating a method for automatically updating a file directory in the local disk according to the update information based on a mapping relationship, according to an exemplary embodiment of the present invention.
Fig. 6 schematically shows a flowchart of another file processing method according to an exemplary embodiment of the present invention.
Fig. 7 schematically shows a flowchart of another file processing method according to an exemplary embodiment of the present invention.
Fig. 8 schematically shows a block diagram of a file processing apparatus according to an exemplary embodiment of the present invention.
Fig. 9 schematically shows a block diagram of another file processing apparatus according to an exemplary embodiment of the present invention.
Fig. 10 schematically illustrates an electronic device for implementing the above-described file processing method according to an exemplary embodiment of the present invention.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the invention.
Furthermore, the drawings are merely schematic illustrations of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
During the development of a project, calls to external software are often required. However, since many developers work independently during the software development process, how to ensure that the versions of the called external software are consistent is an urgent problem to be solved.
The example embodiment first provides a file processing method, which may be executed on a client, where a script file of a file to be called is configured in a local disk of the client; of course, those skilled in the art may also operate the method of the present invention on other platforms as needed, and this is not particularly limited in this exemplary embodiment. Referring to fig. 1, the method for managing the project dependency package may include the following steps:
s110, reading a script file of the file to be called to obtain a file name and a version number of the file to be called, and updating the file name and the version number to a preset batch processing script file;
s120, executing the updated batch processing script file, and establishing a mapping relation between the file name and the version number and a file directory in a local disk; the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file to the local disk;
and S130, when the updating information of the file directory sent by the server is received, automatically updating the file directory in the local disk according to the updating information based on the mapping relation so as to call the file to be called according to the updated file directory.
In the management method of the project dependence package, on one hand, the name and the version number of the file to be called are obtained by reading the script file of the file to be called, and the name and the version number of the file are updated to a preset batch processing script file; then executing the updated batch processing script file, and establishing a mapping relation between the file name and the version number and a file directory in the local disk; finally, when the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relation so as to call the updated file directory to the file to be called, and the problem that when the version information of the dependency package is updated in the prior art, if other developers of the project do not update the version information of the local package in time, the version information is inconsistent, so that the abnormal operation of the system occurs in the development process, the development efficiency of the project is reduced, and the development efficiency of the project is improved is solved; on the other hand, the updated batch processing script file is executed, and the mapping relation between the file name and the version number and the file directory in the local disk is established, so that the establishing efficiency of the mapping relation is improved; on the other hand, the file directory in the local disk is automatically updated according to the updating information based on the mapping relation, so that the updating efficiency is improved.
Hereinafter, each step involved in the document processing method according to the exemplary embodiment of the present invention will be explained and explained in detail with reference to the drawings.
First, terms related to exemplary embodiments of the present invention are explained and explained.
NodeJS, a JavaScript execution environment based on the Chrome V8 engine. The mentioned items of the exemplary embodiments of the present invention are developed based on the operating environment.
The NPM, a package management tool installed along with the NodeJS, can solve many problems in the deployment of NodeJS codes, and the common use scenes are as follows: allowing a user to download a third party package (dependency package) written by others from the NPM server to local use; allowing a user to download and install a command line program written by others from the NPM server to be locally used; allowing the user to upload their own written packages or command line programs to the NPM server for use by others.
YARN, Yet other Resource coordinator, Another Resource coordinator, is a new Hadoop Resource manager, it is a universal Resource management system, can offer unified Resource management and deployment for upper application, its introduction has brought the enormous benefits in the utilization factor, Resource unified management and data sharing etc. for the cluster.
NFS, Network File System, enables users to access files elsewhere on the Network just as they would using their own computer.
Next, the purpose of the exemplary embodiments of the present invention will be explained and explained. In the exemplary embodiment of the present invention, files to be called (i.e., a dependency package of a project, hereinafter referred to as files to be called) are installed to a server in a unified manner, and then a developer performs one-to-one mapping on the files to be called of the developer local environment and package version information of the server in a script batch processing manner in a local development environment, so that it is possible to solve the problem that when the version information of the dependency package is updated, if other developers of the project do not update the version information of the local package in time, version information is inconsistent, and thus system operation is abnormal in the development process, and further, the development efficiency of the project is reduced.
Hereinafter, a document processing system of an exemplary embodiment of the present invention is explained and explained. Referring to fig. 2, the project dependency package management system may include a client 210 where a developer of a project is located, a server 220 hosting a file directory of a dependency package, and of course, a development platform 230 where the project is located. The client and the server are connected through a network, and the client and the development platform are also connected through the network. And has:
the server 220 is used for hosting a file directory of a file to be called; the client 210 and the development platform on which the project is located may be used to execute the file calling method proposed in the present application.
Hereinafter, steps S110 to S130 will be explained and explained.
In step S110, the script file of the file to be called is read, the file name and the version number of the file to be called are obtained, and the file name and the version number are updated to a preset batch script file.
In the present exemplary embodiment, first, a script file of a file to be called is explained and explained. Json, which is already established when a project starts to be developed, wherein the script file of the file to be called comprises a file name and a version number of the file to be called; after the script file is created, the script file may be installed in a shared folder in a server, where the server may be an NFS server, or may be another server that can provide NFS services, and this example is not limited in this respect. Secondly, when a mapping relation between a file name and a version number and a file directory needs to be established in the local disk, a package json file needs to be read first, and then name information and version number information of all files to be called are obtained.
It should be added here that if another to-be-called file is newly added to the project, the script file of the to-be-called file needs to be updated. The method specifically comprises the following steps: when detecting that a newly added file to be called exists in the project, updating a script file of the file to be called; and reading the updated script file of the file to be called to obtain the file names and the version numbers of all the files to be called included in the updated script file of the file to be called. By the method, the file name and the version number of the file to be called included in the script file of the file to be called are complete, and the problem of abnormal system operation caused by inconsistent maintenance of the version information of the package can be further avoided.
Further, in this exemplary embodiment, after obtaining the file name and the version number of the file to be called, the file name and the version number need to be updated to a preset batch script file. Specifically, firstly, a preset batch processing script file is created, and whether the file name and the version number exist in the preset batch processing script file or not is judged; and secondly, when judging that the file name and the version number do not exist in the preset batch script file, updating the file name and the version number which do not exist in the preset batch script file into the preset batch script file. In detail:
firstly, creating a batch script file batch, wherein the batch script file comprises files such as shell or bat; secondly, a mapping script file npm _ link.js is created, and the file directory to be called (including the file name and the version number in the package directory) can be traversed through the npm _ link.js file, so that the batch file configuration is updated. Further, the mapping script file is run to traverse all the name information and version number information, whether the name information and the version number information exist in the batch processing script file is judged, and if the name information and the version number information do not exist in the batch processing script file, the name information and the version number information which do not exist in the batch processing script file are updated to the batch processing script file.
In step S120, executing the updated batch script file, and establishing a mapping relationship between the file name and version number and a file directory in the local disk; and the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file into the local disk.
In the present exemplary embodiment, first, an NFS (network file system) service is configured on a server side, and the NFS service is provided to a developer of a project; next, the server-specified directory MNT is set as the shared directory. Meanwhile, in order to generate a file directory in the server, the dependent package needs to be installed in the server, which may specifically include: installing the script file of the file to be called into the server based on a preset management tool; wherein the preset management tool comprises an NPM packet manager and/or a YARN resource manager. Further, since the server side is configured with the network file system, the file directory hosting the dependency package in the server can be mounted to the local disk of the developer of the project through the network file system service provided by the server. By the method, the mounting efficiency of the file directory of the dependent package can be improved.
Further, referring to fig. 3, executing the updated batch script file, and establishing a mapping relationship between the file name and version number and the file directory in the local disk may include steps S310 to S320. Wherein:
in step S310, a storage path of the file directory in the local disk is obtained, and the storage path is written into a preset mapping script file to obtain a mapping path;
in step S320, the mapping commands in the updated batch script file are executed in batch, and a mapping relationship between the file name and version number and the file directory in the local disk is established based on the mapping path.
Hereinafter, steps S310 to S320 will be explained and explained. Firstly, a developer mounts a directory MNT (file directory) shared on an NFS server to a local file system NFS _ modules directory of the developer; secondly, the developer downloads the project code to a local project catalog through version control tools such as svn or git and the like; then, the developer needs to write the storage path of the local NFS _ modules directory into the npm _ link.
// setting mounted to local shared directory
let NFS_modulesPWD='/home/z1/work/project/NFS_modules/node_modules/';
Further, npm _ link.js file is executed, a batch mapping command for generating a dependency package is created, and the batch mapping command is updated into the batch file; npm _ link package mapping command is generated, the batch file is automatically executed, the batch mapping command is executed, at this time, a node _ modules directory is generated in the project, the packages in the directory correspond to the packages installed on the server one by one, and the system can be operated without modifying the path of the reference package in the project file, so that the development can be carried out. For example, the developer 1 mounts the file directory on the server to the local NFS _ modules directory to obtain package 1 with version, package 2 with version, package 3 with version, … with version, package n with version, and so on; meanwhile, traversing all the dependent packages in the item node _ modules directory to obtain the package 1 without version, the package 2 without version, the package 3 without version, … without version and the package n without version, and then establishing the mapping relation between the package 1 with version, the package 2 with version, the package 3 with version, …, the package n with version and the package 1 without version, the package 2 without version, the package 3 without version, … and the package n without version. By the method, the mounting efficiency of the file directory is improved, and meanwhile, automatic synchronization between the packages in the directory and the packages installed on the server can be realized.
In step S130, when receiving the update information of the file directory sent by the server, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so as to call the file to be called according to the updated file directory.
In this example embodiment, when the server detects that the file name and the version number change, the file directory may be updated by using the changed version number and the file name, and then update information is generated according to the updated file directory, and the update information is sent to the client, so that the file directory of the client may also be updated synchronously. The specific update process may refer to fig. 5.
Step S501, the server receives an update request of a dependent package (which may include package 1, package 2, …, package n, etc.), and updates the file name and/or version number of the file to be called in response to the update request;
step S502, generating updating information according to the file name and/or version number of the updated file to be called, and sending the updating information to the client; when the client receives the update information, the file directory in the local disk can be automatically updated according to the update information based on the established mapping relationship, so that the information of the files to be called, which are called by all developers of the project, is completely consistent, and the problem of abnormal system operation caused by inconsistent maintenance of the version information of the package can be avoided; meanwhile, the problem of time cost waste caused by manual updating can be avoided.
The embodiment of the invention also provides another file processing method which is applied to the server, wherein the server is provided with a network file service system. Referring to fig. 6, the file processing method may further include steps S610 to S630. Wherein:
in step S610, running a script file of a file to be called, where a client is installed in a shared directory of a server, and generating a file directory of the file to be called;
in step S620, based on the network file service system, mount the file directory of the file to be called to the local disk of the client, so that the client establishes a mapping relationship between the file directory of the file to be called and the file name and version number included in the script file in the local disk;
in step S630, when it is detected that the file directory of the file to be called is updated, update information is generated according to the updated file directory, and the update information is sent to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating to call the updated file directory from the local disk.
In the file processing method exemplarily shown in fig. 6, the problem that when the version information of the dependent package is updated, if the version information of the local package is not updated in time by other developers of the project, version information is inconsistent, so that system operation is abnormal in the development process, thereby reducing the development efficiency of the project, and improving the development efficiency of the project in the prior art is solved.
Hereinafter, the management method of the item dependency package according to the exemplary embodiment of the present invention will be further explained and explained with reference to fig. 7. Specifically, referring to fig. 7, the method for managing the project dependency package may include the following steps:
step S710 creates profile information in the project. Specifically, firstly, a package is created, wherein the package includes name information and version information of a dependent package; then, creating a batch file batch, wherein the batch file comprises files such as shell or bat; js, npm _ link is created, and traversal of the package directory can be realized through the file, and the batch file configuration is updated.
Step S720, configuring the server. Firstly, a server side configures NFS (network file system) service and provides NFS service for a project developer; secondly, setting a directory MNT appointed by the server as a shared directory; finally, the developer installs the dependency package of the specified version on which the project depends into the MNT directory of the server through the NPM or YARN according to the dependency package of the project, and obtains the file directory.
In step S730, the batch execution file batch is configured. First, each row represents a mapping command of one packet, which may be specifically as follows:
sudo npm link autod
sudo npm link egg-scripts
secondly, the batch processing file is executed by a spawn method of child _ process in nodeJS, and batch mapping of the packets is realized.
Step S740, configures the local environment of the developer of the project.
Firstly, a developer mounts a directory MNT (file directory) shared on an NFS server to a local file system NFS _ modules directory of the developer;
secondly, the developer downloads the project code to a local project catalog through version control tools such as svn or git and the like;
then, the developer needs to write the storage path of the local NFS _ modules directory into the npm _ link.
// setting mounted to local shared directory
let NFS_modulesPWD='/home/z1/work/project/NFS_modules/node_modules/';
Step S750, executing npm _ link.js file, creating a batch mapping command for generating a dependency package, and updating the batch mapping command into a batch file; npm, after the generation of the mapping command of the link packet is finished, automatically executing the batch file and executing the batch mapping command;
step S760, a node _ modules directory is generated in the project, packages in the directory correspond to packages installed on the server one by one, and the system can be operated without modifying the path of the reference package in the project file so as to develop the reference package.
According to the management method of the project dependency package provided by the embodiment of the invention, the front-end project dependency package is installed on the server, and then the developer establishes a mapping relation between the dependency package of the local development environment and the installation package of the server in the local environment in a script batch processing mode, so that the problem of abnormal system operation caused by inconsistent maintenance of version information of local reference packages of developers is solved.
The embodiment of the invention also provides a file processing device which is applied to the client side, and the script file of the file to be called is configured in the local disk of the client side. Referring to fig. 8, the file processing apparatus may include a script file reading module 810, a mapping relationship establishing module 820, and a file directory updating module 830. Wherein:
the script file reading module 810 may be configured to read a script file of the to-be-called file, obtain a file name and a version number of the to-be-called file, and update the file name and the version number to a preset batch script file;
the mapping relationship establishing module 820 may be configured to execute the updated batch script file, and establish a mapping relationship between the file name and version number and a file directory in the local disk; the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file to the local disk;
the file directory updating module 830 may be configured to, when receiving update information of the file directory sent by the server, automatically update the file directory in the local disk according to the update information based on the mapping relationship, so as to call a file to be called according to the updated file directory.
In an exemplary embodiment of the present disclosure, executing the updated batch script file, and establishing a mapping relationship between the file name and the version number and the file directory in the local disk includes:
acquiring a storage path of the file directory in the local disk, and writing the storage path into a preset mapping script file to obtain a mapping path;
and executing the mapping commands in the updated batch processing script files in batch, and establishing the mapping relation between the file names and the version numbers and the file directories in the local disk based on the mapping paths.
In an exemplary embodiment of the present disclosure, updating the file name and the version number to a preset batch script file includes:
creating a preset batch processing script file, and judging whether the file name and the version number exist in the preset batch processing script file or not;
and updating the file name and the version number which do not exist in the preset batch script file into the preset batch script file when judging that the file name and the version number do not exist in the preset batch script file.
In an exemplary embodiment of the present disclosure, mounting a file directory in a server hosting the script file to the local disk includes:
and mounting a file directory hosting the script file in the server to the local disk through a network file system service provided by the server.
In an exemplary embodiment of the present disclosure, the file processing apparatus further includes:
the script file installation module can be used for installing the script file of the file to be called into the server based on a preset management tool; wherein the preset management tool comprises an NPM packet manager and/or a YARN resource manager.
The embodiment of the invention also provides another file processing device which is applied to the server, and the server is provided with a network file service system. Referring to fig. 9, the file processing apparatus includes a script file executing module 910, a script file mounting module 920, and an update information transmitting module 930. Wherein:
the script file running module 910 may be configured to run a script file of a file to be called, where the client is installed in a shared directory of a server, and generate a file directory of the file to be called;
the file directory mount module 920 may be configured to mount the file directory of the file to be called to a local disk of the client based on the network file service system, so that the client establishes a mapping relationship between the file directory of the file to be called and a file name and a version number included in the script file in the local disk;
the update information sending module 930 may be configured to, when it is detected that the file directory of the file to be called is updated, generate update information according to the updated file directory, and send the update information to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating to call the updated file directory from the local disk.
The specific details of each module in the file processing apparatus have been described in detail in the corresponding file processing method, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the invention. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present invention are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
In an exemplary embodiment of the present invention, there is also provided an electronic device capable of implementing the above method.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 1000 according to this embodiment of the invention is described below with reference to fig. 10. The electronic device 1000 shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 10, the electronic device 1000 is embodied in the form of a general purpose computing device. The components of the electronic device 1000 may include, but are not limited to: the at least one processing unit 1010, the at least one memory unit 1020, a bus 1030 connecting different system components (including the memory unit 1020 and the processing unit 1010), and a display unit 1040.
Wherein the storage unit stores program code that is executable by the processing unit 1010 to cause the processing unit 1010 to perform steps according to various exemplary embodiments of the present invention as described in the "exemplary methods" section above in this specification. For example, the processing unit 1010 may execute step S110 as shown in fig. 1: reading the script file of the file to be called to obtain the file name and the version number of the file to be called, and updating the file name and the version number into a preset batch processing script file; step S120: executing the updated batch processing script file, and establishing a mapping relation between the file name and the version number and a file directory in the local disk; the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file to the local disk; step S130: and when receiving the update information of the file directory sent by the server, automatically updating the file directory in the local disk according to the update information based on the mapping relation so as to call the file to be called according to the updated file directory.
The processing unit 1010 may perform step S610 as shown in fig. 6: running a script file of a file to be called, wherein the client is installed under a shared directory of a server, and generating a file directory of the file to be called; step S620: based on the network file service system, mounting the file directory of the file to be called to a local disk of the client, so that the client establishes a mapping relation between the file directory of the file to be called and the file name and the version number included in the script file in the local disk; step S630: when detecting that the file directory of the file to be called is updated, generating update information according to the updated file directory, and sending the update information to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relation, and further the updated file directory is called from the local disk conveniently.
The storage unit 1020 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)10201 and/or a cache memory unit 10202, and may further include a read-only memory unit (ROM) 10203.
The memory unit 1020 may also include a program/utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 1030 may be any one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, and a local bus using any of a variety of bus architectures.
The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 1000, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 1000 to communicate with one or more other computing devices. Such communication may occur through input/output (I/O) interfaces 1050. Also, the electronic device 1000 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via the network adapter 1060. As shown, the network adapter 1060 communicates with the other modules of the electronic device 1000 over the bus 1030. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiment of the present invention.
In an exemplary embodiment of the present invention, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, aspects of the invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the invention described in the above section "exemplary methods" of the present description, when said program product is run on the terminal device.
According to the program product for realizing the method, the portable compact disc read only memory (CD-ROM) can be adopted, the program code is included, and the program product can be operated on terminal equipment, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.

Claims (10)

1. A file processing method is applied to a client, a script file of a file to be called is configured in a local disk of the client, and the file processing method comprises the following steps:
reading the script file of the file to be called to obtain the file name and the version number of the file to be called, and updating the file name and the version number into a preset batch processing script file;
executing the updated batch processing script file, and establishing a mapping relation between the file name and the version number and a file directory in the local disk; the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file to the local disk;
and when receiving the update information of the file directory sent by the server, automatically updating the file directory in the local disk according to the update information based on the mapping relation so as to call the file to be called according to the updated file directory.
2. The method according to claim 1, wherein the executing the updated batch script file and establishing the mapping relationship between the file name and version number and the file directory in the local disk comprises:
acquiring a storage path of the file directory in the local disk, and writing the storage path into a preset mapping script file to obtain a mapping path;
and executing the mapping commands in the updated batch processing script files in batch, and establishing the mapping relation between the file names and the version numbers and the file directories in the local disk based on the mapping paths.
3. The method according to claim 1, wherein the updating the file name and the version number to a preset batch script file comprises:
creating a preset batch processing script file, and judging whether the file name and the version number exist in the preset batch processing script file or not;
and updating the file name and the version number which do not exist in the preset batch script file into the preset batch script file when judging that the file name and the version number do not exist in the preset batch script file.
4. The method of claim 1, wherein the mounting a file directory in a server hosting the script file to the local disk comprises:
and mounting a file directory hosting the script file in the server to the local disk through a network file system service provided by the server.
5. The document processing method according to claim 1, further comprising:
installing the script file of the file to be called into the server based on a preset management tool; wherein the preset management tool comprises an NPM packet manager and/or a YARN resource manager.
6. A file processing method is applied to a server, a network file service system is configured in the server, and the file processing method comprises the following steps:
running a script file of a file to be called, wherein the client is installed under a shared directory of a server, and generating a file directory of the file to be called;
based on the network file service system, mounting the file directory of the file to be called to a local disk of the client, so that the client establishes a mapping relation between the file directory of the file to be called and the file name and the version number included in the script file in the local disk;
when detecting that the file directory of the file to be called is updated, generating update information according to the updated file directory, and sending the update information to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relation, and further the updated file directory is called from the local disk conveniently.
7. A file processing device is applied to a client, a script file of a file to be called is configured in a local disk of the client, and the file processing device comprises:
the script file reading module is used for reading the script file of the file to be called, obtaining the file name and the version number of the file to be called and updating the file name and the version number into a preset batch processing script file;
the mapping relation establishing module is used for executing the updated batch processing script file and establishing the mapping relation between the file name and the version number and the file directory in the local disk; the file directory in the local disk is obtained by mounting the file directory in the server for hosting the script file to the local disk;
and the file directory updating module is used for automatically updating the file directory in the local disk according to the updating information based on the mapping relation when receiving the updating information of the file directory sent by the server, so as to call the file to be called according to the updated file directory.
8. A file processing apparatus applied to a server in which a network file service system is configured, the file processing apparatus comprising:
the script file running module is used for running a script file of a file to be called under a shared directory of the server at the client side and generating a file directory of the file to be called;
the file directory mounting module is used for mounting the file directory of the file to be called to a local disk of the client based on the network file service system so that the client establishes a mapping relation between the file directory of the file to be called and a file name and a version number included in the script file in the local disk;
and the update information sending module is used for generating update information according to the updated file directory when detecting that the file directory of the file to be called is updated, and sending the update information to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relation, and the updated file directory is called from the local disk conveniently.
9. A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the file processing method according to any one of claims 1 to 6.
10. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the file processing method of any of claims 1-6 via execution of the executable instructions.
CN202010691169.1A 2020-07-17 2020-07-17 File processing method and device, computer readable storage medium and electronic device Pending CN113778477A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010691169.1A CN113778477A (en) 2020-07-17 2020-07-17 File processing method and device, computer readable storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010691169.1A CN113778477A (en) 2020-07-17 2020-07-17 File processing method and device, computer readable storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN113778477A true CN113778477A (en) 2021-12-10

Family

ID=78835174

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010691169.1A Pending CN113778477A (en) 2020-07-17 2020-07-17 File processing method and device, computer readable storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN113778477A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416133A (en) * 2021-12-30 2022-04-29 武汉卓目科技有限公司 Embedded file data updating method and system
CN114756298A (en) * 2022-04-20 2022-07-15 广州博冠信息科技有限公司 Program instance management method and device, computer storage medium and electronic equipment
CN116107628A (en) * 2022-12-21 2023-05-12 山东未来网络研究院(紫金山实验室工业互联网创新应用基地) Document sorting method based on node. Js

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416133A (en) * 2021-12-30 2022-04-29 武汉卓目科技有限公司 Embedded file data updating method and system
CN114756298A (en) * 2022-04-20 2022-07-15 广州博冠信息科技有限公司 Program instance management method and device, computer storage medium and electronic equipment
CN116107628A (en) * 2022-12-21 2023-05-12 山东未来网络研究院(紫金山实验室工业互联网创新应用基地) Document sorting method based on node. Js
CN116107628B (en) * 2022-12-21 2023-09-08 山东未来网络研究院(紫金山实验室工业互联网创新应用基地) Document sorting method based on node. Js

Similar Documents

Publication Publication Date Title
CN113778477A (en) File processing method and device, computer readable storage medium and electronic device
US9268546B2 (en) Deployment and hosting of platform independent applications
US9158520B2 (en) Development of platform independent applications
CN109445841B (en) Interface document management method, device, server and storage medium
US9367299B2 (en) Preventing application downgrade in an application store
CA2860657C (en) Installation engine and package format for parallelizable, reliable installations
CN113760306A (en) Method and device for installing software, electronic equipment and storage medium
CN110221840B (en) Function implementation method and device of application program, equipment and storage medium
CN114911518A (en) Cloud function application release management method, system, equipment and storage medium
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN112860251A (en) Method and system for constructing website front end
CN110557281A (en) Intelligent operation and maintenance method and device based on CMDB and alarm map
CN113377487A (en) Method, apparatus and computer program product for managing virtual machine upgrades
WO2023084345A1 (en) Automated deployment of enterprise archive with dependency on application server via script
US20220334820A1 (en) System and method for intermediate software upgrades for information handling systems
CN113468067B (en) Application program debugging method and device, electronic equipment and computer readable medium
CN114237684A (en) Component management system, method, device, electronic device and storage medium
CN110661852B (en) Service processing method and device in cloud environment
US20210173620A1 (en) System and method for providing integrated development environment
CN114816475A (en) Method, device, equipment and medium for updating embedded operating system
CN113568623A (en) Application deployment method and device and electronic equipment
CN115048313B (en) Automatic test method and device, computer readable storage medium and electronic equipment
CN111414175A (en) Network installation method, system and device of operating system and readable storage medium
CN112783528B (en) Resource online method and device and electronic equipment
CN117472509A (en) Non-containerized application management method based on Kubernetes cluster equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination