[英]Yaws as Rebar dependency
How can I install Yaws as a Rebar dependency in my Erlang application? 如何在我的Erlang应用程序中将Yaws作为Rebar依赖项安装?
Thanks, 谢谢,
LRP LRP
First, make sure you're using a recent version of rebar
, say from April 2012 or later ( rebar
commit dc472b
or later), as changes to it were made in early 2012 specifically to support projects like Yaws. 首先,请确保您使用最新版本的rebar
,比如从2012年4月或之后( rebar
提交dc472b
或更高版本),因为2012年初对其进行了更改,专门用于支持Yaws等项目。
To use Yaws as a dependency, specify the following in your rebar.config
file: 要将Yaws用作依赖项,请在rebar.config
文件中指定以下内容:
{deps, [{yaws, ".*", {git, "git://github.com/klacke/yaws", {branch, "master"}}}]}.
You can replace the {branch, "master"}
part with a specific Yaws tag if you like: 如果您愿意,可以用特定的Yaws标签替换{branch, "master"}
部分:
{deps, [{yaws, ".*", {git, "git://github.com/klacke/yaws", {tag, "yaws-1.94"}}}]}.
Note, though, that I don't recommend using a version lower than Yaws 1.94 due to changes made to Yaws specifically for rebar
build support. 但请注意,由于Yaws专门针对rebar
构建支持所做的更改,我不建议使用低于Yaws 1.94的版本。
How you actually run Yaws depends on how your app uses it. 你如何实际运行雅司病取决于你的应用程序如何使用它。 Using it in an embedded fashion is probably best for rebar-built apps, since that way you won't have any dependencies on yaws.conf
files. 以嵌入方式使用它可能是最好的yaws.conf
构建的应用程序,因为这样你就不会对yaws.conf
文件有任何依赖。 But if you want to run Yaws as a stand-alone web server, you can build your dependencies and your application and then run Yaws interactively like this: 但是,如果您想将Yaws作为独立的Web服务器运行,您可以构建依赖项和应用程序,然后以交互方式运行Yaws,如下所示:
rebar get-deps compile
./deps/yaws/bin/yaws -i -pa ebin
This uses the default yaws.conf
file found in ./deps/yaws/etc/yaws/yaws.conf
, which you can modify as needed. 这将使用默认yaws.conf
中发现的文件./deps/yaws/etc/yaws/yaws.conf
,它可以根据需要修改。 Starting Yaws in this fashion won't include the ebin
directories of any other of your application's rebar dependencies in the load path, but you can either add the necessary paths using additional -pa
options to Yaws, or by specifying them in the yaws.conf
file . 以这种方式启动Yaws将不包括加载路径中任何其他应用程序的rebar依赖项的ebin
目录,但是您可以使用额外的-pa
选项向Yaws添加必要的路径,或者在yaws.conf
指定它们。档案 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.