Skip to content

Commit

Permalink
Update README, simplify build.clj
Browse files Browse the repository at this point in the history
  • Loading branch information
hlship committed Jul 6, 2023
1 parent afab265 commit b9aa209
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 47 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@

# clojure-humanize
# org.clj-commons/humanize

[![Clojars Project](https://img.shields.io/clojars/v/org.clj-commons/humanize.svg)](https://clojars.org/org.clj-commons/humanize)
![clojure.yml](https://github.com/clj-commons/humanize/actions/workflows/clojure.yml/badge.svg?event=push)
[![cljdoc badge](https://cljdoc.org/badge/org.clj-commons/humanize)](https://cljdoc.org/d/org.clj-commons/humanize)

A Clojure(script) library to produce human-readable strings for numbers, dates, and more
based on similar libraries in other languages

## Installation

__([via Clojars](https://clojars.org/clojure-humanize))__

[![Clojars Project](http://clojars.org/clojure-humanize/latest-version.svg)](http://clojars.org/clojure-humanize)

## Usage

* [numberword](#numberword)
Expand Down
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0-beta-1
63 changes: 23 additions & 40 deletions build.clj
Original file line number Diff line number Diff line change
@@ -1,48 +1,31 @@
;; clj -T:build <var>

(ns build
(:require [clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as dd]))
(:require [clojure.tools.build.api :as build]
[net.lewisship.build :as b]
[clojure.string :as str]))

(def lib 'org.clj-commons/humanize)
(def version "1.0-beta-1")
(def lib 'org.clj-commons/pretty)
(def version (-> "VERSION.txt" slurp str/trim))

(def base-opts
{:lib lib
:basis (b/create-basis {:project "deps.edn"})
:src ["src"]
:class-dir "target/classes"})
(def jar-params {:project-name lib
:version version})

(defn clean [_]
(b/delete {:path "target"})
(b/delete {:path "cljs-test-runner-out"}))
(defn clean
[_params]
(build/delete {:path "target"}))

(defn jar
"Build a JAR."
[opts]
(let [{:keys [src class-dir] :as opts'} (-> base-opts
(merge opts)
(assoc :jar-file (format "target/%s-%s.jar" (name lib) version)
:version version))]
(b/write-pom opts')
(b/copy-dir {:src-dirs src
:target-dir class-dir})
(b/jar opts')
opts'))

(defn deploy-clojars
"Deploy to Clojars."
[{:keys [jar-file class-dir] :as opts}]
(let [opts' (merge opts
{:installer :remote
:artifact (b/resolve-path jar-file)
:pom-file (b/pom-path {:lib lib
:class-dir class-dir})})]
(dd/deploy opts')
opts'))
[_params]
(b/create-jar jar-params))

(defn deploy
"Build and deploy the JAR to Clojars. Defaults to a snapshot,
specify :release true for a final release."
[opts]
(-> opts
jar
deploy-clojars))
[_params]
(clean nil)
(b/deploy-jar (assoc (jar nil) :sign-artifacts? false)))

(defn codox
[_params]
(b/generate-codox {:project-name lib
:version version}))

4 changes: 4 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
com.widdindustries/cljc.java-time {:mvn/version "0.1.21"}
henryw374/js-joda {:mvn/version "3.2.0-0"}}
:paths ["src"]

:net.lewisship.build/scm
{:url "https://github.com/clj-commons/humanize"}

:aliases
;; clj -X:test
{:test {:extra-paths ["test"]
Expand Down

0 comments on commit b9aa209

Please sign in to comment.