How do I extend a regular expression to exclude al

2020-06-09 07:18发布

In the app.yaml file of my Google App Engine project there is a skip_files section used to exclude files of given types from being uploaded. How do I extend this regular expression to exclude the entire gaeunit directory from being uploaded?

skip_files: |
    ^(.*/)?(
    (app\.yaml)|
    (index\.yaml)|
    (\..*)|
    (.*\.pyc)|
    (.*\.bat)|
    (.*\.psd)|
    (Thumbs.db)|
    (.*\.svn/.*)|
    (.*\.lnk)|
    (.*\.datastore)|
    (_darcs/.*)|
    (nbproject/.*)|
    (.*\.swp)|
    (.*\.log)|
    )$

3条回答
可以哭但决不认输i
2楼-- · 2020-06-09 08:05

my app.yaml looks like this:

skip_files:
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^(statistics/.*)
- ^(unittests/.*)
- ^(webtests/.*)
查看更多
▲ chillily
3楼-- · 2020-06-09 08:08

With a new app (as of this writing) you can simply put the directory name with a trailing slash (as indicated by the app.yaml docs)

So your app.yaml might look like: skip_files: - node_modules/ - ^(.*/)?app\.yaml - ^(.*/)?app\.yml - ^(.*/)?index\.yaml - ^(.*/)?index\.yml ...

However, when trying to ignore a huge directory like node_modules, you will find the following easier to deal with: (- ^node_modules/*.*). This solution will print a single, nice message like INFO: Ignoring directory [node_modules]: Directory matches ignore regex. when deploying with gcloud app deploy.

Unfortunately gcloud app deploy will still locally copy all files in the deploy directory to /var/folders/... even though you have ignored certain directories/files. Those files won't be uploaded to google though.

查看更多
太酷不给撩
4楼-- · 2020-06-09 08:09

The same way the nbproject and darcs directories are excluded in the above regular expression. Add this line anywhere before the last line:

(gaeunit/.*)|
查看更多
登录 后发表回答