[Git][java-team/bidi-clojure][upstream] New upstream version 2.1.6

Louis-Philippe Véronneau gitlab at salsa.debian.org
Wed Dec 30 19:05:08 GMT 2020



Louis-Philippe Véronneau pushed to branch upstream at Debian Java Maintainers / bidi-clojure


Commits:
12e72f1a by Louis-Philippe Véronneau at 2020-12-26T16:22:10-05:00
New upstream version 2.1.6
- - - - -


9 changed files:

- + .circleci/config.yml
- − .travis.yml
- README.md
- − circle.yml
- project.clj
- src/bidi/bidi.cljc
- src/bidi/vhosts.clj
- test/bidi/bidi_test.cljc
- test/bidi/vhosts_test.clj


Changes:

=====================================
.circleci/config.yml
=====================================
@@ -0,0 +1,27 @@
+version: 2
+
+jobs:
+  test:
+    docker:
+      - image: circleci/clojure:lein-2.8.1
+
+    steps:
+      - checkout
+      - restore_cache:
+          keys:
+            - clj-deps-{{ checksum "project.clj" }}
+
+      - run: lein test
+      - run: lein test-cljs
+      - save_cache:
+          paths:
+            - ~/.m2/repository
+            - ~/.lein
+
+          key: clj-deps-{{ checksum "project.clj" }}
+
+workflows:
+  version: 2
+  test:
+    jobs:
+      - test


=====================================
.travis.yml deleted
=====================================
@@ -1,6 +0,0 @@
-sudo: false
-language: clojure
-lein: lein2
-cache:
-  directories:
-    - $HOME/.m2


=====================================
README.md
=====================================
@@ -158,8 +158,8 @@ use them together.
 
 Add the following dependency to your `project.clj` file
 
