Skip to content

Commit

Permalink
[nop] Update project template
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Feb 29, 2024
1 parent 533dd0b commit 4c74895
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 81 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/build.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/graal-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Graal tests
on: [push, pull_request]

jobs:
test:
strategy:
matrix:
java: ['17']
os: [ubuntu-latest, macOS-latest, windows-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: ${{ matrix.java }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- uses: DeLaGuardo/setup-clojure@12.5
with:
lein: latest
bb: latest

- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: deps-${{ hashFiles('deps.edn') }}
restore-keys: deps-

- run: bb graal-tests
30 changes: 30 additions & 0 deletions .github/workflows/main-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Main tests
on: [push, pull_request]

jobs:
tests:
strategy:
matrix:
java: ['17', '18', '19']
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ matrix.java }}

- uses: DeLaGuardo/setup-clojure@12.5
with:
lein: latest

- uses: actions/cache@v4
id: cache-deps
with:
path: ~/.m2/repository
key: deps-${{ hashFiles('project.clj') }}
restore-keys: deps-

- run: lein test-all
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md)
This project uses Break Versioning (https://www.taoensso.com/break-versioning)

## v1.5.3 - 2022 Oct 27

Expand All @@ -8,7 +8,7 @@

> This is a major maintenance release that should be non-breaking for most users.
* **New**: Wiki docs at https://github.com/ptaoussanis/tempura/wiki
* **New**: Wiki docs at https://github.com/taoensso/tempura/wiki
* **New**: Add `new-tr-fn` for creating `tr` partials with fn-local cache.
* **BREAKING**: `wrap-ring-request` (alpha) API changes, see commit ed688af18de2 for details.

Expand Down
2 changes: 1 addition & 1 deletion FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: ptaoussanis
custom: "https://www.taoensso.com/clojure/backers"
custom: "https://www.taoensso.com/clojure"
File renamed without changes.
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<a href="https://www.taoensso.com" title="More stuff by @ptaoussanis at www.taoensso.com">
<img src="https://www.taoensso.com/taoensso-open-source.png" alt="Taoensso open-source" width="400"/></a>
<img src="https://www.taoensso.com/taoensso-open-source.png" alt="Taoensso open-source" width="350"/></a>

**[CHANGELOG]** | [API] | current [Break Version]:
**[CHANGELOG][]** | [API][] | current [Break Version][]:

```clojure
[com.taoensso/tempura "1.5.3"] ; See CHANGELOG for details
```

> See [here](https://taoensso.com/clojure/backers) if you're interested in helping support my open-source work, thanks! - Peter Taoussanis
> See [here][backers] if to help support my open-source work, thanks! - [Peter Taoussanis][Taoensso.com]
# Tempura: a pure Clojure/Script i18n translations library

## Objectives

* Tiny (**single fn**), **cross-platform all-Clojure API** for providing multilingual content.
* Match [gettext]'s convenience for **embedding default content** directly in code (optional).
* Match [gettext][]'s convenience for **embedding default content** directly in code (optional).
* Exceed `gettext`'s ability to handle **versioned content** through unique content ids.
* Work out-the-box with plain text, Hiccup, **Reactjs**, ...
* Easy, optional platform-appropriate support for simple **Markdown styles**.
Expand Down Expand Up @@ -68,7 +68,7 @@

```

See the [wiki docs] for a more detailed discussion of Tempura's resource search behaviour.
See the [wiki docs][] for a more detailed discussion of Tempura's resource search behaviour.

## Quickstart

Expand Down Expand Up @@ -153,7 +153,7 @@ And we're ready to go:
(tr [:example/invalid [:div "My **fallback** div"]]) ; => [:div "My " [:strong "fallback"] " div"]
```

And that's it, you know the [API]:
And that's it, you know the [API][]:

```clojure
(tr [opts locales resource-ids]) ; Without argument interpolation, or
Expand Down Expand Up @@ -196,7 +196,7 @@ I'll note that since the API is so pleasant, it's actually often much _less_ eff
If it's easy to use, it'll be easy to get your developers in the habit of writing content this way - which means that there's a trivial path to adding multilingual support whenever it makes sense to do so.

> See also the [wiki docs] for more info.
> See also the [wiki docs][] for more info.
## FAQ

Expand All @@ -218,7 +218,7 @@ As an example:

So performance is often on par with the best possible hand-optimized monolingual code.

#### How would you use this with [Reagent], etc.?
#### How would you use this with [Reagent][], etc.?

Tempura was specifically designed to work with Reactjs applications, and works great with Reagent out-the-box.

Expand All @@ -240,29 +240,27 @@ Shouldn't be hard to do, you'll just need a conversion tool to/from edn. Haven't

## Contacting me / contributions

Please use the project's [GitHub issues page] for all questions, ideas, etc. **Pull requests welcome**. See the project's [GitHub contributors page] for a list of contributors.
Please use the project's [GitHub issues page][] for all questions, ideas, etc. **Pull requests welcome**. See the project's [GitHub contributors page][] for a list of contributors.

Otherwise, you can reach me at [Taoensso.com]. Happy hacking!
Otherwise, you can reach me at [Taoensso.com][]. Happy hacking!

\- [Peter Taoussanis]
\- [Peter Taoussanis][Taoensso.com]

## License

Distributed under the [EPL v1.0] \(same as Clojure).
Copyright &copy; 2016-2022 [Peter Taoussanis].
Distributed under the [EPL v1.0][] \(same as Clojure).
Copyright &copy; 2016-2022 [Peter Taoussanis][Taoensso.com].

<!--- Standard links -->
[Taoensso.com]: https://www.taoensso.com
[Peter Taoussanis]: https://www.taoensso.com
[@ptaoussanis]: https://www.taoensso.com
[More by @ptaoussanis]: https://www.taoensso.com
[Break Version]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md
[Break Version]: https://github.com/taoensso/encore/blob/master/BREAK-VERSIONING.md
[backers]: https://taoensso.com/clojure/backers

<!--- Standard links (repo specific) -->
[CHANGELOG]: https://github.com/ptaoussanis/tempura/releases
[API]: http://ptaoussanis.github.io/tempura/
[GitHub issues page]: https://github.com/ptaoussanis/tempura/issues
[GitHub contributors page]: https://github.com/ptaoussanis/tempura/graphs/contributors
[CHANGELOG]: https://github.com/taoensso/tempura/releases
[API]: http://taoensso.github.io/tempura/
[GitHub issues page]: https://github.com/taoensso/tempura/issues
[GitHub contributors page]: https://github.com/taoensso/tempura/graphs/contributors
[EPL v1.0]: https://raw.githubusercontent.com/ptaoussanis/tempura/master/LICENSE
[Hero]: https://raw.githubusercontent.com/ptaoussanis/tempura/master/hero.png "Title"

Expand All @@ -271,4 +269,4 @@ Copyright &copy; 2016-2022 [Peter Taoussanis].
[Reagent]: https://github.com/reagent-project/reagent
[tutorial]: https://gist.github.com/field-theory/b7c05953e32645d880eae382171a85d7
[@field-theory]: https://github.com/field-theory
[wiki docs]: https://github.com/ptaoussanis/tempura/wiki
[wiki docs]: https://github.com/taoensso/tempura/wiki
10 changes: 10 additions & 0 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{:paths ["bb"]
:tasks
{:requires ([graal-tests])
graal-tests
{:doc "Run Graal native-image tests"
:task
(do
(graal-tests/uberjar)
(graal-tests/native-image)
(graal-tests/run-tests))}}}
36 changes: 36 additions & 0 deletions bb/graal_tests.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bb

(ns graal-tests
(:require
[clojure.string :as str]
[babashka.fs :as fs]
[babashka.process :refer [shell]]))

(defn uberjar []
(let [command "lein with-profiles +graal-tests uberjar"
command
(if (fs/windows?)
(if (fs/which "lein")
command
;; Assume PowerShell powershell module
(str "powershell.exe -command " (pr-str command)))
command)]

(shell command)))

(defn executable [dir name]
(-> (fs/glob dir (if (fs/windows?) (str name ".{exe,bat,cmd}") name))
first
fs/canonicalize
str))

(defn native-image []
(let [graalvm-home (System/getenv "GRAALVM_HOME")
bin-dir (str (fs/file graalvm-home "bin"))]
(shell (executable bin-dir "gu") "install" "native-image")
(shell (executable bin-dir "native-image") "-jar" "target/graal-tests.jar" "--no-fallback" "graal_tests")))

(defn run-tests []
(let [{:keys [out]} (shell {:out :string} (executable "." "graal_tests"))]
(assert (str/includes? out "loaded") out)
(println "Native image works!")))
70 changes: 39 additions & 31 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,40 +1,54 @@
(defproject com.taoensso/tempura "1.5.3"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Pure Clojure/Script i18n translations library"
:url "https://github.com/ptaoussanis/tempura"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"
:distribution :repo
:comments "Same as Clojure"}
:min-lein-version "2.3.3"
:global-vars
{*warn-on-reflection* true
*assert* true
*unchecked-math* false #_:warn-on-boxed}
:description "Simple text localization for Clojure/Script applications"
:url "https://github.com/taoensso/tempura"

:license
{:name "Eclipse Public License - v 1.0"
:url "https://www.eclipse.org/legal/epl-v10.html"}

:dependencies
[[com.taoensso/encore "3.31.0"]]

:plugins
[[lein-pprint "1.3.2"]
[lein-ancient "0.7.0"]
[lein-codox "0.10.8"]
[lein-cljsbuild "1.1.8"]]
:test-paths ["test" #_"src"]

:profiles
{;; :default [:base :system :user :provided :dev]
:server-jvm {:jvm-opts ^:replace ["-server"]}
:provided {:dependencies [[org.clojure/clojurescript "1.11.60"]
[org.clojure/clojure "1.11.1"]]}
:c1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]}
:c1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]}
:c1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}

:depr {:jvm-opts ["-Dtaoensso.elide-deprecated=true"]}
:dev [:c1.11 :test :server-jvm :depr]
:test {:dependencies [[org.clojure/test.check "1.1.1"]]}}
:graal-tests
{:source-paths ["test"]
:main taoensso.graal-tests
:aot [taoensso.graal-tests]
:uberjar-name "graal-tests.jar"
:dependencies
[[org.clojure/clojure "1.11.1"]
[com.github.clj-easy/graal-build-time "1.0.5"]]}

:dev
{:jvm-opts ["-server" "-Dtaoensso.elide-deprecated=true"]

:global-vars
{*warn-on-reflection* true
*assert* true
*unchecked-math* false #_:warn-on-boxed}

:dependencies
[[org.clojure/test.check "1.1.1"]]

:plugins
[[lein-pprint "1.3.2"]
[lein-ancient "0.7.0"]
[lein-cljsbuild "1.1.8"]
[com.taoensso.forks/lein-codox "0.10.10"]]

:test-paths ["src" "test"]
:codox
{:language #{:clojure :clojurescript}
:base-language :clojure}}}

:cljsbuild
{:test-commands {"node" ["node" "target/test.js"]}
Expand All @@ -54,15 +68,9 @@

:aliases
{"start-dev" ["with-profile" "+dev" "repl" ":headless"]
"build-once" ["do" ["clean"] ["cljsbuild" "once"]]
"deploy-lib" ["do" ["build-once"] ["deploy" "clojars"] ["install"]]
"build-once" ["do" ["clean"] "cljsbuild" "once"]

"test-cljs" ["with-profile" "+test" "cljsbuild" "test"]
"test-all"
["do" ["clean"]
"with-profile" "+c1.11:+c1.10:+c1.9" "test,"
"test-cljs"]}

:repositories
{"sonatype-oss-public"
"https://oss.sonatype.org/content/groups/public/"})
"test-clj" ["with-profile" "+c1.11:+c1.10:+c1.9" "test"]
"test-cljs" ["with-profile" "+test" "cljsbuild" "test"]
"test-all" ["do" ["clean"] ["test-clj"] ["test-cljs"]]})
5 changes: 5 additions & 0 deletions test/taoensso/graal_tests.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns taoensso.graal-tests
(:require [taoensso.tempura :as tempura])
(:gen-class))

(defn -main [& args] (println "Namespace loaded successfully"))

0 comments on commit 4c74895

Please sign in to comment.