以编程方式安装主题程序

If you want to install themes via your app.yml, use the following format:

run:
  - exec: echo "Beginning of custom commands"

  - file:
      path: /tmp/mythemes.yml
      contents: |
        discourse-gifs:
          url: https://github.com/discourse/discourse-gifs.git
          add_to_all_themes: true

  - exec:
      cd: $home
      cmd: su discourse -c 'bundle exec rake themes:install < /tmp/mythemes.yml'

  - exec: echo "End of custom commands"
11 个赞

哦,我很高兴这是可能的……我一直在寻找一种方法来跨多站点实例加载主题,这可能是最简单的方法。谢谢!

2 个赞

如果您还在寻找一种通过 zip 文件从本地设备导入主题的程序化方法:

export THEME_ARCHIVE=<文件绝对路径>
bundle exec rake themes:install:archive

或者

THEME_ARCHIVE=<文件绝对路径> bundle exec rake themes:install:archive

是您的解决方案。

6 个赞

(tar.gz也适用)

2 个赞