使用swank-clojure对Clojure库进行黑客攻击的工作流程 [英] Workflow for hacking on Clojure libraries using swank-clojure

查看:149
本文介绍了使用swank-clojure对Clojure库进行黑客攻击的工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个典型的工作流程对黑客的Clojure图书馆吗?

Is there a typical workflow for hacking on Clojure libraries?

说我有我的应用程序Foo,它依赖于第三方库从仓库中获取,并通过 lein deps 包含在项目Foo中。

Say I have my application "Foo" which relies on a third-party library "Bar", which was obtained from a repository, and included in project Foo via lein deps.

在库Bar,所以我从github克隆它。

Then, say I want to hack on library "Bar", so I clone it from github.

现在,我想破解我的本地克隆Bar,同时处理应用程序Foo取决于它。我想使用一个swank的实例,在Emacs中打开Bar的所有源文件以及Foo中的所有源文件。

Now, I would like to hack on my local clone "Bar" while at the same time working on application "Foo" that depends on it. I would like all of the source files for "Bar" to open in Emacs along with all the source files in "Foo", using one instance of swank.

一个简单的方法来做到这一点?

Is there an easy way to do this?

我想改变我的环境而不是项目。因此,我不想为Foo编辑project.clj以完成此操作。

I want to alter my environment and not the project. Therefore I do not want to edit project.clj for "Foo" in order to accomplish this.

这需要在启动之前设置类路径 c>

Does this require setting the classpath before starting up lein swank, or is there a better way?

推荐答案

创建一个

Create a checkouts directory in your Foo project and create a symlink to your clone of the Bar project inside this directory.

引用

To quote the Leiningen FAQ:


Q :我想要并行地攻击两个项目,但是很难在它们之间切换。

A :如果在项目根目录和符号链接中创建一个名为checkouts的目录项目根源,Leiningen将允许你并行攻击他们。这意味着依赖项的更改将在主项目中可见,而不必通过整个install / switch-projects / deps / restart-repl循环,并且检出中的副本将优先于在project.clj中声明的依赖关系。请注意,这不是替代项目列表中的:dependencies;它只是补充,为了方便。

Q: I want to hack two projects in parallel, but it's annoying to switch between them.
A: If you create a directory called checkouts in your project root and symlink some other project roots into it, Leiningen will allow you to hack on them in parallel. That means changes in the dependency will be visible in the main project without having to go through the whole install/switch-projects/deps/restart-repl cycle, and the copy in checkouts will take precedence over the dependency declared in project.clj. Note that this is not a replacement for listing the project in :dependencies; it simply supplements that for convenience.

这篇关于使用swank-clojure对Clojure库进行黑客攻击的工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