[英]travis-ci : error during the build (No such file or directory)
I'm having a problem trying to test my build on travis-ci for my jekyll app. 我在尝试为jekyll应用程序在travis-ci上测试构建时遇到问题。 One of the plugins generates a json containing informations that my app can reach for a search tool.
其中一个插件会生成一个json,其中包含我的应用程序可用于搜索工具的信息。
The build command works fine on my computer : build命令在我的计算机上工作正常:
bundle exec jekyll build --source octopress
Witch indexes informations into a search.json file in my built directory (_site). Witch将信息索引到我的内置目录(_site)中的search.json文件中。
But it fails on travis-ci as on Heroku. 但是它在Travis-ci上失败了,在Heroku上失败了。
writting search.json to /home/travis/build/alain-andre/mon_site/_site
jekyll 2.5.3 | Error: No such file or directory - /home/travis/build/alain-andre/mon_site/_site/search.json
Can anyone help ? 有人可以帮忙吗?
OK, I found the solution. 好的,我找到了解决方案。
I had to add the search.json
into the jekyll site.keep_files
. 我必须将
search.json
添加到site.keep_files
。
First to do is to create a Jekyll::StaticFile inside your Jekyll module. 首先要做的是在Jekyll模块内创建一个Jekyll :: StaticFile 。
class SearchJson < Jekyll::StaticFile
def write(dest)
begin
super(dest)
rescue
end
true
end
end
Then, when your file is created, add it to site.static_files
like this : 然后,在创建文件后,将其添加到
site.static_files
如下所示:
# Keep the file from being cleaned by Jekyll
Jekyll::SearchJson.new(site, site.dest, "/", filename)
site.keep_files << filename
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.