Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xsc/cpath-clj
Collect Files in Classpath Directories
https://github.com/xsc/cpath-clj
Last synced: 10 days ago
JSON representation
Collect Files in Classpath Directories
- Host: GitHub
- URL: https://github.com/xsc/cpath-clj
- Owner: xsc
- License: mit
- Created: 2014-05-27T16:09:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-05T13:09:23.000Z (almost 9 years ago)
- Last Synced: 2024-04-14T04:55:51.688Z (7 months ago)
- Language: Clojure
- Size: 16.6 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cpath-clj
__cpath-clj__ is a small library to transparently collect files on the classpath based on a
given base directory. Since that directory might be located inside a JAR this is not always
trivial.[![Build Status](https://travis-ci.org/xsc/cpath-clj.svg?branch=master)](https://travis-ci.org/xsc/cpath-clj)
[![endorse](https://api.coderwall.com/xsc/endorsecount.png)](https://coderwall.com/xsc)## Usage
__Leiningen ([via Clojars](https://clojars.org/cpath-clj))__
```clojure
[cpath-clj "0.1.2"]
```__REPL__
```clojure
(require '[cpath-clj.core :as cp])(cp/resources "static")
;; => {"/js/main.js" [#]
;; "/js/lib.js" [#]}
````cpath-clj.core.resources` finds all locations on the classpath with the path `static`,
then collects the URIs of all resources residing under those locations.You can have a more targeted collection by supplying either a `java.io.File`, `java.net.URI`
or `java.net.URL` - e.g. to traverse the directory `static` currently being the first match
on the classpath:```clojure
(cp/resources (clojure.java.io/resource "static"))
;; => {"/js/main.js" [#]}
```## License
```
The MIT License (MIT)Copyright (c) 2014-2016 Yannick Scherer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```