Skip to content

Commit

Permalink
Update plugin guide to mention plural path keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Feb 23, 2012
1 parent ae37356 commit c34c912
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions doc/PLUGINS.md
Expand Up @@ -170,6 +170,9 @@ version of Clojure from within a Leiningen plugin, you can use
'(println "hello from" *clojure-version*))
```

In Leiningen 1.x, plugins had access to monolithic Clojure Contrib.
This is no longer true in 2.x.

## Upgrading Existing Plugins

Earlier versions of Leiningen had a few differences in the way plugins
Expand Down Expand Up @@ -219,20 +222,31 @@ plugin provides an example of a compatibility shim:
```clj
(defn eval-in-project
"Support eval-in-project in both Leiningen 1.x and 2.x."
[& args]
(let [eip (or (try (require 'leiningen.core.eval)
(resolve 'leiningen.core.eval/eval-in-project)
(catch java.io.FileNotFoundException _))
(try (require 'leiningen.compile)
(resolve 'leiningen.compile/eval-in-project)
(catch java.io.FileNotFoundException _)))]
(apply eip args)))
[project form init]
(let [[eip two?] (or (try (require 'leiningen.core.eval)
[(resolve 'leiningen.core.eval/eval-in-project)
true]
(catch java.io.FileNotFoundException _))
(try (require 'leiningen.compile)
[(resolve 'leiningen.compile/eval-in-project)]
(catch java.io.FileNotFoundException _)))]
(if two?
(eip project form init)
(eip project form nil nil init))))
```

Of course if the function has changed arities or has disappeared
entirely this may not be feasible, but it should suffice in most
cases.

Another key change is that `:source-path`, `:resources-path`,
`:java-source-path`, and `:test-path` have changed to
`:sources-paths`, `:resource-paths`, `:java-source-paths`, and
`:test-paths`, and they should be vectors now instead of single
strings. The old `:dev-resources` key is now just another entry to the
`:resource-paths` vector that's only present when the `:dev` profile
is active.

Allowing the task to run outside a project directory is tricky to do
in a backwards-compatible way since 1.x is overly-clever and actually
inspects your argument list to figure out if it should pass in a
Expand Down

0 comments on commit c34c912

Please sign in to comment.