Skip to content

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoduncan committed Sep 5, 2012
2 parents 6fd43e8 + 31c7824 commit 3d617e0
Show file tree
Hide file tree
Showing 161 changed files with 17,776 additions and 3,177 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ classes
*.tar
marmalade
target
.lein-*
275 changes: 28 additions & 247 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,253 +1,34 @@
# ritz

Ritz is a swank server for running [clojure](http://clojure.org) in
[slime](http://common-lisp.net/project/slime).
Ritz is a collection of libraries and servers for clojure development
environments and for debuggers.

<table>
<thead><tr><th>project</th><th>descritption</th></tr></thead>
<tbody>
<tr>
<td><a href="https://github.com/pallet/ritz/tree/develop/swank">ritz-swank</a></td>
<td>SWANK server for emacs SLIME environment.</td>
</tr>
<tr>
<td><a href="https://github.com/pallet/ritz/tree/develop/nrepl">ritz-nrepl</a></td>
<td>nREPL server.</td>
</tr>
<tr>
<td><a href="https://github.com/pallet/ritz/tree/develop/debugger">ritz-debugger</a></td>
<td>A library for using the JVM JPDA debugger in clojure.</td>
</tr>
<tr>
<td><a href="https://github.com/pallet/ritz/tree/develop/repl-utils">ritz-repl-utils</a></td>
<td>A library of functions useful when working in a clojure REPL.</td>
</tr>
<tr>
<td><a href="https://github.com/pallet/ritz/tree/develop/swank">ritz-swank</a></td>
<td>SWANK server for emacs SLIME environment</td>
</tr>
</tbody>
</table>

## Features

- Break on exceptions and breakpoints.
- Allows stepping from breakpoints
- Allows evaluation of expressions in the context of a stack frame
- Inspection of locals in any stack frame
- Disassembly of functions from symbol or stack frame

Should work with any version of clojure from 1.2.0.

## Install

The install has two parts. The first is to install the slime components into
emacs (if you are not using jack-in), and the second is to enable
[Leiningen](http://github.com/technomancy/leiningen) to use ritz.

To try Ritz without destroying your swank-clojure install, you may wish to back
up your .emacs file and .emacs.d directory. Ritz uses a different version of
slime than [swank-clojure](https://github.com/technomancy/swank-clojure).

### SLIME

The easiest way to install a compatible version of slime is to use the emacs
packaging system `package.el` - download the
[package file](https://github.com/downloads/pallet/ritz/slime-20101113.1.tar)
and install with `M-x package-install-file` (pass the path to the downloaded
package file, no un-tar required).

(Alternatively, the same version of slime is in the ritz source tree at
slime/slime.el.)

Install the slime-ritz.el contrib from
[marmalade](http://marmalade-repo.org/). If you are using a SNAPSHOT version of
Ritz, you probably will need to install slime-ritz.el from
[melpa](http://melpa.milkbox.net/packages/) instead.

Note that on Emacs 23 you will need to
[install](http://tromey.com/elpa/install.html) package.el.

To add the repositories to the emacs package system, you will need the following
in your `.emacs` file, and eval it or restart emacs.

```elisp
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
```

### Lein 2

To make ritz available in all your projects, add the lein-ritz plugin to your
`:user` profile in `~/.lein/profiles.clj`. This is the preferred over enabling
ritz on a per project basis.

```clj
{:user {:plugins [[lein-ritz "0.3.2"]]}}
```

To enable ritz on a per project basis, add it to your `project.clj`'s :dev
profile.

```clj
{:dev {:plugins [[lein-ritz "0.3.2"]]}}
```

In either case, start a swank server with `lein ritz` inside your project
directory, and then use `M-x slime-connect` in emacs to connect to it.

### Lein 1

To make ritz available in all your projects, install the lein-ritz plugin.

```
lein plugin install lein-ritz "0.3.2"
```

Add `[lein-ritz "0.3.2"]` to your project.clj `:dev-dependencies`.


Start a swank server with `lein ritz` inside your project directory,
and then use `M-x slime-connect` in emacs to connect to it.

### Experimental 'jack-in' support

There is experimental support to "jack in" from an existing project
using [Leiningen](http://github.com/technomancy/leiningen):

For "jack-in" to work, you can not have SLIME installed.

* Install `clojure-mode` either from
[Marmalade](http://marmalade-repo.org) or from
[git](http://github.com/technomancy/clojure-mode).
* lein plugin install lein-ritz "0.3.2"
* in your .emacs file, add the following and evalulate it (or restart emacs)

```lisp
(setq clojure-swank-command
(if (or (locate-file "lein" exec-path) (locate-file "lein.bat" exec-path))
"lein ritz-in %s"
"echo \"lein ritz-in %s\" | $SHELL -l"))
```
* From an Emacs buffer inside a project, invoke `M-x clojure-jack-in`

## Maven Plugin

See [zi](https://github.com/pallet/zi).

## Source Browsing

If you would like to browse into java sources then add the source jars
to your `:dev-dependencies`, with the appropriate versions.

[org.clojure/clojure "1.2.1" :classifier "sources"]

For clojure 1.2.0, you will need the following instead:

[clojure-source "1.2.0"]

To be able to see Java sources when using openjdk, add the `src.zip` to you
classpath. e.g. for lein:

:dev-resources-path "/usr/lib/jvm/java-6-openjdk/src.zip"

### lein 2

In lein 2 this is simplified. You can add a hook to your user profile to have
source jars automatically put on the classpath.

:hooks [ritz.add-sources]

To obtain source jars for your project you can use

lein pom; mvn dependency:sources;

## USAGE

To run ritz with debugging capabilities (notice that it will need to spawn an
extra JVM process):

lein ritz

To run ritz with no debugging capabilities:

lein ritz 4005 localhost :server-ns ritz.repl

To run with a maven project:

mvn zi:ritz

### Breakpoints

To set a breakpoint, put the cursor on the line where you want a breakpoint, and
`M-x slime-line-breakpoint`.

Note that breakpoints disappear on recompilation at the moment.

To list breakpoints, use `M-x slime-list-breakpoints` or press `b` in the
`slime-selector`. In the listing you can use the following keys

- e enable
- d disable
- g refresh list
- k remove breakpoint
- v view source location

### Exception filtering

To filter which exceptions break into the debugger, there is an `IGNORE`
restart, that will ignore an exception type.

To list breakpoints, use `M-x slime-list-exception-filters` or press `f` in the
`slime-selector`. In the listing you can use the following keys

- e enable
- d disable
- g refresh list
- k remove exception filter
- s save the exception filters

Exception filters are saved to .ritz-exception-filters, which is read by ritz on
startup.

### Javadoc

Specify the location of local javadoc using `slime-javadoc-local-paths` in
your `.emacs` file. Note that this requires a connection, so should be in
your `slime-connected-hook` or `ritz-connected-hook`. e.g.

(defun my-javadoc-setup ()
(slime-javadoc-local-paths
(list (concat (expand-file-name "~") "/lisp/docs/java"))))

(add-hook 'slime-connected-hook 'my-javadoc-setup)

The command `slime-javadoc`, bound to `C-c b` by default, will open javadoc in
the browser you have set up in emacs.

### SLIME configuration

If you use slime with multiple lisps, you can isolate clojure specific
setup by using `ritz-connected-hook` and `ritz-repl-mode-hook`.

## Open Problems

Recompilation of clojure code creates new classes, with the same location as the
code they replace. Recompilation therefore looses breakpoints, which are set on
the old code. Setting breakpoints by line number finds all the old code too.

## Roadmap

Allow customisations of which exceptions are trapped by ritz.

A pure JDI backend, that doesn't require swank in the target VM is certainly a
possibility.

A slime-eval-symbol-at-point would be useful (requires determining the frame
in the current sldb stacktrace using file and line number).

Add watchpoints with logging of locals to an emacs buffer or file.

## Use Cases

### Development

Run swank server and JDI debugger in the same process to have a single JVM and keep
memory usage down

### Debug

Run swank and debugger in a seperate JVM process. Attach to any -Xdebug enabled
JVM process.

### Production server

Run swank server in process and attach slime as required. This requires the
debugger to run in process.

## History

Ritz was originally based on
[swank-clojure](http://github.com/technomancy/swank-clojure) and was
originally called swank-clj. The last swank-clj release is 0.1.6.

## License

Expand Down
47 changes: 46 additions & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
# Release Notes

Current release is 0.3.2.
Current release is 0.4.0.

## 0.4.0

This is a major refactoring into individual sub-projects, with the introduction
of nrepl support.

# features

- Add nrepl-ritz-jack-in command

- Add nrepl-ritz-toggle-nrepl-logging
Toggles :trace level logging in the nrepl server.

- Add nREPL complete middleware implementation using simple-complete

- Add apropos, doc, and describe-symbol nrepl middleware

- Add javadoc middleware

- Add a test nrepl transport

- Add resolve of Java symbols in javadoc using ns-interns

- Factor out projects for repl-utils, debugger, swank and nrepl

- Update to nrepl 0.2.0-beta9 and add op metadata

- Make nrepl-ritz depend on the nrepl elisp package

- Add port of sldb to nrepl-ritz.el
The port isn't completely functional yet, but will allow examination of
stacktraces.

- Disable break on exception by default
Adds bindings for C-c C-x b to slime-break-on-exception. With a prefix it
will disable break on exception

- Add nrepl-ritz-undefine-symbol

- Add nrepl-ritz-javadoc
Bound to C-x b, displays javadoc for the symbol at point

- Refactor thread listing
Removes the associng of the thread list onto the context from the
ritz.jpda.debug/thread-list function, and pushes it into the swank code.

## 0.3.2

Expand Down
10 changes: 10 additions & 0 deletions debugger/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/target
/lib
/classes
/checkouts
pom.xml
*.jar
*.class
.lein-deps-sum
.lein-failures
.lein-plugins
23 changes: 23 additions & 0 deletions debugger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Ritz Debugger

JPDA Debugger library for clojure.

## Usage

The library provides various layers for using JPDA/JDI in clojure.

[API Docs](http://palletops.com/ritz/0.4/debugger/api/)

## Install

Add the following to your `:dependencies`:

```clj
[ritz/ritz-debugger "0.4.0"]
```

## License

Copyright © 2012 Hugo Duncan

Distributed under the Eclipse Public License.
11 changes: 11 additions & 0 deletions debugger/profiles.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{:codox {:codox {:writer codox-md.writer/write-docs
:output-dir "../doc/0.4/debugger/api"}
:dependencies [[codox-md "0.1.0"]]
:pedantic :warn}
:marginalia {:pedantic :warn
:dir "../doc/0.4/debugger/source"}
:release
{:set-version
{:updates [{:path "README.md"
:no-snapshot true
:search-regex #"ritz/ritz-debugger \"\d+\.\d+\.\d+\""}]}}}
7 changes: 7 additions & 0 deletions debugger/project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(defproject ritz/ritz-debugger "0.4.0"
:description "Ritz debugger"
:url "https://github.com/pallet/ritz"
:scm {:url "git@github.com:pallet/ritz.git"}
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[ritz/ritz-repl-utils "0.4.0"]])
Loading

0 comments on commit 3d617e0

Please sign in to comment.