Skip to content

Commit

Permalink
Introducing DevCards tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xcthulhu committed Mar 25, 2016
2 parents a318bb3 + 8ce2895 commit 094cb18
Show file tree
Hide file tree
Showing 12 changed files with 421 additions and 107 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
/.lein*
/pom.xml*
/.env
.DS_Store
.DS_Store
/dev-resources/public/js/compiled
figwheel_server.log
/.idea
*.iml
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
> This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md) as of **Aug 16, 2014**.
## v1.8.0-beta1 - 2016 Feb 1
## v1.8.1 - 2016 Mar 4

```clojure
[com.taoensso/sente "1.8.1"]
```

* **Hotfix**: add missing `event?` alias

## v1.8.0 - 2016 Feb 16

> This is a major **non-breaking** feature release, enjoy! :-)
Expand All @@ -10,14 +18,14 @@
* **New**: Added server adapters for Node.js (generic, Express, Dog Fort) [#194 @theasp @whamtet]
* **New**: Added official `ajax-lite` alias (Sente Ajax req util)
* **New**: Added "carpet" example [#187 @ebellani]
* **New**: CSRF token header is now compatible with ring.middleware defaults [#198 @theasp]
* **Impl.**: Decoupled notion that clj<=>server, cljs<=>client [thanks to @theasp for assistance]
* **Impl.**: Refactor web-server adapter interfaces

```clojure
[com.taoensso/sente "1.8.0-beta1"]
[com.taoensso/sente "1.8.0"]
```


## v1.7.0 - 2015 Dec 8

> As v1.7.0-RC1 with some updated dependencies, improved reference example
Expand All @@ -26,7 +34,6 @@
[com.taoensso/sente "1.7.0"]
```


## v1.7.0-RC1 - 2015 Sep 28

> This is a significant non-breaking feature release. Includes an important fix for Immutant users.
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
**[CHANGELOG]** | [API] | current [Break Version]:

```clojure
[com.taoensso/sente "1.7.0"] ; Stable
[com.taoensso/sente "1.8.0-beta1"] ; Dev, see CHANGELOG for details
[com.taoensso/sente "1.8.1"] ; Stable
```

Want to help [support taoensso/open-source]?

# Sente

### Realtime web comms for Clojure/Script
Expand Down Expand Up @@ -54,7 +55,7 @@ So you can ignore the underlying protocol and deal directly with Sente's unified
Add the necessary dependency to your project:

```clojure
[com.taoensso/sente "1.7.0"]
[com.taoensso/sente "1.8.1"]
```

### On the server (Clojure) side
Expand Down Expand Up @@ -215,6 +216,7 @@ Link | Description
[@seancorfield/om-sente] | ??
[@ebellani/carpet] | Web+mobile interface for a remmitance application
[@theasp/sente-nodejs-example] | Ref. example adapted for Node.js servers ([Express], [Dog Fort])
[@timothypratley/snakelake] | Multiplayer snake game with screencast walkthrough
Your link here? | **PR's welcome!**

### FAQ
Expand Down Expand Up @@ -344,6 +346,7 @@ Copyright &copy; 2014-2016 [Peter Taoussanis].
[@ptaoussanis]: https://www.taoensso.com
[More by @ptaoussanis]: https://www.taoensso.com
[Break Version]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md
[support taoensso/open-source]: http://taoensso.com/clojure/backers

<!--- Standard links (repo specific) -->
[CHANGELOG]: https://github.com/ptaoussanis/sente/releases
Expand Down Expand Up @@ -377,6 +380,7 @@ Copyright &copy; 2014-2016 [Peter Taoussanis].
[@seancorfield/om-sente]: https://github.com/seancorfield/om-sente
[@ebellani/carpet]: https://github.com/ebellani/carpet
[@theasp/sente-nodejs-example]: https://github.com/theasp/sente-nodejs-example
[@timothypratley/snakelake]: https://github.com/timothypratley/snakelake
[Express]: http://expressjs.com/
[Dog Fort]: https://github.com/whamtet/dogfort

Expand Down
16 changes: 8 additions & 8 deletions example-project/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.taoensso.examples/sente "1.8.0-beta1"
(defproject com.taoensso.examples/sente "1.8.1"
:description "Sente, reference web-app example project"
:url "https://github.com/ptaoussanis/sente"
:license {:name "Eclipse Public License"
Expand All @@ -17,19 +17,19 @@
[org.clojure/core.async "0.2.374"]
[org.clojure/tools.nrepl "0.2.12"] ; Optional, for Cider

[com.taoensso/sente "1.8.0-beta1"] ; <--- Sente
[com.taoensso/timbre "4.2.1"]
[com.taoensso/sente "1.8.1"] ; <--- Sente
[com.taoensso/timbre "4.3.1"]

;;; ---> Choose (uncomment) a supported web server <---
[http-kit "2.1.21-alpha2"]
[http-kit "2.2.0-alpha1"]
;; [org.immutant/web "2.1.0"] ; v2.1+ recommended
;; [nginx-clojure/nginx-clojure-embed "0.4.2"] ; Needs v0.4.2+

[ring "1.4.0"]
[ring/ring-defaults "0.1.5"] ; Includes `ring-anti-forgery`, etc.
[ring/ring-defaults "0.2.0"] ; Includes `ring-anti-forgery`, etc.
;; [ring-anti-forgery "1.0.0"]

[compojure "1.4.0"] ; Or routing lib of your choice
[compojure "1.5.0"] ; Or routing lib of your choice
[hiccup "1.0.5"] ; Optional, just for HTML

;;; Transit deps optional; may be used to aid perf. of larger data payloads
Expand All @@ -41,8 +41,8 @@
[[lein-pprint "1.1.2"]
[lein-ancient "0.6.8"]
[com.cemerick/austin "0.1.6"]
[lein-cljsbuild "1.1.2"]
[cider/cider-nrepl "0.10.2"] ; Optional, for use with Emacs
[lein-cljsbuild "1.1.3"]
[cider/cider-nrepl "0.11.0"] ; Optional, for use with Emacs
]

:cljsbuild
Expand Down
5 changes: 3 additions & 2 deletions example-project/src/example/client.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@

(sente/ajax-lite "/login"
{:method :post
:params {:user-id (str user-id)
:csrf-token (:csrf-token @chsk-state)}}
:headers {:X-CSRF-Token (:csrf-token @chsk-state)}
:params {:user-id (str user-id)}}

(fn [ajax-resp]
(->output! "Ajax login response: %s" ajax-resp)
(let [login-successful? true ; Your logic here
Expand Down
17 changes: 6 additions & 11 deletions example-project/src/example/server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,12 @@
(route/not-found "<h1>Page not found</h1>"))

(def main-ring-handler
(let [ring-defaults-config
(assoc-in ring.middleware.defaults/site-defaults
[:security :anti-forgery]
{:read-token (fn [req] (-> req :params :csrf-token))})]

;; NB: Sente requires the Ring `wrap-params` + `wrap-keyword-params`
;; middleware to work. These are included with
;; `ring.middleware.defaults/wrap-defaults` - but you'll need to ensure
;; that they're included yourself if you're not using `wrap-defaults`.
(ring.middleware.defaults/wrap-defaults
ring-routes ring-defaults-config)))
"**NB**: Sente requires the Ring `wrap-params` + `wrap-keyword-params`
middleware to work. These are included with
`ring.middleware.defaults/wrap-defaults` - but you'll need to ensure
that they're included yourself if you're not using `wrap-defaults`."
(ring.middleware.defaults/wrap-defaults
ring-routes ring.middleware.defaults/site-defaults))

;;;; Sente event handlers

Expand Down
105 changes: 57 additions & 48 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.taoensso/sente "1.8.0-beta1"
(defproject com.taoensso/sente "1.8.2-SNAPSHOT"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Realtime web comms for Clojure/Script"
:url "https://github.com/ptaoussanis/sente"
Expand All @@ -13,75 +13,84 @@
:dependencies
[[org.clojure/clojure "1.5.1"]
[org.clojure/core.async "0.2.374"]
[com.taoensso/encore "2.33.0"]
[com.taoensso/encore "2.44.0"]
[org.clojure/tools.reader "0.10.0"]
[com.taoensso/timbre "4.2.1"]]
[com.taoensso/timbre "4.3.1"]]

:cljx
{:builds
[{:source-paths ["src"] :rules :clj :output-path "target/generated/src/clj"}
{:source-paths ["src"] :rules :cljs :output-path "target/generated/src/cljs"}]}

:source-paths ["src" "target/generated/src/clj"]
:resource-paths ["target/generated/src/cljs"]

:profiles
{;; :default [:base :system :user :provided :dev]
:server-jvm {:jvm-opts ^:replace ["-server"]}
{:server-jvm {:jvm-opts ^:replace ["-server"]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
:test {:dependencies [[com.cognitect/transit-clj "0.8.285"]
[com.cognitect/transit-cljs "0.8.237"]
[org.clojure/test.check "0.9.0"]]
:plugins []}
[compojure "1.5.0"]
[ring "1.4.0"]
[ring/ring-defaults "0.2.0"]
[devcards "0.2.1-6"]]
:plugins [[lein-figwheel "0.5.0-6"
:exclusions [org.clojure/clojure]]]}

:provided {:dependencies [[org.clojure/clojurescript "1.7.170"]]}

:dev
[:1.7 :test
{:dependencies
[[http-kit "2.1.21-alpha2"]
[org.immutant/web "2.1.2"]
[nginx-clojure "0.4.3"]]
:plugins
[;;; These must be in :dev, Ref. https://github.com/lynaghk/cljx/issues/47:
[com.keminglabs/cljx "0.6.0"]
[lein-cljsbuild "1.1.2"]
;;
[lein-pprint "1.1.2"]
[lein-ancient "0.6.8"]
;; [com.cemerick/austin "0.1.4"]
[com.cemerick/clojurescript.test "0.3.3"]
[lein-codox "0.9.1"]]}]}

:cljx
{:builds
[{:source-paths ["src" "test"] :rules :clj :output-path "target/classes"}
{:source-paths ["src" "test"] :rules :cljs :output-path "target/classes"}]}
:provided {:dependencies [[org.clojure/clojurescript "1.8.34"]]}

:cljsbuild
{:test-commands {"node" ["node" :node-runner "target/main.js"]
"phantom" ["phantomjs" :runner "target/main.js"]}
:builds
[{:id :main
:source-paths ["src" "test" "target/classes"]
:compiler {:output-to "target/main.js"
:optimizations :advanced
:pretty-print false}}]}
:dev [:1.8 :test
{:dependencies
[[http-kit "2.2.0-alpha1"]
[org.immutant/web "2.1.3"]
[nginx-clojure "0.4.4"]]
:plugins
[;;; These must be in :dev, Ref. https://github.com/lynaghk/cljx/issues/47:
[com.keminglabs/cljx "0.6.0"
:exclusions [org.clojure/clojure com.cemerick/piggieback]]
[lein-cljsbuild "1.1.3"]
[lein-codox "0.9.4"
:exclusions [org.clojure/clojure]]]
:source-paths ["src" "target/generated/src/clj" "test"]
:resource-paths ["target/generated/src/cljs"]
:test-paths ["src" "target/generated/src/clj" "test"]
:figwheel {:ring-handler taoensso.sente.test-server/relay-app}
:clean-targets ^{:protect false} [:target-path "dev-resources"]
:cljsbuild {:builds
[{:id "devcards"
:source-paths ["src" "test" "target/generated/src/cljs"]
:figwheel {:devcards true}
:compiler {:main "taoensso.sente.devcards"
:asset-path "js/compiled/devcards_out"
:output-to "dev-resources/public/js/compiled/sente_devcards.js"
:output-dir "dev-resources/public/js/compiled/devcards_out"
:source-map-timestamp true}}]}}]}

:test-paths ["test" "src"]
:prep-tasks [["cljx" "once"] "javac" "compile"]
:codox
{:language :clojure ; [:clojure :clojurescript] ; No support?
:source-paths ["target/classes"]
:source-paths ["target/generated/src/clj"]
:source-uri
{#"target/classes"
"https://github.com/ptaoussanis/sente/blob/master/src/{classpath}x#L{line}"
"https://github.com/ptaoussanis/sente/blob/master/src/{classpath}#L{line}"
#".*"
"https://github.com/ptaoussanis/sente/blob/master/{filepath}#L{line}"}}

:aliases
{"test-all" ["do" "clean," "cljx" "once,"
"with-profile" "+1.6:+1.7:+1.8" "test,"
;; "with-profile" "+test" "cljsbuild" "test"
]
"build-once" ["do" "cljx" "once," "cljsbuild" "once"]
{"build-once" ["do" "cljx" "once," "cljsbuild" "once"]
"test-all" ["do"
"clean,"
"build-once,"
"test,"]
"devcards" ["do"
"clean,"
"cljx" "once,"
"figwheel,"]
"deploy-lib" ["do" "build-once," "deploy" "clojars," "install"]
"start-dev" ["with-profile" "+server-jvm" "repl" ":headless"]}

:repositories
{"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"})
{"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"})
Loading

0 comments on commit 094cb18

Please sign in to comment.