-[![Clojars Project](http://clojars.org/bidi/latest-version.svg)](http://clojars.org/bidi)
-[![Build Status](https://travis-ci.org/juxt/bidi.png)](https://travis-ci.org/juxt/bidi) [![CircleCIStatus](https://circleci.com/gh/juxt/bidi.svg?style=shield&circle-token=d604205dab0328029e95202a4344e6a1082b79c2)](https://circleci.com/gh/juxt/bidi)
+[![Clojars Project](https://clojars.org/bidi/latest-version.svg)](http://clojars.org/bidi)
+[![Build Status](https://circleci.com/gh/juxt/bidi.svg?style=svg)](https://circleci.com/gh/juxt/bidi)
 
 As bidi uses Clojure's reader conditionals, bidi is dependent on both Clojure 1.7 and Leiningen 2.5.3 or later.
 


=====================================
circle.yml deleted
=====================================
@@ -1,3 +0,0 @@
-test:
-  override:
-    - 'lein test'


=====================================
project.clj
=====================================
@@ -1,6 +1,6 @@
 ;; Copyright © 2014, JUXT LTD.
 
-(defproject bidi "2.1.3"
+(defproject bidi "2.1.6"
   :description "Bidirectional URI routing"
   :url "https://github.com/juxt/bidi"
 
@@ -9,15 +9,15 @@
 
 ;;  :pedantic? :abort
 
-  :dependencies [[prismatic/schema "1.1.3"]
-                 [ring/ring-core "1.5.0" :exclusions [org.clojure/clojure]]]
+  :dependencies [[prismatic/schema "1.1.7"]]
 
   :plugins [[lein-cljsbuild "1.1.1"]
             [lein-doo "0.1.6"]]
 
   :prep-tasks ["javac" "compile"]
 
-  :profiles {:dev {:exclusions [[org.clojure/tools.reader]]
+  :profiles {:provided {:dependencies [[ring/ring-core "1.5.0" :exclusions [org.clojure/clojure]]]}
+             :dev {:exclusions [[org.clojure/tools.reader]]
                    :resource-paths ["test-resources"]
                    ;;:global-vars {*warn-on-reflection* true}
                    :dependencies [[org.clojure/clojure "1.8.0"]
@@ -29,7 +29,7 @@
                                   [org.mozilla/rhino "1.7.7.1"]]}}
 
   :aliases {"deploy" ["do" "clean," "deploy" "clojars"]
-            "test" ["do" "clean," "test," "doo" "rhino" "test" "once"]}
+            "test-cljs" ["doo" "rhino" "test" "once"]}
 
   :jar-exclusions [#"\.swp|\.swo|\.DS_Store"]
 


=====================================
src/bidi/bidi.cljc
=====================================
@@ -26,7 +26,7 @@ in the case of ClojureScript, it does not validate that the input string is
 actually a valid UUID (this is handled by the route matching logic)."
   [s]
   #?(:clj (java.util.UUID/fromString s)
-     :cljs (cljs.core.UUID. s)))
+     :cljs (cljs.core/uuid s)))
 
 ;; When forming paths, parameters are encoded into the URI according to
 ;; the parameter value type.
@@ -154,7 +154,7 @@ actually a valid UUID (this is handled by the route matching logic)."
     (condp = this
      keyword "[A-Za-z]+[A-Za-z0-9\\*\\+\\!\\-\\_\\?\\.]*(?:%2F[A-Za-z]+[A-Za-z0-9\\*\\+\\!\\-\\_\\?\\.]*)?"
      long "-?\\d{1,19}"
-     uuid "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}"
+     uuid "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
      :otherwise (throw (ex-info (str "Unidentified function qualifier to pattern segment: " this) {}))))
   (transform-param [this]
     (condp = this
@@ -388,15 +388,23 @@ actually a valid UUID (this is handled by the route matching logic)."
   [route path & {:as options}]
   (match-route* route path options))
 
-(defn path-for
+(defn path-for*
   "Given a route definition data structure, a handler and an option map, return a
   path that would route to the handler. The map must contain the values to any
   parameters required to create the path, and extra values are silently ignored."
-  [route handler & {:as params}]
+  [route handler params]
   (when (nil? handler)
     (throw (ex-info "Cannot form URI from a nil handler" {})))
   (unmatch-pair route {:handler handler :params params}))
 
+(defn path-for
+  "Given a route definition data structure, a handler and an unrolled option map,
+  return a path that would route to the handler. The map must contain the values
+  to any parameters required to create the path, and extra values are silently
+  ignored."
+  [route handler & {:as params}]
+  (path-for* route handler params))
+
 ;; --------------------------------------------------------------------------------
 ;; Route seqs
 ;; --------------------------------------------------------------------------------


=====================================
src/bidi/vhosts.clj
=====================================
@@ -103,11 +103,13 @@
 
 (defn uri-info
   "Return URI info as a map."
-  [prioritized-vhosts handler & [{:keys [request vhost route-params query-params prefer fragment] :or {prefer :local} :as options}]]
+  [prioritized-vhosts handler & [{:keys [request vhost route-params query-params prefer fragment path-info] :or {prefer :local} :as options}]]
   (some
    (fn [[vhosts & routes]]
 
-     (when-let [path (apply bidi/path-for ["" (vec routes)] handler (mapcat identity route-params))]
+     (when-let [path (cond->
+                         (apply bidi/path-for ["" (vec routes)] handler (mapcat identity route-params))
+                       path-info (str path-info))]
 
        (let [qs (when query-params
                   (query-string query-params))]


=====================================
test/bidi/bidi_test.cljc
=====================================
@@ -211,9 +211,14 @@
     (is (= (path-for routes :z :id #uuid "649a50e8-0342-47af-894e-27eefea83ca9")
            "/foo/649a50e8-0342-47af-894e-27eefea83ca9/bar"))
 
+    (is (= (:route-params (match-route routes "/foo/00000000-0000-0000-0000-000000000000"))
+           {:id #uuid "00000000-0000-0000-0000-000000000000"}))
+    (is (= (:route-params (match-route routes "/foo/649a50e8-0342-47af-c94e-27eefea83ca9"))
+           {:id #uuid "649a50e8-0342-47af-c94e-27eefea83ca9"}))
+    (is (= (:route-params (match-route routes "/foo/649a50e8-0342-67af-894e-27eefea83ca9"))
+           {:id #uuid "649a50e8-0342-67af-894e-27eefea83ca9"}))
+
     (testing "invalid uuids"
-      (is (nil? (match-route routes "/foo/649a50e8-0342-67af-894e-27eefea83ca9")))
-      (is (nil? (match-route routes "/foo/649a50e8-0342-47af-c94e-27eefea83ca9")))
       (is (nil? (match-route routes "/foo/649a50e8034247afc94e27eefea83ca9")))
       (is (nil? (match-route routes "/foo/1012301231111111111111111111"))))))
 


=====================================
test/bidi/vhosts_test.clj
=====================================
@@ -103,7 +103,10 @@
                                        :request {:scheme :https :headers {"host" "example.org"}}})))))
 
     (testing "wildcards"
-      (is (= "https://example.org/index.html" (:uri (uri-info model :wildcard-index {:request {:scheme :https :headers {"host" "example.org"}}})))))))
+      (is (= "https://example.org/index.html" (:uri (uri-info model :wildcard-index {:request {:scheme :https :headers {"host" "example.org"}}})))))
+
+    (testing "path-info"
+      (is (= "https://a.org/index.html" (:uri (uri-info model :c {:path-info "/index.html"})))))))
 
 (deftest duplicate-routes-test
   (testing "same vhost takes priority"



View it on GitLab: https://salsa.debian.org/java-team/bidi-clojure/-/commit/12e72f1a7fcd84dae61596d9746f01b1f4d900bd

-- 
View it on GitLab: https://salsa.debian.org/java-team/bidi-clojure/-/commit/12e72f1a7fcd84dae61596d9746f01b1f4d900bd
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20201230/8b99f056/attachment.html>


More information about the pkg-java-commits mailing list