[英]How to specify a newer version of wkhtmltopdf on CircleCI?
I have a spec which tests generation of PDF with PDFKit. 我有一个使用PDFKit测试PDF生成的规范。 It uses the
wkhtmltopdf
command. 它使用
wkhtmltopdf
命令。 I need to use the --javascript-delay
option which is available in versions higher than 0.10.0. 我需要使用
--javascript-delay
选项,该选项在高于0.10.0的版本中可用。 When my spec runs on CircleCI it fails, because CircleCI uses wkhtltopdf
version 0.9.9. 当我的规范在CircleCI上运行时,它失败,因为CircleCI使用
wkhtltopdf
版本0.9.9。 Can I specify a higher version of wkhtmltopdf
on CircleCI? 我可以在
wkhtmltopdf
上指定更高版本的wkhtmltopdf吗? I specified the newest version of PDFKit in Gemfile, but it doesn't help. 我在Gemfile中指定了最新版本的PDFKit,但它没有帮助。
Right now Circle's test environment is Ubuntu 12.04 64-bit. 现在Circle的测试环境是64位的Ubuntu 12.04。 So I went to http://wkhtmltopdf.org/downloads.html and found that the latest stable version of wkhtmltopdf is 0.12.2.1, and copied the download URL into the follow circle.yml configuration:
所以我去了http://wkhtmltopdf.org/downloads.html并发现wkhtmltopdf的最新稳定版本是0.12.2.1,并将下载URL复制到以下circle.yml配置中:
dependencies:
pre:
- sudo apt-get remove wkhtmltopdf
- sudo apt-get update; sudo apt-get install xfonts-75dpi
- wget http://downloads.sourceforge.net/wkhtmltopdf/wkhtmltox-0.12.2.1_linux-precise-amd64.deb
- sudo dpkg -i wkhtmltox-0.12.2.1_linux-precise-amd64.deb
Yes, you can upgrade software on CircleCI build instances. 是的,您可以在CircleCI构建实例上升级软件。 You can either
你也可以
apt-get install
the current package, if that's new enough (try it and watch the log to see what version you get) with something like this in circle.yml: apt-get install
当前的软件包,如果这是新的(尝试并查看日志以查看您获得的版本),请使用circle.yml中的类似内容:
dependencies: pre: - sudo apt-get update; sudo apt-get install some-package
or 要么
download the source, compile and install it with something like this in circle.yml: 下载源代码,在circle.yml中使用类似的东西编译和安装它:
dependencies: pre: - wget http://example.com/some-package-2.0.0.tar.gz - tar xzf some-package-2.0.0.tar.gz - cd some-package-2.0.0 && make install
If you need this solution, see the documentation I linked to above for how to cache the compiled software to speed up builds. 如果您需要此解决方案,请参阅我上面链接的文档,了解如何缓存已编译的软件以加快构建。
A really, really convenient solution is to simply drop in the gem wkhtmltopdf-heroku . 一个非常非常方便的解决方案是简单地放入gem wkhtmltopdf-heroku 。 While the name of the gem says heroku, I found that it works just fine in Circle, too.
虽然宝石的名字说heroku,但我发现它在Circle中工作得很好。 As a bonus, I believe this dependency will be cached between builds without any special instructions to Circle.
作为奖励,我相信这种依赖关系将在构建之间进行缓存,而不需要对Circle进行任何特殊说明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.