erlang 每当我想测试对源代码的更改时,是否都需要重新创建和重新安装couchdb?

eulz3vhy  于 2022-12-08  发布在  Erlang
关注(0)|答案(3)|浏览(114)

I am trying to contribute more with couchdb code, but I have really no idea how it is done the right way.
I have cloned the source from apache git repository and built it with

./configure
make && sudo make install

Then I wanted to change a file from the source called couch_httpd_show.erl
Do I need to run make && sudo make install again for every change I make to the source code and want to see how it behaves?
I am sure there's a more practical way to do it, because this approach is a bit time and patience consuming right?

g6ll5ycj

g6ll5ycj1#

Yes, there is a shortcut.

./configure
make dev
./utils/run

This builds and runs CouchDB entirely in the current directory. Instead of running as a background daemon, CouchDB will run in the foreground and output log messages to the terminal. It uses some local directories to store stuff: ./tmp/log for logs, ./tmp/lib for databases, and (if I remember correctly) ./etc/couch/local_dev.ini for configuration.
If you run this instead:

./utils/run -i

then you will also have an interactive Erlang prompt, which you can use to help debug.
When I work on CouchDB, I run this in the shell:

make dev && ./utils/run -i

After I change some code, I press ^C , up-arrow, return.
When I joined Couchio, I was responsible for production CouchDB deployments. I asked Chris Anderson for advice about something and he said, "Sorry, ask Jan. I've been just using utils/run for years!"

vojdkbi0

vojdkbi02#

您可以重建该文件,并将输出光束放置到位,然后重新启动。

flseospp

flseospp3#

erlc <file.erl>

&然后将.beam文件复制到适当的位置。要重新启动couchdb,请在erlang shell中使用init:restart().或对CouchDB执行POST /_restart。
尽管你可能也想考虑使用命令行的erlang & javascript测试套件来确保你没有破坏任何东西。

相关问题