Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Change the default to easy
(ns db-quiz.state (:require [reagent.core :as reagent :refer [atom]])) (defonce app-state (atom {:answer nil :answers {:correct 0 :incorrect 0} :board {} :current-field nil :hint nil :language :cs :loading? false :on-turn (rand-nth [:player-1 :player-2]) :options {:data-source :dbpedia :despoilerify? true :difficulty :normal :doc "" :labels :numeric :selectors #{:persons :places :works} :share-url ""} :players {:player-1 "Dmitrij" :player-2 "Paní M."} :timer {:completion 0 :start 0} :verdict nil :winner nil}))
(ns db-quiz.state (:require [reagent.core :as reagent :refer [atom]])) (defonce app-state (atom {:answer nil :answers {:correct 0 :incorrect 0} :board {} :current-field nil :hint nil :language :cs :loading? false :on-turn (rand-nth [:player-1 :player-2]) :options {:data-source :dbpedia :despoilerify? true :difficulty :easy :doc "" :labels :numeric :selectors #{:persons :places :films} :share-url ""} :players {:player-1 "Dmitrij" :player-2 "Paní M."} :timer {:completion 0 :start 0} :verdict nil :winner nil}))
Fix failing test as a result of changing interface.
(ns asid.trust-pool (:use midje.sweet) (:use asid.wallet)) (defrecord Origin [identity url]) (defrecord Trustee [signed-values origin]) (defrecord TrustPool [challenge trustees]) (defn new-trust-pool [req-keys] (TrustPool. req-keys [])) (defn add-to-pool [pool owner-wallet joiner challenge-response] (let [joiner-origin (Origin. (:identity joiner) (:url joiner)) trustee (Trustee. (map #(sign owner-wallet (:identity joiner) %1 %2) (:challenge pool) challenge-response) joiner-origin)] (TrustPool. (:challenge pool) (conj (:trustees pool) trustee)))) (facts "about adding to a trust pool" (fact "should add with complete challenge" (-> (add-to-pool (TrustPool. [:name] []) (new-wallet) {:identity "id" :url "url"} ["blah"]) :trustees count) => 1))
(ns asid.trust-pool (:use midje.sweet) (:use asid.wallet)) (defrecord Origin [identity url]) (defrecord Trustee [signed-values origin]) (defrecord TrustPool [challenge trustees]) (defn new-trust-pool [req-keys] (TrustPool. req-keys [])) (defn add-to-pool [pool owner-wallet joiner challenge-response] (let [joiner-origin (Origin. (:identity joiner) (:url joiner)) trustee (Trustee. (map #(sign owner-wallet (:identity joiner) %1 %2) (:challenge pool) challenge-response) joiner-origin)] (TrustPool. (:challenge pool) (conj (:trustees pool) trustee)))) (facts "about adding to a trust pool" (fact "should add with complete challenge" (-> (add-to-pool (TrustPool. [:name] []) (new-wallet "id seed") {:identity "id" :url "url"} ["blah"]) :trustees count) => 1))
Add button to resend API call
(ns discuss.debug "Show information for debugging." (:require [om.core :as om :include-macros true] [om.dom :as dom :include-macros true] [discuss.lib :as lib])) (defn debug-view [data _owner] (reify om/IRender (render [_] (dom/div nil (dom/h4 nil "Last API call") (dom/pre nil (get-in data [:debug :last-api])) (dom/h4 nil "Last response") (dom/pre nil (apply dom/ul nil (map (fn [[k v]] (dom/li nil (str k "\t\t" v))) (get-in data [:debug :response])))) (dom/h4 nil "Token") (dom/pre nil (get-in data [:user :token])) )))) (defn update "Update displayed debug information." [key val] (lib/update-state-item! :debug key (fn [_] val)))
(ns discuss.debug "Show information for debugging." (:require [om.core :as om :include-macros true] [om.dom :as dom :include-macros true] [discuss.lib :as lib])) (defn debug-view [data _owner] (reify om/IRender (render [_] (dom/div nil (dom/h4 nil "Last API call") (dom/pre nil (get-in data [:debug :last-api])) (dom/button #js {:className "btn btn-default" :onClick #(discuss.communication/ajax-get (get-in data [:debug :last-api]))} "Resend API Call") (dom/h4 nil "Last response") (dom/pre nil (apply dom/ul nil (map (fn [[k v]] (dom/li nil (str k "\t\t" v))) (get-in data [:debug :response])))) (dom/h4 nil "Token") (dom/pre nil (get-in data [:user :token])) )))) (defn update "Update displayed debug information." [key val] (lib/update-state-item! :debug key (fn [_] val)))
Add transfer-rdf-list-links-with-nil to connect rdf:List members to nil where appropriate
`{:name "link-bio-with-nil" :description "This link-bio-with-properties rule requires both things being linked to be 'bioentities' and thus this rule excludes links within RDF lists that connect to rdf:nil. This rule fills in those missing links." :head ((?/bio ?/p rdf/nil)) :body ((?/c obo/IAO_0000219 ?/bio) (?/c ?/p rdf/nil))}
`{:name "transfer-rdf-list-links-with-nil" :description "This rule transfers links to rdf:nil from list members to bio world. These links are predominantly '?x rdf:rest rdf/nil'." :head ((?/bio_list_member ?/p rdf/nil)) :sparql-string "select ?bio_list_member ?p { ?list_record rdf:type ccp:IAO_EXT_0000317 . ?list_record obo:IAO_0000219 ?list_member . ?list_member ?p rdf:nil . ?list_record obo:IAO_0000219 ?bio_list_member . filter (?list_member != ?bio_list_member) }"}
Set target-path to maintain compatibility with lein 2.3
(defproject tailrecursion/boot-classloader "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] [org.springframework/spring-core "1.2.2"] [com.cemerick/pomegranate "0.2.0" :exclusions [org.clojure/clojure]]] :main ^:skip-aot tailrecursion.boot-classloader :target-path "target/%s" :profiles {:uberjar {:aot :all}})
(defproject tailrecursion/boot-classloader "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] [org.springframework/spring-core "1.2.2"] [com.cemerick/pomegranate "0.2.0" :exclusions [org.clojure/clojure]]] :main ^:skip-aot tailrecursion.boot-classloader :target-path "target" ; force target-path to maintain 2.3 compatibility :profiles {:uberjar {:aot :all}})
Add tag type for whidbey.
(defproject mvxcvi/multihash "1.1.0-SNAPSHOT" :description "Native Clojure implementation of the multihash standard." :url "https://github.com/greglook/clj-multihash" :license {:name "Public Domain" :url "http://unlicense.org/"} :deploy-branches ["master"] :plugins [[lein-cloverage "1.0.6"]] :dependencies [[org.clojure/clojure "1.7.0"]] :codox {:metadata {:doc/format :markdown} :source-uri "https://github.com/greglook/clj-multihash/blob/master/{filepath}#L{line}" :doc-paths ["doc/extra"] :output-path "doc/api"})
(defproject mvxcvi/multihash "1.1.0-SNAPSHOT" :description "Native Clojure implementation of the multihash standard." :url "https://github.com/greglook/clj-multihash" :license {:name "Public Domain" :url "http://unlicense.org/"} :deploy-branches ["master"] :plugins [[lein-cloverage "1.0.6"]] :dependencies [[org.clojure/clojure "1.7.0"]] :codox {:metadata {:doc/format :markdown} :source-uri "https://github.com/greglook/clj-multihash/blob/master/{filepath}#L{line}" :doc-paths ["doc/extra"] :output-path "doc/api"} :whidbey {:tag-types {'multihash.core.Multihash {'data/hash 'multihash.core/base58}}})
Initialize the REPL with typical modules
(defproject test-utils "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" :url "https://www.eclipse.org/legal/epl-2.0/"} :dependencies [[org.clojure/clojure "1.10.0"] [kixi/stats "0.5.2"]] :repl-options {:init-ns test-utils.core} :source-paths ["src", "test"])
(defproject test-utils "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" :url "https://www.eclipse.org/legal/epl-2.0/"} :dependencies [[org.clojure/clojure "1.10.0"] [kixi/stats "0.5.2"]] :repl-options {:init (require '[test-utils [core :as tuc] [address :as addr] [fracture-diagnostics :as fd] [retail :as tur] [sandbox :as sb] [word-source :as ws]]) } :source-paths ["src", "test"])
Add bigdata 1.4.0 and its dependencies
(defproject lapmachine "0.1.0" :description "A Language/Action Perspective-based engine for pragmatic interaction on the Web" :url "http://github.com/bpdp/lapmachine" :license {:name "Eclipse Public License v 1.0" :url "https://www.eclipse.org/org/documents/epl-v10.php"} :main lapmachine.repl :ring {:handler lapmachine.interact/handler} :dependencies [[org.clojure/clojure "1.6.0"] [instaparse "1.3.4"] [liberator "0.12.2"] [compojure "1.2.2"] [ring/ring-core "1.3.2"]] :dev-dependencies [[ring/ring-devel "1.3.2"]])
(defproject lapmachine "0.1.0" :description "A Language/Action Perspective-based engine for pragmatic interaction on the Web" :url "http://github.com/bpdp/lapmachine" :license {:name "Eclipse Public License v 1.0" :url "https://www.eclipse.org/org/documents/epl-v10.php"} :main lapmachine.repl :ring {:handler lapmachine.interact/handler} :repositories [["bigdata" "http://systap.com/maven/releases"] ["nxparser" "http://nxparser.googlecode.com/svn/repository"] ["sonatype" "https://oss.sonatype.org/content/repositories/releases"] ["apache" "http://repository.apache.org/content/repositories/releases"]] :dependencies [[org.clojure/clojure "1.6.0"] [instaparse "1.3.5"] [liberator "0.12.2"] [compojure "1.3.0"] [ring/ring-core "1.3.2"] [com.bigdata/bigdata "1.4.0"]] :dev-dependencies [[ring/ring-devel "1.3.2"]])
Change numbering system for releases
(defproject riverford/compound "0.5.0-alpha4" :description "A micro structure for reagent data" :url "https://github.com/riverford/compound" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.9.0-RC2"] [org.clojure/spec.alpha "0.1.143"]] :publish {:site "compound" :theme "bolton" :output "docs" :template {:author "Daniel Neal" :logo-white "img/compound_small.png" :email "danielneal@riverford.co.uk"} :files {"index" {:input "test/compound/docs.cljc" :site "compound" :title "core" :subtitle "api docs"}}} :profiles {:dev {:dependencies [[im.chit/lucid.publish "1.3.13"] [orchestra "2017.11.12-1"]]}})
(defproject riverford/compound "2017.12.20-1" :description "A micro structure for reagent data" :url "https://github.com/riverford/compound" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.9.0-RC2"] [org.clojure/spec.alpha "0.1.143"]] :publish {:site "compound" :theme "bolton" :output "docs" :template {:author "Daniel Neal" :logo-white "img/compound_small.png" :email "danielneal@riverford.co.uk"} :files {"index" {:input "test/compound/docs.cljc" :site "compound" :title "core" :subtitle "api docs"}}} :profiles {:dev {:dependencies [[im.chit/lucid.publish "1.3.13"] [orchestra "2017.11.12-1"]]}})
Add `dev-resources` to `resource-paths` of profile dev and 1.7
(defproject jungerer "0.1.2-SNAPSHOT" :description "Clojure network/graph library wrapping JUNG" :url "https://github.com/totakke/jungerer" :license {:name "The BSD 3-Clause License" :url "https://opensource.org/licenses/BSD-3-Clause"} :dependencies [[org.clojure/clojure "1.8.0"] [net.sf.jung/jung-algorithms "2.1"] [net.sf.jung/jung-api "2.1"] [net.sf.jung/jung-graph-impl "2.1"] [net.sf.jung/jung-visualization "2.1"]] :profiles {:dev {:global-vars {*warn-on-reflection* true}} :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}} :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})
(defproject jungerer "0.1.2-SNAPSHOT" :description "Clojure network/graph library wrapping JUNG" :url "https://github.com/totakke/jungerer" :license {:name "The BSD 3-Clause License" :url "https://opensource.org/licenses/BSD-3-Clause"} :dependencies [[org.clojure/clojure "1.8.0"] [net.sf.jung/jung-algorithms "2.1"] [net.sf.jung/jung-api "2.1"] [net.sf.jung/jung-graph-impl "2.1"] [net.sf.jung/jung-visualization "2.1"]] :profiles {:dev {:global-vars {*warn-on-reflection* true} :resource-paths ["dev-resources"]} :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]] :resource-paths ["dev-resources"]}} :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})
Switch over to latest Lacinia, based on Clojure 1.8
(defproject com.howardlewisship/bgg-graphql-proxy "0.12.0" :description "GraphQL interface to BoardGameGeek" :dependencies [[org.clojure/clojure "1.9.0-alpha14"] [io.aviso/logging "0.2.0"] [com.walmartlabs/lacinia "NEXT"] [clj-http "2.3.0"] [org.clojure/data.json "0.2.6"] [org.clojure/data.xml "0.0.8"] [io.pedestal/pedestal.service "0.5.2"] [io.pedestal/pedestal.jetty "0.5.2"]] :repositories [["ereceipts-releases" "http://dfw-receipts-jenkins.mobile.walmart.com:8081/nexus/content/repositories/releases/"]] :codox {:source-uri "" :metadata {:doc/format :markdown}})
(defproject com.howardlewisship/bgg-graphql-proxy "0.12.0" :description "GraphQL interface to BoardGameGeek" :dependencies [[org.clojure/clojure "1.8.0"] [io.aviso/logging "0.2.0"] [com.walmartlabs/lacinia "NEXT"] [clj-http "2.3.0"] [org.clojure/data.json "0.2.6"] [org.clojure/data.xml "0.0.8"] [io.pedestal/pedestal.service "0.5.2"] [io.pedestal/pedestal.jetty "0.5.2"]] :repositories [["ereceipts-releases" "http://dfw-receipts-jenkins.mobile.walmart.com:8081/nexus/content/repositories/releases/"]] :codox {:source-uri "" :metadata {:doc/format :markdown}})
Add clojars as release repository.
(defproject pjstadig/assertions "0.2.0-SNAPSHOT" :description "Zero penalty runtime assertions for Clojure." :url "http://github.com/pjstadig/assert" :license {:name "Mozilla Public License, v. 2.0" :url "http://mozilla.org/MPL/2.0/"} :dependencies [[org.clojure/clojure "1.5.1"]] :java-source-paths ["src"])
(defproject pjstadig/assertions "0.2.0-SNAPSHOT" :description "Zero penalty runtime assertions for Clojure." :url "http://github.com/pjstadig/assert" :license {:name "Mozilla Public License, v. 2.0" :url "http://mozilla.org/MPL/2.0/"} :deploy-repositories [["releases" :clojars]] :dependencies [[org.clojure/clojure "1.5.1"]] :java-source-paths ["src"])
Update dependency for pretty to 0.1.5
(defproject io.aviso/twixt "0.1.4" :description "An extensible asset pipeline for Clojure web applications" :url "https://github.com/AvisoNovate/twixt" :license {:name "Apache Sofware Licencse 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/tools.logging "0.2.6"] [ring/ring-core "1.2.0"] [org.mozilla/rhino "1.7R4"] [com.github.sommeri/less4j "1.1.2"] [de.neuland/jade4j "0.3.15"] [io.aviso/pretty "0.1.4"] [hiccup "1.0.4"]] :repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]] :codox {:src-dir-uri "https://github.com/AvisoNovate/twixt/blob/master/" :src-linenum-anchor-prefix "L"} :profiles {:dev {:dependencies [[log4j "1.2.17"] [ring/ring-jetty-adapter "1.2.0"]]}})
(defproject io.aviso/twixt "0.1.4" :description "An extensible asset pipeline for Clojure web applications" :url "https://github.com/AvisoNovate/twixt" :license {:name "Apache Sofware Licencse 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/tools.logging "0.2.6"] [ring/ring-core "1.2.0"] [org.mozilla/rhino "1.7R4"] [com.github.sommeri/less4j "1.1.2"] [de.neuland/jade4j "0.3.15"] [io.aviso/pretty "0.1.5"] [hiccup "1.0.4"]] :repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]] :codox {:src-dir-uri "https://github.com/AvisoNovate/twixt/blob/master/" :src-linenum-anchor-prefix "L"} :profiles {:dev {:dependencies [[log4j "1.2.17"] [ring/ring-jetty-adapter "1.2.0"]]}})
Prepare for next development iteration (0.1.3-SNAPSHOT)
(defproject jungerer "0.1.2" :description "Clojure network/graph library wrapping JUNG" :url "https://github.com/totakke/jungerer" :license {:name "The BSD 3-Clause License" :url "https://opensource.org/licenses/BSD-3-Clause"} :dependencies [[org.clojure/clojure "1.8.0"] [net.sf.jung/jung-algorithms "2.1"] [net.sf.jung/jung-api "2.1"] [net.sf.jung/jung-graph-impl "2.1"] [net.sf.jung/jung-io "2.1"] [net.sf.jung/jung-visualization "2.1"]] :profiles {:dev {:global-vars {*warn-on-reflection* true} :resource-paths ["dev-resources"]} :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]] :resource-paths ["dev-resources"]}} :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})
(defproject jungerer "0.1.3-SNAPSHOT" :description "Clojure network/graph library wrapping JUNG" :url "https://github.com/totakke/jungerer" :license {:name "The BSD 3-Clause License" :url "https://opensource.org/licenses/BSD-3-Clause"} :dependencies [[org.clojure/clojure "1.8.0"] [net.sf.jung/jung-algorithms "2.1"] [net.sf.jung/jung-api "2.1"] [net.sf.jung/jung-graph-impl "2.1"] [net.sf.jung/jung-io "2.1"] [net.sf.jung/jung-visualization "2.1"]] :profiles {:dev {:global-vars {*warn-on-reflection* true} :resource-paths ["dev-resources"]} :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]] :resource-paths ["dev-resources"]}} :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})
Prepare for next release cycle.
(defproject onyx-app/lein-template "0.10.0.0-rc3" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
(defproject onyx-app/lein-template "0.10.0.0-SNAPSHOT" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
Use more readable conf in Cloure clinet
(ns infinispan.test (:gen-class) (:import (org.infinispan.client.hotrod RemoteCacheManager RemoteCache) (org.infinispan.client.hotrod.configuration ConfigurationBuilder) (org.infinispan.client.hotrod.impl ConfigurationProperties))) (defn -main "Creates simple HR client, puts key/value into remote server and reads it back" [& args] (def conf (ConfigurationBuilder.)) (.port (.host (.addServer conf) "127.0.0.1") ConfigurationProperties/DEFAULT_HOTROD_PORT) (def cm (RemoteCacheManager. (.build conf))) (def cache (.getCache cm)) (println "Sending key -> value") (.put cache "key" "value") (def value (.get cache "key")) (println "Got key -> " value) (.stop cm))
(ns infinispan.test (:gen-class) (:import (org.infinispan.client.hotrod RemoteCacheManager RemoteCache) (org.infinispan.client.hotrod.configuration ConfigurationBuilder) (org.infinispan.client.hotrod.impl ConfigurationProperties))) (defn -main "Creates simple HR client, puts key/value into remote server and reads it back" [& args] (def conf (ConfigurationBuilder.)) ;;(.port (.host (.addServer conf) "127.0.0.1") ConfigurationProperties/DEFAULT_HOTROD_PORT) (-> (.addServer conf) (.host "127.0.0.1") (.port ConfigurationProperties/DEFAULT_HOTROD_PORT)) (def cm (RemoteCacheManager. (.build conf))) (def cache (.getCache cm)) (println "Sending key -> value") (.put cache "key" "value") (def value (.get cache "key")) (println "Got key -> " value) (.stop cm))
Add a try/catch block to get-all-names
(ns blaagh.db.core (:require [clojure.java.jdbc :as sql]) (:require [yesql.core :refer [defqueries]])) (def db-spec { :classname "org.sqlite.JDBC" :subprotocol "sqlite" :subname "resources/db/blaagh.sqlite3"}) ;; creates DB if not already present (defqueries "blaagh/db/queries.sql" {:connection db-spec}) (defn get-all-names [] (let [results (get-names)] (cond (empty? results) {:status 404} :else results))) (defn create-tables [] (try (sql/db-do-commands db-spec "CREATE TABLE foo (name text); " "CREATE TABLE bar (name text); " "CREATE TABLE baz (name text); ") (catch Exception e (println e)))) (defn populate-tables [] (try (sql/db-do-commands db-spec "INSERT INTO foo (name) VALUES ('Rick'), ('Carol'), ('Daryl'), ('Michonne'), ('Glenn'), ('Maggie'), ('Carl'), ('Sasha'), ('Abraham'), ('Morgan');") (catch Exception e (println e))))
(ns blaagh.db.core (:require [clojure.java.jdbc :as sql]) (:require [yesql.core :refer [defqueries]])) (def db-spec { :classname "org.sqlite.JDBC" :subprotocol "sqlite" :subname "resources/db/blaagh.sqlite3"}) ;; creates DB if not already present (defqueries "blaagh/db/queries.sql" {:connection db-spec}) (defn get-all-names [] (try (let [results (get-names)] (cond (empty? results) {:status 404} :else results)) (catch Exception e (println e)))) (defn create-tables [] (try (sql/db-do-commands db-spec "CREATE TABLE foo (name text); " "CREATE TABLE bar (name text); " "CREATE TABLE baz (name text); ") (catch Exception e (println e)))) (defn populate-tables [] (try (sql/db-do-commands db-spec "INSERT INTO foo (name) VALUES ('Rick'), ('Carol'), ('Daryl'), ('Michonne'), ('Glenn'), ('Maggie'), ('Carl'), ('Sasha'), ('Abraham'), ('Morgan');") (catch Exception e (println e))))
Prepare for next release cycle.
(defproject org.onyxplatform/onyx-bookkeeper "0.8.1.0-alpha6" :description "Onyx plugin for BookKeeper" :url "https://github.com/onyx-platform/onyx-bookkeeper" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :dependencies [[org.clojure/clojure "1.7.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.8.1-alpha6"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
(defproject org.onyxplatform/onyx-bookkeeper "0.8.1.0-SNAPSHOT" :description "Onyx plugin for BookKeeper" :url "https://github.com/onyx-platform/onyx-bookkeeper" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :dependencies [[org.clojure/clojure "1.7.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.8.1-alpha6"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
Add which signing to use
(defproject net.uncontended/beehive "0.2.0" :description "Beehive is a Clojure facade for the Precipice library." :url "https://github.com/tbrooks8/Beehive" :license {:name "Apache License, Version 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0"} :profiles {:dev {:dependencies [[org.clojure/core.async "0.1.346.0-17112a-alpha"] [clj-http "1.0.1"] [criterium "0.4.3"]]}} :dependencies [[org.clojure/clojure "1.6.0"] [net.uncontended/Precipice "0.1.0"]])
(defproject net.uncontended/beehive "0.2.0" :description "Beehive is a Clojure facade for the Precipice library." :url "https://github.com/tbrooks8/Beehive" :license {:name "Apache License, Version 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0"} :signing {:gpg-key "tim@uncontended.net"} :profiles {:dev {:dependencies [[org.clojure/core.async "0.1.346.0-17112a-alpha"] [clj-http "1.0.1"] [criterium "0.4.3"]]}} :dependencies [[org.clojure/clojure "1.6.0"] [net.uncontended/Precipice "0.1.0"]])
Use with-ns so defproject works unqualified. Bind *compile-path* explicitly.
(ns leiningen.core (:require [leiningen deps test compile] [clojure.contrib.with-ns]) (:gen-class)) (def project nil) (defmacro defproject [project-name & args] ;; This is necessary since we must allow defproject to be eval'd in ;; any namespace due to load-file; we can't just create a var with ;; def or we would not have access to it once load-file returned. `(do (alter-var-root #'project (fn [_#] (assoc (apply hash-map (quote ~args)) :name ~(name project-name) :root ~(.getParent (java.io.File. *file*))))) (def ~project-name project))) (defn read-project ([file] (load-file file) project) ([] (read-project "project.clj"))) (defn -main [command & args] (let [action (ns-resolve (symbol (str "leiningen." command)) (symbol command))] ;; TODO: ensure tasks run only once (apply action (read-project) args) ;; In case tests or some other task started any: (shutdown-agents)))
(ns leiningen.core (:use [clojure.contrib.with-ns]) (:gen-class)) (def project nil) (defmacro defproject [project-name & args] ;; This is necessary since we must allow defproject to be eval'd in ;; any namespace due to load-file; we can't just create a var with ;; def or we would not have access to it once load-file returned. `(do (alter-var-root #'project (fn [_#] (assoc (apply hash-map (quote ~args)) :name ~(name project-name) :root ~(.getParent (java.io.File. *file*))))) (def ~project-name project))) ;; So it doesn't need to be fully-qualified in project.clj (with-ns 'user (use ['leiningen.core :only ['defproject]])) (defn read-project ([file] (load-file file) project) ([] (read-project "project.clj"))) (defn -main [command & args] (let [action-ns (symbol (str "leiningen." command)) _ (require action-ns) action (ns-resolve action-ns (symbol command)) project (read-project)] (binding [*compile-path* (or (:compile-path project) (str (:root project) "/classes/"))] ;; TODO: ensure tasks run only once (apply action project args) ;; In case tests or some other task started any: (shutdown-agents))))
Add other round of console API methods. Not very happy about this. But will sort it out later.
(ns re-frame.utils) (defn warn [& args] (.warn js/console (apply str args))) (defn first-in-vector [v] (if (vector? v) (first v) (warn "re-frame: expected a vector event, but got: " v)))
(ns re-frame.utils) (defn warn [& args] (.warn js/console (apply str args))) (defn dbg [& args] (.debug js/console (apply str args))) (defn log [& args] (.log js/console (apply str args))) (defn group [& args] (.group js/console (apply str args))) (defn groupEnd [] (.groupEnd js/console)) (defn first-in-vector [v] (if (vector? v) (first v) (warn "re-frame: expected a vector event, but got: " v)))
Bring tests in line with Ruby tests.
(ns bob.test (:use clojure.test)) (load-file "bob.clj") (deftest responds-to-shouts (is (= "Woah, chill out!" (bob/response-for "SHOUTING")))) (deftest responds-to-questions (is (= "Sure." (bob/response-for "A question?")))) (deftest responds-to-statements (is (= "Whatever." (bob/response-for "A statement.")))) (deftest responds-to-silence (is (= "Fine, be that way." (bob/response-for "")))) (run-tests)
(ns bob.test (:use clojure.test)) (load-file "bob.clj") (deftest responds-to-something (is (= "Whatever." (bob/response-for "Tom-ay-to, tom-aaaah-to.")))) (deftest responds-to-shouts (is (= "Woah, chill out!" (bob/response-for "WATCH OUT!")))) (deftest responds-to-questions (is (= "Sure." (bob/response-for "Does this cryogenic chamber make me look fat?")))) (deftest responds-to-forceful-talking (is (= "Whatever." (bob/response-for "Let's go make out behind the gym!")))) (deftest responds-to-acronyms (is (= "Whatever." (bob/response-for "It's OK if you don't want to go to the DMV.")))) (deftest responds-to-forceful-questions (is (= "Woah, chill out!" (bob/response-for "WHAT THE HELL WERE YOU THINKING?")))) (deftest responds-to-shouting-with-special-characters (is (= "Woah, chill out!" (bob/response-for "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")))) (deftest responds-to-shouting-numbers (is (= "Woah, chill out!" (bob/response-for "1, 2, 3 GO!")))) (deftest responds-to-shouting-with-no-exclamation-mark (is (= "Woah, chill out!" (bob/response-for "I HATE YOU")))) (deftest responds-to-statement-containing-question-mark (is (= "Whatever." (bob/response-for "Ending with ? means a question.")))) (deftest responds-to-silence (is (= "Fine, be that way." (bob/response-for "")))) (run-tests)
Use java.io.tmpdir for storing the exported files
(ns reports.exporter (:require [clojure.java.io :as io]) (:import java.io.File java.util.UUID org.waterforpeople.mapping.dataexport.SurveyDataImportExportFactory)) (defn- get-file-extension [t] (if (= t "SURVEY_FORM") "xls" "xlsx")) (defn- get-file [et id] (let [path (str "/var/tmp/akvo/flow/reports/" (UUID/randomUUID))] (.mkdirs (io/file path)) (io/file (format "%s/%s-%s.%s" path et id (get-file-extension et))))) (defn ^File export-report [type base id options] (let [exporter (.getExporter (SurveyDataImportExportFactory.) type) file (get-file type id)] (.export exporter {"surveyId" id} file base options) file))
(ns reports.exporter (:require [clojure.java.io :as io]) (:import java.io.File java.util.UUID org.waterforpeople.mapping.dataexport.SurveyDataImportExportFactory)) (defn- get-file-extension [t] (if (= t "SURVEY_FORM") "xls" "xlsx")) (defn- get-path [] (format "%s/%s/%s" (System/getProperty "java.io.tmpdir") "akvo/flow/reports" (UUID/randomUUID))) (defn- get-file [et id] (let [path (get-path)] (.mkdirs (io/file path)) (io/file (format "%s/%s-%s.%s" path et id (get-file-extension et))))) (defn ^File export-report [type base id options] (let [exporter (.getExporter (SurveyDataImportExportFactory.) type) file (get-file type id)] (.export exporter {"surveyId" id} file base options) file))
Add separate card for search-results
(ns discuss.cards (:require [devcards.core :as dc :refer-macros [defcard defcard-om defcard-om-next dom-node]] [sablono.core :as html :refer-macros [html]] [om.next :as om :refer-macros [defui]] [discuss.parser :as parser] [discuss.components.search.statements :refer [SearchQuery]] [discuss.utils.common :as lib] [discuss.views :as views])) (enable-console-print!) (defcard-om discuss views/main-view lib/app-state) (defonce test-data {:foo :bar :search/results [:foo :bar :baz]}) (defonce devcard-reconciler (om/reconciler {:state test-data :parser (om/parser {:read parser/read :mutate parser/mutate})})) (defcard search-query-card-no-next (dom-node (fn [_ node] (om/add-root! devcard-reconciler SearchQuery node))) {:inspect-data true}) ;; ----------------------------------------------------------------------------- ;; Start devcards (defn main [] ;; conditionally start the app based on whether the #main-app-area ;; node is on the page (when-let [node (.getElementById js/document "main-app-area")] (.render js/ReactDOM (html [:div "This is working"]) node))) (main)
(ns discuss.cards (:require [devcards.core :as dc :refer-macros [defcard defcard-om defcard-om-next dom-node]] [sablono.core :as html :refer-macros [html]] [om.next :as om :refer-macros [defui]] [discuss.parser :as parser] [discuss.components.search.statements :refer [SearchQuery Results]] [discuss.utils.common :as lib] [discuss.views :as views])) (enable-console-print!) (defcard-om discuss views/main-view lib/app-state) (defonce test-data {:foo :bar :search/results [:foo :bar :baz]}) (defonce devcard-reconciler (om/reconciler {:state test-data :parser (om/parser {:read parser/read :mutate parser/mutate})})) (defcard search-query (dom-node (fn [_ node] (om/add-root! parser/reconciler SearchQuery node))) {:inspect-data true}) (defcard search-results (dom-node (fn [_ node] (om/add-root! parser/reconciler Results node))) {:inspect-data true}) ;; ----------------------------------------------------------------------------- ;; Start devcards (defn main [] ;; conditionally start the app based on whether the #main-app-area ;; node is on the page (when-let [node (.getElementById js/document "main-app-area")] (.render js/ReactDOM (html [:div "This is working"]) node))) (main)
Set DB consistency to quorum
(ns lcmap.clownfish.configuration "Supplies system configuration map" (:require [clojure.string :as str] [clojure.tools.logging :as log] [dire.core :as dire :refer [with-handler!]] [lcmap.commons.numbers :refer [numberize]] [mount.core :refer [defstate] :as mount])) (defn- tokenize "Split a string on whitespace and returns a vector of the tokens or nil if the value was untokenizable" [value] (vec (remove #(zero? (count %)) (str/split value #" ")))) (with-handler! #'tokenize [java.lang.NullPointerException java.lang.ClassCastException] (fn [e & args] nil)) (defn config-map [env] {:http {:port (numberize (:http-port env)) :join? false :daemon? true} :event {:host (:event-host env) :port (numberize (:event-port env))} :db {:keyspace (:db-keyspace env) :cluster {:contact-points (tokenize (:db-url env)) :credentials {:user (:db-user env) :password (:db-pass env)}}} :server {:exchange (:exchange env) :queue (:queue env)} :chip-specs-url (:chip-specs-url env)}) (defstate config :start (log/spy :debug (config-map ((mount/args) :environment))))
(ns lcmap.clownfish.configuration "Supplies system configuration map" (:require [clojure.string :as str] [clojure.tools.logging :as log] [dire.core :as dire :refer [with-handler!]] [lcmap.commons.numbers :refer [numberize]] [mount.core :refer [defstate] :as mount])) (defn- tokenize "Split a string on whitespace and returns a vector of the tokens or nil if the value was untokenizable" [value] (vec (remove #(zero? (count %)) (str/split value #" ")))) (with-handler! #'tokenize [java.lang.NullPointerException java.lang.ClassCastException] (fn [e & args] nil)) (defn config-map [env] {:http {:port (numberize (:http-port env)) :join? false :daemon? true} :event {:host (:event-host env) :port (numberize (:event-port env))} :db {:keyspace (:db-keyspace env) :cluster {:contact-points (tokenize (:db-url env)) :credentials {:user (:db-user env) :password (:db-pass env)} :query-options {:consistency :quorum}}} :server {:exchange (:exchange env) :queue (:queue env)} :chip-specs-url (:chip-specs-url env)}) (defstate config :start (log/spy :debug (config-map ((mount/args) :environment))))
Return of the spec-tests for cljs
(ns reitit.doo-runner (:require [doo.runner :refer-macros [doo-tests]] reitit.coercion-test reitit.core-test reitit.impl-test reitit.middleware-test reitit.ring-test #_reitit.spec-test reitit.exception-test reitit.frontend.core-test reitit.frontend.history-test reitit.frontend.controllers-test)) (enable-console-print!) (doo-tests 'reitit.coercion-test 'reitit.core-test 'reitit.impl-test 'reitit.middleware-test 'reitit.ring-test #_'reitit.spec-test 'reitit.exception-test 'reitit.frontend.core-test 'reitit.frontend.history-test 'reitit.frontend.controllers-test)
(ns reitit.doo-runner (:require [doo.runner :refer-macros [doo-tests]] reitit.coercion-test reitit.core-test reitit.impl-test reitit.middleware-test reitit.ring-test reitit.spec-test reitit.exception-test reitit.frontend.core-test reitit.frontend.history-test reitit.frontend.controllers-test)) (enable-console-print!) (doo-tests 'reitit.coercion-test 'reitit.core-test 'reitit.impl-test 'reitit.middleware-test 'reitit.ring-test 'reitit.spec-test 'reitit.exception-test 'reitit.frontend.core-test 'reitit.frontend.history-test 'reitit.frontend.controllers-test)
Switch from atom to var
(ns ^{:doc "A way to keep track of the pertinent context of the current nested fact. Currently, that is only the fact's description/doc-string"} midje.internal-ideas.fact-context (:use [clojure.string :only [join]])) (def fact-context (atom [])) (defn nested-descriptions [] @fact-context) (defn- enter-runtime-context [description] (swap! fact-context conj description)) (defn- leave-runtime-context [] (swap! fact-context #(vec (butlast %)))) (defmacro within-runtime-fact-context [description & body] `(try (#'enter-runtime-context ~description) ~@body (finally (#'leave-runtime-context))))
(ns ^{:doc "A way to keep track of the pertinent context of the current nested fact. Currently, that is only the fact's description/doc-string"} midje.internal-ideas.fact-context (:use [clojure.string :only [join]])) (def ^{:dynamic true} *fact-context* []) (defn nested-descriptions [] *fact-context*) (defmacro within-runtime-fact-context [description & body] `(binding [*fact-context* (conj *fact-context* ~description)] ~@body))
Add cloverage to lein plugins
{:user {:dependencies [[slamhound "1.3.1"] [org.clojure/tools.namespace "0.2.4"] [clj-stacktrace "0.2.7"]] :plugins [[lein-difftest "2.0.0"] [lein-marginalia "0.7.1"] [lein-pprint "1.1.1"] [lein-swank "1.4.4"] [lein-kibit "0.0.8"]] :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require) 'print-cause-trace) new (ns-resolve (doto 'clj-stacktrace.repl require) 'pst)] (alter-var-root orig (constantly (deref new))))]}} :aliases {"slamhound" ["run" "-m" "slam.hound"]} :source-paths ["/Users/jcf/.lein/dev"] :search-page-size 30}}
{:user {:dependencies [[slamhound "1.3.1"] [org.clojure/tools.namespace "0.2.4"] [clj-stacktrace "0.2.7"]] :plugins [[lein-pprint "1.1.1"] [lein-difftest "2.0.0"] [lein-cloverage "1.0.2"] [lein-marginalia "0.7.1"] [lein-swank "1.4.4"] [lein-kibit "0.0.8"]] :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require) 'print-cause-trace) new (ns-resolve (doto 'clj-stacktrace.repl require) 'pst)] (alter-var-root orig (constantly (deref new))))]}} :aliases {"slamhound" ["run" "-m" "slam.hound"]} :source-paths ["/Users/jcf/.lein/dev"] :search-page-size 30}}
Prepare for next release cycle.
(defproject onyx-app/lein-template "0.9.10.0-beta1" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
(defproject onyx-app/lein-template "0.9.10.0-SNAPSHOT" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
Delete public directory when watching starts.
(ns incise.watcher (:require [taoensso.timbre :refer [error]] [clojure.stacktrace :refer [print-cause-trace]] [watchtower.core :refer [watcher rate file-filter extensions on-change]])) (defn log-exceptions [func] "Log (i.e. print) exceptions received from the given function." (let [out *out* err *err*] (fn [& args] (binding [*out* out *err* err] (try (apply func args) (catch Exception e (error (with-out-str (print-cause-trace e))))))))) (defn per-change [change-fn] (fn [files] (doseq [file files] (change-fn file)))) (defn watch [change-fn] (watcher ["resources/posts/" "resources/pages/"] (rate 300) (on-change (-> change-fn per-change log-exceptions)))) (def watching nil) (defn start-watching [& args] (alter-var-root #'watching (fn [& _] (apply watch args)))) (defn stop-watching [] (when watching (future-cancel watching)))
(ns incise.watcher (:require [taoensso.timbre :refer [error]] [clojure.stacktrace :refer [print-cause-trace]] [watchtower.core :refer [watcher rate file-filter extensions on-change]]) (:import [java.io File])) (defn log-exceptions [func] "Log (i.e. print) exceptions received from the given function." (let [out *out* err *err*] (fn [& args] (binding [*out* out *err* err] (try (apply func args) (catch Exception e (error (with-out-str (print-cause-trace e))))))))) (defn per-change [change-fn] (fn [files] (doseq [file files] (change-fn file)))) (def gitignore-file? [^File file] (= (.getName file) ".gitignore")) (defn delete-recursively "Delete a directory tree." [^File root] (when (.isDirectory root) (doseq [file (remove gitignore-file? (.listFiles root))] (delete-recursively file))) (.delete root)) (defn watch [change-fn] (delete-recursively (File. "resources/public/")) (watcher ["resources/posts/" "resources/pages/"] (rate 300) (on-change (-> change-fn per-change log-exceptions)))) (def watching nil) (defn start-watching [& args] (alter-var-root #'watching (fn [& _] (apply watch args)))) (defn stop-watching [] (when watching (future-cancel watching)))
Speed up test a bit
(ns tx.listen (:use clojure.test) (:require [immutant.cache :as ic] [immutant.messaging :as imsg] [tx.core :as core])) (imsg/start "/queue/trigger") (defn listener [m] (imsg/publish "/queue/test" "kiwi") (imsg/publish "/queue/remote-test" "starfruit" :host "localhost" :port 5445) (ic/put core/cache :a 1) (if (:throw? m) (throw (Exception. "rollback")))) (imsg/listen "/queue/trigger" listener) (defn trigger-listener [throw?] (imsg/publish "/queue/trigger" {:throw? throw?})) (use-fixtures :each core/cache-fixture) (deftest transactional-writes-in-listener-should-work (trigger-listener false) (is (= "kiwi" (imsg/receive "/queue/test" :timeout 2000))) (is (= "starfruit" (imsg/receive "/queue/remote-test"))) (is (= 1 (:a core/cache)))) (deftest transactional-writes-in-listener-should-fail-on-rollback (trigger-listener true) (is (nil? (imsg/receive "/queue/test" :timeout 2000))) (is (nil? (imsg/receive "/queue/remote-test"))) (is (nil? (:a core/cache))))
(ns tx.listen (:use clojure.test) (:require [immutant.cache :as ic] [immutant.messaging :as imsg] [tx.core :as core])) (imsg/start "/queue/trigger") (defn listener [m] (imsg/publish "/queue/test" "kiwi") (imsg/publish "/queue/remote-test" "starfruit" :host "localhost" :port 5445) (ic/put core/cache :a 1) (if (:throw? m) (throw (Exception. "rollback")))) (imsg/listen "/queue/trigger" listener) (defn trigger-listener [throw?] (imsg/publish "/queue/trigger" {:throw? throw?})) (use-fixtures :each core/cache-fixture) (deftest transactional-writes-in-listener-should-work (trigger-listener false) (is (= "kiwi" (imsg/receive "/queue/test" :timeout 2000))) (is (= "starfruit" (imsg/receive "/queue/remote-test"))) (is (= 1 (:a core/cache)))) (deftest transactional-writes-in-listener-should-fail-on-rollback (trigger-listener true) (is (nil? (imsg/receive "/queue/test" :timeout 2000))) (is (nil? (imsg/receive "/queue/remote-test" :timeout 2000))) (is (nil? (:a core/cache))))
Fix ns form, add docstring
(ns braid.server.bots (:require [org.httpkit.client :as http] [taoensso.timbre :as timbre] [braid.server.crypto :as crypto] [braid.server.util :refer [->transit]]) (:import java.io.ByteArrayInputStream)) (defn send-message-notification [bot message] (let [body (->transit message) hmac (crypto/hmac-bytes (bot :token) body)] (timbre/debugf "sending bot notification") (println ; TODO: should this be a POST too? @(http/put (bot :webhook-url) {:headers {"Content-Type" "application/transit+msgpack" "X-Braid-Signature" hmac} :body (ByteArrayInputStream. body)})))) (defn send-event-notification [bot info] (when-let [url (:event-webhook-url bot)] (timbre/debugf "Sending event notification %s to %s" info bot) (let [body (->transit info) hmac (crypto/hmac-bytes (bot :token) body)] (timbre/debugf "sending bot event notification") (println @(http/post url {:headers {"Content-Type" "application/transit+msgpack" "X-Braid-Signature" hmac} :body (ByteArrayInputStream. body)})))))
(ns braid.server.bots "Sending notification of messages and events to bots" (:require [braid.server.crypto :as crypto] [braid.server.util :refer [->transit]] [org.httpkit.client :as http] [taoensso.timbre :as timbre]) (:import (java.io ByteArrayInputStream))) (defn send-message-notification [bot message] (let [body (->transit message) hmac (crypto/hmac-bytes (bot :token) body)] (timbre/debugf "sending bot notification") (println ; TODO: should this be a POST too? @(http/put (bot :webhook-url) {:headers {"Content-Type" "application/transit+msgpack" "X-Braid-Signature" hmac} :body (ByteArrayInputStream. body)})))) (defn send-event-notification [bot info] (when-let [url (:event-webhook-url bot)] (timbre/debugf "Sending event notification %s to %s" info bot) (let [body (->transit info) hmac (crypto/hmac-bytes (bot :token) body)] (timbre/debugf "sending bot event notification") (println @(http/post url {:headers {"Content-Type" "application/transit+msgpack" "X-Braid-Signature" hmac} :body (ByteArrayInputStream. body)})))))
Add missing require for 'plumbing.map'
(ns puppetlabs.trapperkeeper.utils) (def ^{:doc "Alias for plumbing.map/map-leaves-and-path, which is named inconsistently with Clojure conventions as it doesn't behave like other `map` functions. Map functions typically return a `seq`, never a map, and walk functions are used to modify a collection in-place without altering the structure."} walk-leaves-and-path plumbing.map/map-leaves-and-path) (defn service-graph? "Predicate that tests whether or not the argument is a valid trapperkeeper service graph." [service-graph] (and (map? service-graph) (every? keyword? (keys service-graph)) (every? (some-fn ifn? service-graph?) (vals service-graph)))) (defn validate-service-graph! "Validates that the argument is a valid trapperkeeper service graph. Throws an IllegalArgumentException if it is not." [service-graph] (if (service-graph? service-graph) service-graph (throw (IllegalArgumentException. (str "Invalid service graph; service graphs must " "be nested maps of keywords to functions. Found: " service-graph)))))
(ns puppetlabs.trapperkeeper.utils (:require [plumbing.map])) (def ^{:doc "Alias for plumbing.map/map-leaves-and-path, which is named inconsistently with Clojure conventions as it doesn't behave like other `map` functions. Map functions typically return a `seq`, never a map, and walk functions are used to modify a collection in-place without altering the structure."} walk-leaves-and-path plumbing.map/map-leaves-and-path) (defn service-graph? "Predicate that tests whether or not the argument is a valid trapperkeeper service graph." [service-graph] (and (map? service-graph) (every? keyword? (keys service-graph)) (every? (some-fn ifn? service-graph?) (vals service-graph)))) (defn validate-service-graph! "Validates that the argument is a valid trapperkeeper service graph. Throws an IllegalArgumentException if it is not." [service-graph] (if (service-graph? service-graph) service-graph (throw (IllegalArgumentException. (str "Invalid service graph; service graphs must " "be nested maps of keywords to functions. Found: " service-graph)))))
Update test just to make it works
(ns rumahsewa141.test.db.core (:require [rumahsewa141.db.core :refer [*db*] :as db] [luminus-migrations.core :as migrations] [clojure.test :refer :all] [clojure.java.jdbc :as jdbc] [rumahsewa141.config :refer [env]] [mount.core :as mount])) (use-fixtures :once (fn [f] (mount/start #'rumahsewa141.config/env #'rumahsewa141.db.core/*db*) (migrations/migrate ["migrate"] (select-keys env [:database-url])) (f))) (deftest test-users (jdbc/with-db-transaction [t-conn *db*] (jdbc/db-set-rollback-only! t-conn) (is (= 1 (db/create-user! t-conn {:id "1" :first_name "Sam" :last_name "Smith" :email "sam.smith@example.com" :pass "pass"}))) (is (= {:id "1" :first_name "Sam" :last_name "Smith" :email "sam.smith@example.com" :pass "pass" :admin nil :last_login nil :is_active nil} (db/get-user t-conn {:id "1"})))))
(ns rumahsewa141.test.db.core (:require [rumahsewa141.db.core :refer [*db*] :as db] [luminus-migrations.core :as migrations] [clojure.test :refer :all] [clojure.java.jdbc :as jdbc] [rumahsewa141.config :refer [env]] [mount.core :as mount])) (use-fixtures :once (fn [f] (mount/start #'rumahsewa141.config/env #'rumahsewa141.db.core/*db*) (migrations/migrate ["migrate"] (select-keys env [:database-url])) (f))) (deftest test-users (jdbc/with-db-transaction [t-conn *db*] (jdbc/db-set-rollback-only! t-conn) (is (= 1 (db/create-user! t-conn {:username "dingdong123" :nickname "Ding Dong" :phone_no "012-9876543" :password "pass"}))) (is (= {:username "dingdong123" :nickname "Ding Dong" :phone_no "012-9876543" :password "pass" :admin nil} (dissoc (db/fetch-user-by-username t-conn {:username "dingdong123"}) :id)))))
Return new value on write
(ns pericles.routes (:require [compojure.core :refer :all] [compojure.route :as route] [ring.middleware.defaults :refer [wrap-defaults api-defaults]] [gpio.core :as gpio] [pericles.gpio :refer [port]] [pericles.handlers :as handlers])) (defroutes api-routes (GET "/" [] "Hello world!") (GET "/readPort" [] (name (gpio/read-value @port))) (GET "/writePort" [value] (gpio/write-value! @port value)) (route/not-found "Not found!")) (def app (-> #'api-routes (wrap-defaults api-defaults) handlers/wrap-catch-exceptions handlers/wrap-log-request))
(ns pericles.routes (:require [compojure.core :refer :all] [compojure.route :as route] [compojure.coercions :refer [as-int]] [ring.middleware.defaults :refer [wrap-defaults api-defaults]] [ring.util.http-response :as resp] [gpio.core :as gpio] [pericles.gpio :refer [port]] [pericles.handlers :as handlers])) (defroutes api-routes (GET "/" [] "Hello world!") (GET "/readPort" [] (name (gpio/read-value @port))) (GET "/writePort" [value :<< as-int] (do (gpio/write-value! @port value) (name (gpio/read-value @port)))) (GET "/readTemp" [] "27C") (route/not-found "Not found!")) (def app (-> #'api-routes (wrap-defaults api-defaults) handlers/wrap-catch-exceptions handlers/wrap-log-request))
Use thread macro to clarify code
(ns whitman.core (:require [clojure.data.json :as json]) (:gen-class)) (defn exit [code msg] (binding [*out* *err*] (do (println msg) (System/exit code)))) (defn -main [& args] (if (< (count args) 1) (exit 1 "No configuration file specified") (println (json/read-str (slurp (nth args 0))))))
(ns whitman.core (:require [clojure.data.json :as json]) (:gen-class)) (defn exit [code msg] (binding [*out* *err*] (do (println msg) (System/exit code)))) (defn -main [& args] (if (< (count args) 1) (exit 1 "No configuration file specified") (-> (nth args 0) slurp json/read-str println)))
Delete the render method at the moment.
(ns my-noir-lab.views.welcome (:require [my-noir-lab.views.common :as common]) (:use [noir.core :only [defpage render]] [hiccup.core :only [html]] [hiccup.form-helpers :only [form-to submit-button]])) (defpage "/welcome" [] (common/layout [:p "Welcome to my-noir-lab"])) (defpage "/my-page" [] (common/site-layout "Welcome" [:h1 "Hello"] [:p#wrapper "Hope you like it!"])) (defpage "/range" {:as user} (common/site-layout "Range input" [:h1 "range method"] (form-to [:post "/range"] (common/input-fields-range user) (submit-button "submit")))) (defpage [:post "/range"] {:keys [start end] :as user} (common/site-layout "Range" [:h2 (str "Display range from " start " to " end)] [:p#wrapper (map #(str % "<br />") (range (read-string start) (read-string end)))] (render "/range" user)))
(ns my-noir-lab.views.welcome (:require [my-noir-lab.views.common :as common]) (:use [noir.core :only [defpage render]] [hiccup.core :only [html]] [hiccup.form-helpers :only [form-to submit-button]])) (defpage "/welcome" [] (common/layout [:p "Welcome to my-noir-lab"])) (defpage "/my-page" [] (common/site-layout "Welcome" [:h1 "Hello"] [:p#wrapper "Hope you like it!"])) (defpage "/range" {:as user} (common/site-layout "Range input" [:h1 "range method"] (form-to [:post "/range"] (common/input-fields-range user) (submit-button "submit")))) (defpage [:post "/range"] {:keys [start end] :as user} (common/site-layout "Range" [:h2 (str "Display range from " start " to " end)] [:p#wrapper (map #(str % "<br />") (range (read-string start) (read-string end)))]))
Return current time, UTC, floored to midnight
(ns karmanaut.utils (:gen-class) (:require [clojure.java.io :as io]) (:import [java.util Date])) (defn env [key default] (get (System/getenv) key default)) (defn version [] (if (.exists (io/as-file "project.clj")) (-> "project.clj" slurp read-string (nth 2)) (-> (eval 'karmanaut.utils) .getPackage .getImplementationVersion))) (defn utcnow [] (Date.)) (defn long-to-date "Reddit timestamps are the number of seconds since the Unix epoch, in UTC." [epoch] (Date. (* 1000 (long epoch))))
(ns karmanaut.utils (:gen-class) (:require [clojure.java.io :as io]) (:import [java.util Calendar Date GregorianCalendar TimeZone])) (defn env [key default] (get (System/getenv) key default)) (defn version [] (if (.exists (io/as-file "project.clj")) (-> "project.clj" slurp read-string (nth 2)) (-> (eval 'karmanaut.utils) .getPackage .getImplementationVersion))) (defn utcnow [] (Date.)) (defn utcnow-midnight [] (let [tz (TimeZone/getTimeZone "UTC") c (GregorianCalendar. tz)] (doto c (.set Calendar/HOUR_OF_DAY 0) (.set Calendar/MINUTE 0) (.set Calendar/SECOND 0) (.set Calendar/MILLISECOND 0)) (.getTime c))) (defn long-to-date "Reddit timestamps are the number of seconds since the Unix epoch, in UTC." [epoch] (Date. (* 1000 (long epoch))))
Update dependency to latest usable version
(defproject io.aviso/rook "0.1.8-SNAPSHOT" :description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps" :url "https://github.com/AvisoNovate/rook" :license {:name "Apache Sofware License 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0.html"} ;; Normally we don't AOT compile; only when tracking down reflection warnings. :profiles {:reflection-warnings {:aot :all :global-vars {*warn-on-reflection* true}} :dev {:dependencies [[ring-mock "0.1.5"] [io.aviso/pretty "0.1.10"] [speclj "2.5.0"] [log4j "1.2.17"]]}} :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/core.async "0.1.267.0-0d7780-alpha"] [org.clojure/tools.logging "0.2.6"] [ring-middleware-format "0.3.2"] [prismatic/schema "0.2.1"] [compojure "1.1.6"]] :plugins [[test2junit "1.0.1"] [speclj "2.5.0"]] :test-paths ["spec"])
(defproject io.aviso/rook "0.1.8-SNAPSHOT" :description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps" :url "https://github.com/AvisoNovate/rook" :license {:name "Apache Sofware License 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0.html"} ;; Normally we don't AOT compile; only when tracking down reflection warnings. :profiles {:reflection-warnings {:aot :all :global-vars {*warn-on-reflection* true}} :dev {:dependencies [[ring-mock "0.1.5"] [io.aviso/pretty "0.1.10"] [speclj "2.9.1"] [log4j "1.2.17"]]}} :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/core.async "0.1.267.0-0d7780-alpha"] [org.clojure/tools.logging "0.2.6"] [ring-middleware-format "0.3.2"] [prismatic/schema "0.2.1"] [compojure "1.1.6"]] :plugins [[test2junit "1.0.1"] [speclj "2.9.1"]] :test-paths ["spec"])
Update eastwood and core.async dependencies.
;(defproject cli4clj "1.3.2" (defproject cli4clj "1.3.3-SNAPSHOT" :description "Create simple interactive CLIs for Clojure applications." :url "https://github.com/ruedigergad/cli4clj" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.9.0"] [clj-assorted-utils "1.18.2"] [org.clojure/core.async "0.3.443"] [jline/jline "2.14.2"]] :global-vars {*warn-on-reflection* true} :html5-docs-docs-dir "ghpages/doc" :html5-docs-ns-includes #"^cli4clj.*" :html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master" :test2junit-output-dir "ghpages/test-results" :test2junit-run-ant true :main cli4clj.example :plugins [[lein-cloverage "1.0.2"] [test2junit "1.3.3"] [lein-html5-docs "3.0.3"]] :profiles {:repl {:dependencies [[jonase/eastwood "0.2.4" :exclusions [org.clojure/clojure]]]}} )
;(defproject cli4clj "1.3.2" (defproject cli4clj "1.3.3-SNAPSHOT" :description "Create simple interactive CLIs for Clojure applications." :url "https://github.com/ruedigergad/cli4clj" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.9.0"] [clj-assorted-utils "1.18.2"] [org.clojure/core.async "0.3.465"] [jline/jline "2.14.2"]] :global-vars {*warn-on-reflection* true} :html5-docs-docs-dir "ghpages/doc" :html5-docs-ns-includes #"^cli4clj.*" :html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master" :test2junit-output-dir "ghpages/test-results" :test2junit-run-ant true :main cli4clj.example :plugins [[lein-cloverage "1.0.2"] [test2junit "1.3.3"] [lein-html5-docs "3.0.3"]] :profiles {:repl {:dependencies [[jonase/eastwood "0.2.5" :exclusions [org.clojure/clojure]]]}} )
Set clojure 1.8.0 as default clojure.
(defproject uxbox "0.1.0-SNAPSHOT" :description "UXBox client" :url "http://uxbox.github.io" :license {:name "" :url ""} :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"] [org.clojure/clojurescript "1.7.228" :scope "provided"] [figwheel-sidecar "0.5.0-2" :scope "test"] ;; runtime [rum "0.6.0" :exclusions [sablono]] [sablono "0.5.3"] [cljsjs/react "0.14.3-0"] [cljsjs/react-dom "0.14.3-1"] [cljsjs/react-dom-server "0.14.3-0"] [cljsjs/moment "2.10.6-0"] [funcool/promesa "0.7.0"] [funcool/beicon "0.5.1"] [funcool/cats "1.2.1"] [funcool/cuerdas "0.7.1"] [funcool/hodgepodge "0.1.4"] [bouncer "1.0.0"] [bidi "1.21.0"]] :clean-targets ^{:protect false} ["resources/public/js" "target"] )
(defproject uxbox "0.1.0-SNAPSHOT" :description "UXBox client" :url "http://uxbox.github.io" :license {:name "" :url ""} :jvm-opts ["-Dclojure.compiler.direct-linking=true"] :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"] [org.clojure/clojurescript "1.7.228" :scope "provided"] [figwheel-sidecar "0.5.0-2" :scope "test"] ;; runtime [rum "0.6.0" :exclusions [sablono]] [sablono "0.5.3"] [cljsjs/react "0.14.3-0"] [cljsjs/react-dom "0.14.3-1"] [cljsjs/react-dom-server "0.14.3-0"] [cljsjs/moment "2.10.6-0"] [funcool/promesa "0.7.0"] [funcool/beicon "0.5.1"] [funcool/cats "1.2.1"] [funcool/cuerdas "0.7.1"] [funcool/hodgepodge "0.1.4"] [bouncer "1.0.0"] [bidi "1.21.0"]] :clean-targets ^{:protect false} ["resources/public/js" "target"] )
Prepare for next release cycle.
(defproject onyx-plugin/lein-template "0.8.2.5" :description "A Leiningen 2.0 template for new Onyx plugins" :url "http://github.com/MichaelDrogalis/onyx-plugin" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
(defproject onyx-plugin/lein-template "0.8.2.6-SNAPSHOT" :description "A Leiningen 2.0 template for new Onyx plugins" :url "http://github.com/MichaelDrogalis/onyx-plugin" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
Update dependency org.clojure:clojure to v1.10.3
(defproject strava-activity-graphs "0.1.0-SNAPSHOT" :description "Generate statistical charts for Strava activities" :url "https://github.com/nicokosi/strava-activity-graphs" :license {:name "Creative Commons Attribution 4.0" :url "https://creativecommons.org/licenses/by/4.0/"} :dependencies [[org.clojure/clojure "1.10.2"] [incanter/incanter-core "1.9.3"] [incanter/incanter-charts "1.9.3"] [incanter/incanter-io "1.9.3"] [org.clojure/data.json "1.0.0"] [clj-http "3.11.0"] [slingshot "0.12.2"]] :plugins [[lein-cljfmt "0.7.0"]] :main ^:skip-aot strava-activity-graphs.core :target-path "target/%s" :profiles {:uberjar {:aot :all}})
(defproject strava-activity-graphs "0.1.0-SNAPSHOT" :description "Generate statistical charts for Strava activities" :url "https://github.com/nicokosi/strava-activity-graphs" :license {:name "Creative Commons Attribution 4.0" :url "https://creativecommons.org/licenses/by/4.0/"} :dependencies [[org.clojure/clojure "1.10.3"] [incanter/incanter-core "1.9.3"] [incanter/incanter-charts "1.9.3"] [incanter/incanter-io "1.9.3"] [org.clojure/data.json "1.0.0"] [clj-http "3.11.0"] [slingshot "0.12.2"]] :plugins [[lein-cljfmt "0.7.0"]] :main ^:skip-aot strava-activity-graphs.core :target-path "target/%s" :profiles {:uberjar {:aot :all}})
Add clansi as a dependency
(set-env! :source-paths #{"src"} :dependencies '[[org.clojure/clojure "1.6.0" :scope "provided"] [boot/core "2.1.0" :scope "provided"] [junit "4.12"] [org.reflections/reflections "0.9.10"] [org.glassfish/javax.servlet "3.0"]]) (require '[radicalzephyr.boot-junit :refer [junit]]) (def +version+ "0.1.0") (task-options! pom {:project 'radicalzephyr/boot-junit :version +version+ :description "Run some jUnit tests in boot!" :url "https://github.com/radicalzephyr/boot-junit" :scm {:url "https://github.com/radicalzephyr/boot-junit"} :license {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}} junit {:packages '#{radicalzephyr.boot_junit.test}})
(set-env! :source-paths #{"src"} :dependencies '[[org.clojure/clojure "1.6.0" :scope "provided"] [boot/core "2.1.0" :scope "provided"] [junit "4.12" :scope "test"] [org.reflections/reflections "0.9.10" :scope "test"] [org.glassfish/javax.servlet "3.0" :scope "test"] [radicalzephyr/clansi "1.2.0" :scope "test"]]) (require '[radicalzephyr.boot-junit :refer [junit]]) (def +version+ "0.1.0") (task-options! pom {:project 'radicalzephyr/boot-junit :version +version+ :description "Run some jUnit tests in boot!" :url "https://github.com/radicalzephyr/boot-junit" :scm {:url "https://github.com/radicalzephyr/boot-junit"} :license {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}} junit {:packages '#{radicalzephyr.boot_junit.test}})
Switch to in-memory database default for dev/test.
{ :uberjar { :aot :all } :dev { :resource-paths ["src/dev/resources"] :source-paths ["src/dev/clj"] :dependencies [[org.clojure/tools.namespace "0.2.7"]] :env {:db-url "plocal:D:/temp/orientdb/dev" :db-admin-user nil :db-admin-pwd nil :bind 8081} } :test { :resource-paths ["src/dev/resources"] :dependencies [[clj-http "1.0.1"]] :env {:db-url "plocal:D:/temp/orientdb/test" :db-admin-user nil :db-admin-pwd nil :bind 8082} } }
{ :uberjar { :aot :all } :dev { :resource-paths ["src/dev/resources"] :source-paths ["src/dev/clj"] :dependencies [[org.clojure/tools.namespace "0.2.7"]] :env {:db-url "memory:devdb" :db-admin-user nil :db-admin-pwd nil :bind 8081} } :test { :resource-paths ["src/dev/resources"] :dependencies [[clj-http "1.0.1"]] :env {:db-url "memory:testdb" :db-admin-user nil :db-admin-pwd nil :bind 8082} } }
Add possibility to configure root path via :root key
(ns clj-gatling.core (:import (org.joda.time LocalDateTime)) (:require [clojure-csv.core :as csv] [clj-gatling.chart :as chart] [clj-gatling.report :as report] [clj-gatling.simulation :as simulation])) (def results-dir "target/results") (defn create-dir [dir] (.mkdirs (java.io.File. dir))) (defn run-simulation [scenario users] (let [start-time (LocalDateTime.) result (simulation/run-simulation scenario users) csv (csv/write-csv (report/create-result-lines start-time result) :delimiter "\t" :end-of-line "\n")] (create-dir (str results-dir "/input")) (spit (str results-dir "/input/simulation.log") csv) (chart/create-chart results-dir) (println (str "Open " results-dir "/output/index.html"))))
(ns clj-gatling.core (:import (org.joda.time LocalDateTime)) (:require [clojure-csv.core :as csv] [clj-gatling.chart :as chart] [clj-gatling.report :as report] [clj-gatling.simulation :as simulation])) (defn create-dir [dir] (.mkdirs (java.io.File. dir))) (defn run-simulation [scenario users & [options]] (let [start-time (LocalDateTime.) results-dir (if (nil? (:root options)) "target/results" (:root options)) result (simulation/run-simulation scenario users) csv (csv/write-csv (report/create-result-lines start-time result) :delimiter "\t" :end-of-line "\n")] (create-dir (str results-dir "/input")) (spit (str results-dir "/input/simulation.log") csv) (chart/create-chart results-dir) (println (str "Open " results-dir "/output/index.html"))))
Add a "boot release" task to generate optimized JS/CSS
#!/usr/bin/env boot (set-env! :source-paths #{"less" "src"} :resource-paths #{"html" "resources"} :dependencies '[; Boot setup [adzerk/boot-cljs "1.7.170-1"] [adzerk/boot-reload "0.4.1"] [deraen/boot-less "0.4.2"] [pandeiro/boot-http "0.7.0-SNAPSHOT"] ; App dependencies [org.clojure/clojurescript "1.7.170"] [org.omcljs/om "1.0.0-alpha18-SNAPSHOT"] ; Other dependencies [devcards "0.2.0-8"]]) (task-options! pom {:project "om-next-kanban-demo" :version "0.1.0-SNAPSHOT"}) (require '[adzerk.boot-cljs :refer [cljs]] '[adzerk.boot-reload :refer [reload]] '[deraen.boot-less :refer [less]] '[pandeiro.boot-http :refer [serve]]) (deftask run [] (comp (watch) (speak) (reload :on-jsload 'kanban.app/run) (less) (cljs :source-map true :optimizations :none :compiler-options {:devcards true}) (serve :dir "target")))
#!/usr/bin/env boot (set-env! :source-paths #{"less" "src"} :resource-paths #{"html" "resources"} :dependencies '[; Boot setup [adzerk/boot-cljs "1.7.170-1"] [adzerk/boot-reload "0.4.1"] [deraen/boot-less "0.4.2"] [pandeiro/boot-http "0.7.0-SNAPSHOT"] ; App dependencies [org.clojure/clojurescript "1.7.170"] [org.omcljs/om "1.0.0-alpha18-SNAPSHOT"] ; Other dependencies [devcards "0.2.0-8"]]) (task-options! pom {:project "om-next-kanban-demo" :version "0.1.0-SNAPSHOT"}) (require '[adzerk.boot-cljs :refer [cljs]] '[adzerk.boot-reload :refer [reload]] '[deraen.boot-less :refer [less]] '[pandeiro.boot-http :refer [serve]]) (deftask run [] (comp (watch) (speak) (reload :on-jsload 'kanban.app/run) (less) (cljs :source-map true :optimizations :none :compiler-options {:devcards true}) (serve :dir "target"))) (deftask release [] (comp (less :compression true) (cljs :optimizations :advanced :compiler-options {:devcards true})))
Fix dependency unpacking to use right directory.
(ns leiningen.deps (:require [lancet]) (:use [leiningen] [clojure.contrib.java-utils :only [file]]) (:import [org.apache.maven.model Dependency] [org.apache.maven.artifact.ant DependenciesTask] [org.apache.tools.ant.util FlatFileNameMapper])) (defn- make-dependency [[group name version]] (doto (Dependency.) (.setGroupId group) (.setArtifactId name) (.setVersion version))) (defn deps "Install dependencies in lib/" [project & args] (let [deps-task (DependenciesTask.)] (.setBasedir lancet/ant-project (:root project)) (.setFilesetId deps-task "dependency.fileset") (.setProject deps-task lancet/ant-project) (.setPathId deps-task (:name project)) (doseq [dep (:dependencies project)] (.addDependency deps-task (make-dependency dep))) (.execute deps-task) (.mkdirs (file (:root project) "lib")) (lancet/copy {:todir "lib/"} (.getReference lancet/ant-project (.getFilesetId deps-task)) (FlatFileNameMapper.))))
(ns leiningen.deps (:require [lancet]) (:use [clojure.contrib.java-utils :only [file]]) (:import [org.apache.maven.model Dependency] [org.apache.maven.artifact.ant DependenciesTask] [org.apache.tools.ant.util FlatFileNameMapper])) (defn- make-dependency [[group name version]] (doto (Dependency.) (.setGroupId group) (.setArtifactId name) (.setVersion version))) (defn deps "Install dependencies in lib/" [project & args] (let [deps-task (DependenciesTask.)] (.setBasedir lancet/ant-project (:root project)) (.setFilesetId deps-task "dependency.fileset") (.setProject deps-task lancet/ant-project) (.setPathId deps-task (:name project)) (doseq [dep (:dependencies project)] (.addDependency deps-task (make-dependency dep))) (.execute deps-task) (.mkdirs (file (:root project) "lib")) (lancet/copy {:todir (str (:root project) "/lib/")} (.getReference lancet/ant-project (.getFilesetId deps-task)) (FlatFileNameMapper.))))
Update to my latest and greatest bootlaces
(set-env! :source-paths #{"src"} :resource-paths #{"src"} :dependencies '[[org.clojure/clojure "1.6.0" :scope "provided"] [boot/core "2.1.0" :scope "provided"] [junit "4.12" :scope "test"] [radicalzephyr/bootlaces "0.1.12"]]) (require '[radicalzephyr.bootlaces :refer :all] '[radicalzephyr.boot-junit :refer [junit]]) (def +version+ "0.2.1-SNAPSHOT") (bootlaces! +version+) (task-options! pom {:project 'radicalzephyr/boot-junit :version +version+ :description "Run some jUnit tests in boot!" :url "https://github.com/radicalzephyr/boot-junit" :scm {:url "https://github.com/radicalzephyr/boot-junit"} :license {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}} junit {:packages '#{radicalzephyr.boot_junit.test}})
(set-env! :source-paths #{"src"} :resource-paths #{"src"} :dependencies '[[org.clojure/clojure "1.6.0" :scope "provided"] [boot/core "2.1.0" :scope "provided"] [junit "4.12" :scope "test"] [radicalzephyr/bootlaces "0.1.15-SNAPSHOT"]]) (require '[radicalzephyr.bootlaces :refer :all] '[radicalzephyr.boot-junit :refer [junit]]) (def +version+ "0.2.1-SNAPSHOT") (bootlaces! +version+) (task-options! pom {:project 'radicalzephyr/boot-junit :version +version+ :description "Run some jUnit tests in boot!" :url "https://github.com/radicalzephyr/boot-junit" :scm {:url "https://github.com/radicalzephyr/boot-junit"} :license {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}} junit {:packages '#{radicalzephyr.boot_junit.test}})
Add exclamation point to train-model-file\!
(ns analyze-data.train-model (:require [analyze-data.naive-bayes.train :as naive-bayes] [analyze-data.serialize :refer [read-object write-object!]])) (defmulti train-model "Train a model on a dataset. model-type: one of [:knn :naive-bayes] dataset: a dataset (e.g. produced by corpus-to-dataset) Return a model, which is a map with the following keys: :type the type of the model :parameters the learned parameters of the model :dataset the dataset the model was trained on" (fn [model-type dataset] model-type)) (defn train-model-file "Like train-model, but accepts a file name for input and output. model-type: type of model to create in: path to a dataset file out: path where the trained model will be written as a serialized map." [model-type in out] (let [dataset (read-object in) model (train-model model-type dataset)] (write-object! out model))) (defmethod train-model :knn [model-type dataset] {:type model-type :parameters nil :dataset dataset}) (defmethod train-model :naive-bayes [model-type dataset] (let [{:keys [X y]} dataset] {:type model-type :parameters (naive-bayes/train X y) :dataset dataset}))
(ns analyze-data.train-model (:require [analyze-data.naive-bayes.train :as naive-bayes] [analyze-data.serialize :refer [read-object write-object!]])) (defmulti train-model "Train a model on a dataset. model-type: one of [:knn :naive-bayes] dataset: a dataset (e.g. produced by corpus-to-dataset) Return a model, which is a map with the following keys: :type the type of the model :parameters the learned parameters of the model :dataset the dataset the model was trained on" (fn [model-type dataset] model-type)) (defn train-model-file! "Like train-model, but accepts a file name for input and output. model-type: type of model to create in: path to a dataset file out: path where the trained model will be written as a serialized map." [model-type in out] (let [dataset (read-object in) model (train-model model-type dataset)] (write-object! out model))) (defmethod train-model :knn [model-type dataset] {:type model-type :parameters nil :dataset dataset}) (defmethod train-model :naive-bayes [model-type dataset] (let [{:keys [X y]} dataset] {:type model-type :parameters (naive-bayes/train X y) :dataset dataset}))
Change gamepad test function to specify 'harness'.
(ns org.playasophy.wonderdome.input.gamepad-test (:require [clojure.core.async :as async :refer [<!]] [clojure.test :refer :all] [com.stuartsierra.component :as component] [org.playasophy.wonderdome.input.gamepad :as gamepad])) (defn gamepad-test "Creates and starts a gamepad input component attached to a channel and reader which will print events received to the console." [] (let [channel (async/chan (async/dropping-buffer 5)) input (gamepad/snes channel)] (async/go-loop [] (prn (<! channel)) (recur)) (component/start input)))
(ns org.playasophy.wonderdome.input.gamepad-test (:require [clojure.core.async :as async :refer [<!]] [clojure.test :refer :all] [com.stuartsierra.component :as component] [org.playasophy.wonderdome.input.gamepad :as gamepad])) (defn gamepad-harness "Creates and starts a gamepad input component attached to a channel and reader which will print events received to the console." [] (let [channel (async/chan (async/dropping-buffer 5)) input (gamepad/snes channel)] (async/go-loop [] (prn (<! channel)) (recur)) (component/start input)))
Set main namespace (for `lein run`)
(defproject robb1e "0.1.0-SNAPSHOT" :description "Personal website for robb1e" :url "https://github.com/robb1e/robb1e.clj" :min-lein-version "2.0.0" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] [ring/ring-jetty-adapter "1.2.1"] [hiccup "1.0.4"] [compojure "1.1.6"] [org.clojure/java.jdbc "0.3.2"] [postgresql "9.1-901.jdbc4"] [clj-time "0.6.0"]] :plugins [[lein-haml-sass "0.2.7-SNAPSHOT"]] :sass {:src "resources/sass" :output-directory "resources/public/stylesheets" :output-extension "css" ;; Other options (provided are default values) ;; :auto-compile-delay 250 ;; :delete-output-dir true ;; -> when running lein clean it will delete the output directory if it does not contain any file ;; :ignore-hooks [:clean :compile :deps] ;; -> if you use the hooks, this option allows you to remove some hooks that you don't want to run ;; :gem-version "3.2.1" } )
(defproject robb1e "0.1.0-SNAPSHOT" :description "Personal website for robb1e" :url "https://github.com/robb1e/robb1e.clj" :min-lein-version "2.0.0" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] [ring/ring-jetty-adapter "1.2.1"] [hiccup "1.0.4"] [compojure "1.1.6"] [org.clojure/java.jdbc "0.3.2"] [postgresql "9.1-901.jdbc4"] [clj-time "0.6.0"]] :main robb1e.web :plugins [[lein-haml-sass "0.2.7-SNAPSHOT"]] :sass {:src "resources/sass" :output-directory "resources/public/stylesheets" :output-extension "css" ;; Other options (provided are default values) ;; :auto-compile-delay 250 ;; :delete-output-dir true ;; -> when running lein clean it will delete the output directory if it does not contain any file ;; :ignore-hooks [:clean :compile :deps] ;; -> if you use the hooks, this option allows you to remove some hooks that you don't want to run ;; :gem-version "3.2.1" } )
Update dependencies to latest versions
(defproject java-s3-tests/java-s3-tests "0.0.1" :dependencies [[org.clojure/clojure "1.4.0"] [com.amazonaws/aws-java-sdk "1.3.11"] [com.reiddraper/clj-aws-s3 "0.4.0"] [commons-codec/commons-codec "1.6"] [clj-http "0.4.3"] [cheshire "4.0.0"]] :profiles {:dev {:dependencies [[midje "1.4.0"]]}} :min-lein-version "2.0.0" :plugins [[lein-midje "2.0.1"]] :description "integration tests for Riak CS using the offical Java SDK")
(defproject java-s3-tests/java-s3-tests "0.0.1" :dependencies [[org.clojure/clojure "1.5.1"] [com.reiddraper/clj-aws-s3 "0.4.0"] [clj-http "0.7.1"] [cheshire "5.1.0"]] :profiles {:dev {:dependencies [[midje "1.5.1"]]}} :min-lein-version "2.0.0" :plugins [[lein-midje "3.0.1"]] :description "integration tests for Riak CS using the offical Java SDK")
Fix the test to not depend on the current process's env
(ns circle.workers.test-github (:use circle.backend.build.test-utils) (:require [circle.model.build :as build]) (:use [circle.util.mongo]) (:require [somnium.congomongo :as mongo]) (:use midje.sweet) (:use circle.workers.github)) (test-ns-setup) (fact "start-build-from-hook works with dummy project" (let [json circle-dummy-project-json-str id (object-id) _ (mongo/insert! :builds {:_id id}) build (start-build-from-hook nil nil nil json (str id))] (-> @build :vcs_url) => truthy (-> build (build/successful?)) => true (-> @build :build_num) => integer? (-> @build :_id) => id)) (fact "authorization-url works" (-> "http://localhost:3000/hooks/repos" authorization-url) => "https://github.com/login/oauth/authorize?client_id=586bf699b48f69a09d8c&scope=repo&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fhooks%2Frepos")
(ns circle.workers.test-github (:use circle.backend.build.test-utils) (:require [circle.model.build :as build]) (:use [circle.util.mongo]) (:require [somnium.congomongo :as mongo]) (:use midje.sweet) (:use circle.workers.github)) (test-ns-setup) (fact "start-build-from-hook works with dummy project" (let [json circle-dummy-project-json-str id (object-id) _ (mongo/insert! :builds {:_id id}) build (start-build-from-hook nil nil nil json (str id))] (-> @build :vcs_url) => truthy (-> build (build/successful?)) => true (-> @build :build_num) => integer? (-> @build :_id) => id)) (fact "authorization-url works" (-> "http://localhost:3000/hooks/repos" authorization-url) => "https://github.com/login/oauth/authorize?client_id=586bf699b48f69a09d8c&scope=repo&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fhooks%2Frepos" (provided (circle.env/env) => :test))
Add user-media function to get WebKit user media
(ns audio-utils.web-audio) (defn audio-context [] (let [constructor (or js/window.AudioContext js/window.webkitAudioContext)] (constructor.))) (defn create-buffer ([ctx n-channels size sample-rate] (.createBuffer ctx n-channels size sample-rate))) (defn create-buffer-from-data [ctx n-channels sample-rate data] (let [buf (create-buffer ctx n-channels (count (cond-> data (> n-channels 1) first)) sample-rate)] (doseq [channel (range 0 n-channels) :let [channel-data (.getChannelData buf channel) input-data (cond-> data (> n-channels 1) (get channel))]] (doseq [[i x] (map-indexed vector input-data)] (aset channel-data i x))) buf)) (defn create-buffer-source ([ctx] (.createBufferSource ctx)) ([ctx n-channels sample-rate data] (doto (create-buffer-source ctx) (aset "buffer" (create-buffer-from-data ctx n-channels sample-rate data)))))
(ns audio-utils.web-audio) (defn audio-context [] (let [constructor (or js/window.AudioContext js/window.webkitAudioContext)] (constructor.))) (defn user-media [constraints success-fn error-fn] (.webkitGetUserMedia js/navigator (clj->js constraints) success-fn error-fn)) (defn create-buffer ([ctx n-channels size sample-rate] (.createBuffer ctx n-channels size sample-rate))) (defn create-buffer-from-data [ctx n-channels sample-rate data] (let [buf (create-buffer ctx n-channels (count (cond-> data (> n-channels 1) first)) sample-rate)] (doseq [channel (range 0 n-channels) :let [channel-data (.getChannelData buf channel) input-data (cond-> data (> n-channels 1) (get channel))]] (doseq [[i x] (map-indexed vector input-data)] (aset channel-data i x))) buf)) (defn create-buffer-source ([ctx] (.createBufferSource ctx)) ([ctx n-channels sample-rate data] (doto (create-buffer-source ctx) (aset "buffer" (create-buffer-from-data ctx n-channels sample-rate data)))))
Add cljsbuild opts to tests
(ns lein-doo.config (:require [clojure.test :refer :all] [leiningen.doo :as doo])) (deftest correct-main (testing "doo can handle three types for main" (doseq [main '('lein.core "lein.core" lein.core)] (is (doo/correct-builds {:cljsbuild {:builds {:dev {:compiler {:main main}}}}})))))
(ns lein-doo.config (:require [clojure.test :refer :all] [leiningen.doo :as doo])) (deftest correct-main (testing "doo can handle three types for main" (letfn [(find-dev [project] (doo/find-by-id (get-in project [:cljsbuild :builds]) "dev"))] (doseq [main '('lein.core "lein.core" lein.core)] (is (= "dev" (-> {:cljsbuild {:builds [{:id "dev" :compiler {:main main}}]}} doo/correct-builds find-dev :id))) (is (= "dev" (-> {:cljsbuild {:builds {:dev {:compiler {:main main}}}}} doo/correct-builds find-dev :id)))))))
Add one more subtask-help test.
(ns test-help (:use [leiningen.help] [clojure.test])) (def formatted-docstring @#'leiningen.help/formatted-docstring) (def formatted-help @#'leiningen.help/formatted-help) (def resolve-task @#'leiningen.help/resolve-task) (deftest blank-subtask-help-for-new (let [subtask-help (apply subtask-help-for (resolve-task "new"))] (is (= nil subtask-help)))) (deftest subtask-help-for-plugin (let [subtask-help (apply subtask-help-for (resolve-task "plugin"))] (is (re-find #"install" subtask-help)) (is (re-find #"uninstall" subtask-help)))) (deftest test-docstring-formatting (is (= "This is an AWESOME command For real!" (formatted-docstring "install" "This is an\n AWESOME command\nFor real!" 5)))) (deftest test-formatted-help (is (= "install This is an AWESOME command For real!" (formatted-help "install" "This is an\nAWESOME command\nFor real!" 15))))
(ns test-help (:use [leiningen.help] [clojure.test])) (def formatted-docstring @#'leiningen.help/formatted-docstring) (def get-subtasks-and-docstrings-for @#'leiningen.help/get-subtasks-and-docstrings-for) (def formatted-help @#'leiningen.help/formatted-help) (def resolve-task @#'leiningen.help/resolve-task) (deftest blank-subtask-help-for-new (let [subtask-help (apply subtask-help-for (resolve-task "new"))] (is (= nil subtask-help)))) (deftest subtask-help-for-plugin (let [subtask-help (apply subtask-help-for (resolve-task "plugin"))] (is (re-find #"install" subtask-help)) (is (re-find #"uninstall" subtask-help)))) (deftest test-docstring-formatting (is (= "This is an AWESOME command For real!" (formatted-docstring "install" "This is an\n AWESOME command\nFor real!" 5)))) (deftest test-formatted-help (is (= "install This is an AWESOME command For real!" (formatted-help "install" "This is an\nAWESOME command\nFor real!" 15)))) (deftest test-get-subtasks (let [m (get-subtasks-and-docstrings-for (second (resolve-task "plugin")))] (is (= ["install" "uninstall"] (sort (keys m))))))
Allow output to work like println w/ & args.
(ns isla.story-utils) (defn take-input [] (print "$ ") (flush) (read-line)) (defn output [given-output] (println " " given-output))
(ns isla.story-utils) (defn take-input [] (print "$ ") (flush) (read-line)) (defn output [& outs] (apply println " " outs))
Add selmer as a dependency
(defproject madouc "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"] [ring/ring-core "1.5.1"] [ring/ring-devel "1.5.1"] [ring-logger "0.7.7"] [ring-logger-timbre "0.7.5"] [com.taoensso/timbre "4.8.0"] [com.fzakaria/slf4j-timbre "0.3.4"] [compojure "1.5.2"] [metosin/compojure-api "1.1.10"] [environ "1.1.0"] [org.immutant/web "2.1.6" :exclusions [ch.qos.logback/logback-classic]]] :main madouc.core :profiles {:dev {:plugins [[lein-environ "1.1.0"]] :env {:madouc-env "dev"}} :uberjar {:aot :all}})
(defproject madouc "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"] [ring/ring-core "1.5.1"] [ring/ring-devel "1.5.1"] [ring-logger "0.7.7"] [ring-logger-timbre "0.7.5"] [com.taoensso/timbre "4.8.0"] [com.fzakaria/slf4j-timbre "0.3.4"] [compojure "1.5.2"] [metosin/compojure-api "1.1.10"] [environ "1.1.0"] [org.immutant/web "2.1.6" :exclusions [ch.qos.logback/logback-classic]] [selmer "1.10.6"]] :main madouc.core :profiles {:dev {:plugins [[lein-environ "1.1.0"]] :env {:madouc-env "dev"}} :uberjar {:aot :all}})
Add aliases for testing and benchmarking
(defproject ring "1.8.0" :description "A Clojure web applications library." :url "https://github.com/ring-clojure/ring" :license {:name "The MIT License" :url "http://opensource.org/licenses/MIT"} :dependencies [[ring/ring-core "1.8.0"] [ring/ring-devel "1.8.0"] [ring/ring-jetty-adapter "1.8.0"] [ring/ring-servlet "1.8.0"]] :plugins [[lein-sub "0.2.4"] [lein-codox "0.10.3"]] :sub ["ring-core" "ring-devel" "ring-jetty-adapter" "ring-servlet"] :codox {:output-path "codox" :source-uri "http://github.com/ring-clojure/ring/blob/{version}/{filepath}#L{line}" :source-paths ["ring-core/src" "ring-devel/src" "ring-jetty-adapter/src" "ring-servlet/src"]})
(defproject ring "1.8.0" :description "A Clojure web applications library." :url "https://github.com/ring-clojure/ring" :license {:name "The MIT License" :url "http://opensource.org/licenses/MIT"} :dependencies [[ring/ring-core "1.8.0"] [ring/ring-devel "1.8.0"] [ring/ring-jetty-adapter "1.8.0"] [ring/ring-servlet "1.8.0"]] :plugins [[lein-sub "0.3.0"] [lein-codox "0.10.3"]] :sub ["ring-core" "ring-devel" "ring-jetty-adapter" "ring-servlet"] :codox {:output-path "codox" :source-uri "http://github.com/ring-clojure/ring/blob/{version}/{filepath}#L{line}" :source-paths ["ring-core/src" "ring-devel/src" "ring-jetty-adapter/src" "ring-servlet/src"]} :aliases {"test" ["sub" "test"] "test-all" ["sub" "test-all"] "bench" ["sub" "-s" "ring-bench" "run"]})
Prepare for next release cycle.
(defproject org.onyxplatform/onyx-peer-http-query "0.10.0.0-alpha6" :description "An Onyx health and query HTTP server" :url "https://github.com/onyx-platform/onyx-peer-http-query" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"] [ring/ring-core "1.5.1"] [org.clojure/java.jmx "0.3.3"] [ring-jetty-component "0.3.1"] [cheshire "5.7.0"]] :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :profiles {:dev {:dependencies [[clj-http "3.4.1"] [org.onyxplatform/onyx-metrics "0.10.0.0-alpha1"] [org.onyxplatform/onyx "0.10.0-alpha6"]] :plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}})
(defproject org.onyxplatform/onyx-peer-http-query "0.10.0.0-SNAPSHOT" :description "An Onyx health and query HTTP server" :url "https://github.com/onyx-platform/onyx-peer-http-query" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"] [ring/ring-core "1.5.1"] [org.clojure/java.jmx "0.3.3"] [ring-jetty-component "0.3.1"] [cheshire "5.7.0"]] :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :profiles {:dev {:dependencies [[clj-http "3.4.1"] [org.onyxplatform/onyx-metrics "0.10.0.0-alpha1"] [org.onyxplatform/onyx "0.10.0-alpha6"]] :plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}})
Prepare for next release cycle.
(defproject onyx-app/lein-template "0.9.10.0-beta5" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
(defproject onyx-app/lein-template "0.9.10.0-SNAPSHOT" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
Add mvnrepository.com as a repository, so we can fetch the latest HttpComponents.
(defproject ring "0.1.1-SNAPSHOT" :description "A Clojure web applications library." :url "http://github.com/mmcgrana/ring" :dependencies [[org.clojure/clojure "1.1.0"] [org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"] [commons-io "1.4"] [org.mortbay.jetty/jetty "6.1.14"] [org.mortbay.jetty/jetty-util "6.1.14"] [org.mortbay.jetty/servlet-api-2.5 "6.1.14"] [org.apache.httpcomponents/httpcore "4.0.1"] [org.apache.httpcomponents/httpcore-nio "4.0.1"] [clj-html "0.1.0-SNAPSHOT"] [clj-stacktrace "0.1.0-SNAPSHOT"]] :dev-dependencies [[lein-clojars "0.5.0-SNAPSHOT"] [clj-unit "0.1.0-SNAPSHOT"]])
(defproject ring "0.1.1-SNAPSHOT" :description "A Clojure web applications library." :url "http://github.com/mmcgrana/ring" :dependencies [[org.clojure/clojure "1.1.0"] [org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"] [commons-io "1.4"] [org.mortbay.jetty/jetty "6.1.14"] [org.mortbay.jetty/jetty-util "6.1.14"] [org.mortbay.jetty/servlet-api-2.5 "6.1.14"] [org.apache.httpcomponents/httpcore "4.0.1"] [org.apache.httpcomponents/httpcore-nio "4.0.1"] [clj-html "0.1.0-SNAPSHOT"] [clj-stacktrace "0.1.0-SNAPSHOT"]] :repositories [["mvnrepository" "http://mvnrepository.com/"]] :dev-dependencies [[lein-clojars "0.5.0-SNAPSHOT"] [clj-unit "0.1.0-SNAPSHOT"]])
Add Hiccup for final output of SVG.
(defproject mazes "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.9.0-alpha11"], [com.rpl/specter "0.12.0"]] :source-paths ["src/clj", "src/cljc"] :profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"]] :source-paths ["test/clj", "test/cljc"] :plugins [[com.jakemccrary/lein-test-refresh "0.10.0"]] :test-refresh {:notify-command ["lein-test-refresh-notify"] :notify-on-success true :quiet true}}} )
(defproject mazes "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.9.0-alpha11"], [com.rpl/specter "0.12.0"] [hiccup "1.0.5"]] :source-paths ["src/clj", "src/cljc"] :profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"]] :source-paths ["test/clj", "test/cljc"] :plugins [[com.jakemccrary/lein-test-refresh "0.10.0"]] :test-refresh {:notify-command ["lein-test-refresh-notify"] :notify-on-success true :quiet true}}} )
Test commit from core to Kafka.
(defproject org.onyxplatform/onyx-kafka "0.7.3-SNAPSHOT" :description "Onyx plugin for Kafka" :url "https://github.com/MichaelDrogalis/onyx-kafka" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.7.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.7.3-20150821_215046-g67feccf"] [clj-kafka "0.2.8-0.8.1.1" :exclusions [org.apache.zookeeper/zookeeper zookeeper-clj]] [cheshire "5.4.0"] [zookeeper-clj "0.9.1" :exclusions [io.netty/netty org.apache.zookeeper/zookeeper]]] :profiles {:dev {:dependencies [[midje "1.7.0" :exclusions [commons-codec]]] :plugins [[lein-midje "3.1.3"]]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
(defproject org.onyxplatform/onyx-kafka "0.7.3-SNAPSHOT" :description "Onyx plugin for Kafka" :url "https://github.com/MichaelDrogalis/onyx-kafka" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.7.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.7.3-20150822_210824-ga0dc570"] [clj-kafka "0.2.8-0.8.1.1" :exclusions [org.apache.zookeeper/zookeeper zookeeper-clj]] [cheshire "5.4.0"] [zookeeper-clj "0.9.1" :exclusions [io.netty/netty org.apache.zookeeper/zookeeper]]] :profiles {:dev {:dependencies [[midje "1.7.0" :exclusions [commons-codec]]] :plugins [[lein-midje "3.1.3"]]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
Update our version of midje
(defproject foreclojure "1.8.0.1" :description "4clojure - a website for learning Clojure" :dependencies [[clojure "1.2.1"] [clojure-contrib "1.2.0"] [compojure "0.6.2"] [hiccup "0.3.6"] [clojail "0.5.1"] [sandbar "0.4.0-SNAPSHOT"] [org.clojars.christophermaier/congomongo "0.1.4-SNAPSHOT"] [org.jasypt/jasypt "1.7"] [cheshire "2.0.2"] [useful "0.7.0-beta5"] [amalloy/ring-gzip-middleware "[0.1.0,)"] [amalloy/mongo-session "0.0.1"] [clj-github "1.0.1"] [ring "0.3.7"] [clj-config "0.1.0"] [incanter/incanter-core "1.2.3"] [incanter/incanter-charts "1.2.3"] [commons-lang "2.6"] [org.apache.commons/commons-email "1.2"]] :dev-dependencies [[lein-ring "0.4.5"] [midje "1.1.1"]] :checksum-deps true :main foreclojure.core :ring {:handler foreclojure.core/app :init foreclojure.mongo/prepare-mongo})
(defproject foreclojure "1.8.0.1" :description "4clojure - a website for learning Clojure" :dependencies [[clojure "1.2.1"] [clojure-contrib "1.2.0"] [compojure "0.6.2"] [hiccup "0.3.6"] [clojail "0.5.1"] [sandbar "0.4.0-SNAPSHOT"] [org.clojars.christophermaier/congomongo "0.1.4-SNAPSHOT"] [org.jasypt/jasypt "1.7"] [cheshire "2.0.2"] [useful "0.7.0-beta5"] [amalloy/ring-gzip-middleware "[0.1.0,)"] [amalloy/mongo-session "0.0.1"] [clj-github "1.0.1"] [ring "0.3.7"] [clj-config "0.1.0"] [incanter/incanter-core "1.2.3"] [incanter/incanter-charts "1.2.3"] [commons-lang "2.6"] [org.apache.commons/commons-email "1.2"]] :dev-dependencies [[lein-ring "0.4.5"] [midje "1.3.0"]] :checksum-deps true :main foreclojure.core :ring {:handler foreclojure.core/app :init foreclojure.mongo/prepare-mongo})
Update to non-SNAPSHOT version as lein now requires a RELEASE version
(defproject cljskel/lein-template "0.1.0-SNAPSHOT" :description "Skeleton project, a template that can be used to create a new Clojure web app implementing /1.x/ping and /1.x/status" :url "http://wikis.in.nokia.com/Clojure/ClojureSkeleton" :eval-in-leiningen true)
(defproject cljskel/lein-template "0.1.0" :description "Skeleton project, a template that can be used to create a new Clojure web app implementing /1.x/ping and /1.x/status" :url "http://wikis.in.nokia.com/Clojure/ClojureSkeleton" :eval-in-leiningen true)
Replace boxes.clj with nodes, which uses pallet.
(defproject circleci "0.1.0-SNAPSHOT" :description "FIXME: write this!" :dependencies [[org.clojure/clojure "1.2.1"] [noir "1.1.1-SNAPSHOT"] [clj-table "0.1.5"] [clj-url "1.0.2"] [c3p0 "0.9.1.2"] [swank-clojure "1.3.2"] [log4j "1.2.14"] [log4j/apache-log4j-extras "1.1"] [org.clojure/tools.logging "0.2.0"] [org.jclouds/jclouds-all "1.1.1"] [org.jclouds.driver/jclouds-sshj "1.1.1"]] :dev-dependencies [] :main circleci.init)
(defproject circleci "0.1.0-SNAPSHOT" :description "FIXME: write this!" :dependencies [[org.clojure/clojure "1.2.1"] [noir "1.1.1-SNAPSHOT"] [clj-table "0.1.5"] [clj-url "1.0.2"] [c3p0 "0.9.1.2"] [swank-clojure "1.3.2"] [log4j "1.2.14"] [log4j/apache-log4j-extras "1.1"] [commons-codec "1.4"] [org.cloudhoist/pallet "0.6.4"] [org.cloudhoist/pallet-crates-all "0.5.0"] [org.jclouds/jclouds-all "1.0.0"] [org.jclouds.driver/jclouds-log4j "1.0.0"] [org.jclouds.driver/jclouds-jsch "1.0.0"]] :repositories {"sonatype-releases" "http://oss.sonatype.org/content/repositories/releases" "sonatype-snapshots" "http://oss.sonatype.org/content/repositories/snapshots"} :dev-dependencies [] :main circleci.init)
Remove unnecessary maven repo and update play-clj version
(defproject nightmod "0.0.1-SNAPSHOT" :description "FIXME: write description" :dependencies [[clojail "1.0.6"] [com.badlogicgames.gdx/gdx "0.9.9"] [com.badlogicgames.gdx/gdx-backend-lwjgl "0.9.9"] [com.badlogicgames.gdx/gdx-platform "0.9.9" :classifier "natives-desktop"] [com.cemerick/pomegranate "0.3.0"] [nightcode "0.3.1" :exclusions [leiningen lein-ancient lein-cljsbuild lein-droid lein-fruit play-clj/lein-template]] [org.clojure/clojure "1.5.1"] [org.eclipse.jgit "3.2.0.201312181205-r"] [play-clj "0.2.3-SNAPSHOT"] [seesaw "1.4.4"]] :repositories [["sonatype" "https://oss.sonatype.org/content/repositories/snapshots/"]] :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"] :aot [nightmod.core] :main nightmod.core)
(defproject nightmod "0.0.1-SNAPSHOT" :description "FIXME: write description" :dependencies [[clojail "1.0.6"] [com.badlogicgames.gdx/gdx "0.9.9"] [com.badlogicgames.gdx/gdx-backend-lwjgl "0.9.9"] [com.badlogicgames.gdx/gdx-platform "0.9.9" :classifier "natives-desktop"] [com.cemerick/pomegranate "0.3.0"] [nightcode "0.3.1" :exclusions [leiningen lein-ancient lein-cljsbuild lein-droid lein-fruit play-clj/lein-template]] [org.clojure/clojure "1.5.1"] [org.eclipse.jgit "3.2.0.201312181205-r"] [play-clj "0.2.3"] [seesaw "1.4.4"]] :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"] :aot [nightmod.core] :main nightmod.core)
Add clojure 1.6 and clojure 1.5 to the test suite.
{:dev {:aliases {"test-all" ["with-profile" "dev,1.8:dev" "test"]} :codeina {:sources ["src"] :exclude [buddy.core.sign.impl] :reader :clojure :target "doc/dist/latest/api" :src-uri "http://github.com/funcool/buddy-core/blob/master/" :src-uri-prefix "#L"} :plugins [[funcool/codeina "0.3.0"] [lein-ancient "0.6.7"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0-beta2"]]}}
{:dev {:aliases {"test-all" ["with-profile" "dev,1.8:dev,1.6:dev,1.5:dev:dev" "test"]} :codeina {:sources ["src"] :exclude [buddy.core.sign.impl] :reader :clojure :target "doc/dist/latest/api" :src-uri "http://github.com/funcool/buddy-core/blob/master/" :src-uri-prefix "#L"} :plugins [[funcool/codeina "0.3.0"] [lein-ancient "0.6.7"]]} :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]} :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0-beta2"]]}}
Fix doc-print to strip leading whitespace properly
(ns comic-reader.dev (:require [clojure.repl :refer :all] [clojure.tools.namespace.repl :refer [clear refresh]] [clansi.core :refer [style]])) (declare doc-print goto-ns) (defn welcome [] (doc-print "Welcome to the comic reader. If you want to add a new site, run `(add-site)'. If you want to work on the frontend, run `(develop-frontend)'.")) (defn add-site [] (doc-print "Start by running the tests with `(run-site-tests)'. All the tests should pass. Now add a new site definition file and run the tests again. Follow the instructions in the test errors, and hopefully you'll end up with a working site scraper.") (goto-ns 'comic-reader.site-dev)) (defn develop-frontend [] (doc-print "To get started run `(start-dev!)'. This will kick off the application server, and the figwheel devcard build.") (goto-ns 'comic-reader.frontend-dev)) (defn- doc-print [msg] (println " " msg)) (defn- goto-ns [ns] (require ns) (in-ns ns)) (defn attempt-server-shutdown [] (require 'comic-reader.system) (if-let [stop-fn (find-var 'comic-reader.system/stop)] (stop-fn))) (welcome)
(ns comic-reader.dev (:require [clojure.repl :refer :all] [clojure.tools.namespace.repl :refer [clear refresh]] [clansi.core :refer [style]] [clojure.string :as str])) (declare doc-print goto-ns) (defn welcome [] (doc-print "Welcome to the Comic Reader! - If you want to add a new site, run `(add-site)'. - If you want to work on the frontend, run `(develop-frontend)'.")) (defn add-site [] (doc-print "Start by running the tests with `(run-site-tests)'. All the tests should pass. Now add a new site definition file and run the tests again. Follow the instructions in the test errors, and hopefully you'll end up with a working site scraper.") (goto-ns 'comic-reader.site-dev)) (defn develop-frontend [] (doc-print "To get started run `(start-dev!)'. This will kick off the application server, and the figwheel devcard build.") (goto-ns 'comic-reader.frontend-dev)) (defn- doc-print [msg] (printf "\n%s\n\n" (str/replace msg #"\n +" "\n"))) (defn- goto-ns [ns] (require ns) (in-ns ns)) (defn attempt-server-shutdown [] (require 'comic-reader.system) (if-let [stop-fn (find-var 'comic-reader.system/stop)] (stop-fn))) (welcome)
Set release number for 0.1.0 release
(defproject quiescent "0.1.0-SNAPSHOT" :description "A minimal, functional ClojureScript wrapper for ReactJS" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] [com.facebook/react "0.8.0.1"]] :source-paths ["src"] ;; development concerns :profiles {:dev {:source-paths ["src" "examples/src"] :resource-paths ["examples/resources"] :plugins [[lein-cljsbuild "1.0.1"]] :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/clojurescript "0.0-2156"]] :cljsbuild {:builds [{:source-paths ["src" "examples/src"] :compiler {:output-to "examples/resources/public/main.js" :output-dir "examples/resources/public/build" :optimizations :whitespace :preamble ["react/react.min.js"] :externs ["react/externs/react.js"] :pretty-print true :source-map "examples/resources/public/main.js.map" :closure-warnings {:non-standard-jsdoc :off}}}]}}})
(defproject quiescent "0.1.0" :description "A minimal, functional ClojureScript wrapper for ReactJS" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.5.1"] [com.facebook/react "0.8.0.1"]] :source-paths ["src"] ;; development concerns :profiles {:dev {:source-paths ["src" "examples/src"] :resource-paths ["examples/resources"] :plugins [[lein-cljsbuild "1.0.1"]] :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/clojurescript "0.0-2156"]] :cljsbuild {:builds [{:source-paths ["src" "examples/src"] :compiler {:output-to "examples/resources/public/main.js" :output-dir "examples/resources/public/build" :optimizations :whitespace :preamble ["react/react.min.js"] :externs ["react/externs/react.js"] :pretty-print true :source-map "examples/resources/public/main.js.map" :closure-warnings {:non-standard-jsdoc :off}}}]}}})
Fix logging in with push state.
(ns wombats-web-client.utils.url (:require [cemerick.url :as url] [wombats-web-client.constants.local-storage :refer [access-token]])) (defn strip-access-token "removes access token from query" [] (let [url (-> js/window .-location .-href url/url) query (:query url) location (merge url {:query (dissoc query access-token)}) state (or (.-state js/history) #js {})] (.replaceState js/history state "" location)))
(ns wombats-web-client.utils.url (:require [pushy.core :as pushy] [wombats-web-client.routes :refer [history]][wombats-web-client.routes :refer [history]])) (defn strip-access-token "removes access token from query" [] (pushy/replace-token! history "/"))
Prepare for next release cycle.
(defproject org.onyxplatform/onyx-metrics "0.8.0.4" :description "Instrument Onyx workflows" :url "https://github.com/MichaelDrogalis/onyx" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :dependencies [[org.clojure/clojure "1.7.0"] [interval-metrics "1.0.0"] [stylefruits/gniazdo "0.4.0"]] :java-opts ^:replace ["-server" "-Xmx3g"] :global-vars {*warn-on-reflection* true *assert* false *unchecked-math* :warn-on-boxed} :profiles {:dev {:dependencies [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.8.0"] [riemann-clojure-client "0.4.1"]] :plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}})
(defproject org.onyxplatform/onyx-metrics "0.8.0.5-SNAPSHOT" :description "Instrument Onyx workflows" :url "https://github.com/MichaelDrogalis/onyx" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :dependencies [[org.clojure/clojure "1.7.0"] [interval-metrics "1.0.0"] [stylefruits/gniazdo "0.4.0"]] :java-opts ^:replace ["-server" "-Xmx3g"] :global-vars {*warn-on-reflection* true *assert* false *unchecked-math* :warn-on-boxed} :profiles {:dev {:dependencies [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.8.0"] [riemann-clojure-client "0.4.1"]] :plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}})
Set sign flag in correct place
(defproject ci-test "0.1.1" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"]] :repositories [["releases" {:url "https://clojars.org/repo/" :username :env :password :env} :sign-releases false]] :release-tasks [["vcs" "assert-committed"] ["change" "version" "leiningen.release/bump-version" "release"] ["vcs" "commit"] ["vcs" "tag" "--no-sign"] ["deploy"] ["change" "version" "leiningen.release/bump-version"] ["vcs" "commit"] ["vcs" "push"]])
(defproject ci-test "0.1.1" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.8.0"]] :repositories [["releases" {:url "https://clojars.org/repo/" :username :env :password :env :sign-releases false}]] :release-tasks [["vcs" "assert-committed"] ["change" "version" "leiningen.release/bump-version" "release"] ["vcs" "commit"] ["vcs" "tag" "--no-sign"] ["deploy"] ["change" "version" "leiningen.release/bump-version"] ["vcs" "commit"] ["vcs" "push"]])
Add Ring and Servlet dependencies
(defproject om-sente "0.1.0-SNAPSHOT" :description "FIXME: write this!" :url "http://example.com/FIXME" :dependencies [[org.clojure/clojure "1.6.0"] [org.clojure/clojurescript "0.0-2199"] [org.clojure/core.async "0.1.278.0-76b25b-alpha"] [om "0.5.3"] [com.taoensso/sente "0.9.0"] [http-kit "2.1.18"] [compojure "1.1.6"]] :plugins [[lein-cljsbuild "1.0.3"]] :source-paths ["src/clj"] :cljsbuild { :builds [{:id "om-sente" :source-paths ["src/cljs"] :compiler { :output-to "om_sente.js" :output-dir "out" :optimizations :none :source-map true}}]})
(defproject om-sente "0.1.0-SNAPSHOT" :description "FIXME: write this!" :url "http://example.com/FIXME" :dependencies [[org.clojure/clojure "1.6.0"] [org.clojure/clojurescript "0.0-2199"] [org.clojure/core.async "0.1.278.0-76b25b-alpha"] [om "0.5.3"] [com.taoensso/sente "0.9.0"] [http-kit "2.1.18"] [compojure "1.1.6"] [ring/ring-core "1.2.2"] [jetty/javax.servlet "5.1.12"]] :plugins [[lein-cljsbuild "1.0.3"]] :source-paths ["src/clj"] :cljsbuild { :builds [{:id "om-sente" :source-paths ["src/cljs"] :compiler { :output-to "om_sente.js" :output-dir "out" :optimizations :none :source-map true}}]})
Prepare for next release cycle.
(defproject onyx-app/lein-template "0.9.7.0-beta1" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
(defproject onyx-app/lein-template "0.9.7.0-SNAPSHOT" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
Remove type from http status response to avoid nil problems when status code is missing
(ns clj-gatling.httpkit (:require [org.httpkit.client :as http]) (:import [org.httpkit PrefixThreadFactory] [org.httpkit.client HttpClient] [java.util.concurrent ThreadPoolExecutor LinkedBlockingQueue TimeUnit])) (defonce cache-dns-forever (java.security.Security/setProperty "networkaddress.cache.ttl" "-1")) (defonce pool-size (* 2 (.availableProcessors (Runtime/getRuntime)))) (defonce httpkit-pool (repeatedly pool-size #(HttpClient.))) (defn- get-httpkit-client [^long idx] (nth httpkit-pool (mod idx pool-size))) (defonce httpkit-callback-pool (let [pool-size (.availableProcessors (Runtime/getRuntime)) queue (LinkedBlockingQueue.) factory (PrefixThreadFactory. "httpkit-callback-worker-")] (ThreadPoolExecutor. pool-size pool-size 60 TimeUnit/SECONDS queue factory))) (defn async-http-request [url user-id context callback] (let [check-status (fn [{:keys [^long status]}] (callback (= 200 status)))] (http/get url {:worker-pool httpkit-callback-pool :client (get-httpkit-client user-id)} check-status)))
(ns clj-gatling.httpkit (:require [org.httpkit.client :as http]) (:import [org.httpkit PrefixThreadFactory] [org.httpkit.client HttpClient] [java.util.concurrent ThreadPoolExecutor LinkedBlockingQueue TimeUnit])) (defonce cache-dns-forever (java.security.Security/setProperty "networkaddress.cache.ttl" "-1")) (defonce pool-size (* 2 (.availableProcessors (Runtime/getRuntime)))) (defonce httpkit-pool (repeatedly pool-size #(HttpClient.))) (defn- get-httpkit-client [^long idx] (nth httpkit-pool (mod idx pool-size))) (defonce httpkit-callback-pool (let [pool-size (.availableProcessors (Runtime/getRuntime)) queue (LinkedBlockingQueue.) factory (PrefixThreadFactory. "httpkit-callback-worker-")] (ThreadPoolExecutor. pool-size pool-size 60 TimeUnit/SECONDS queue factory))) (defn async-http-request [url user-id context callback] (let [check-status (fn [{:keys [status]}] (callback (= 200 status)))] (http/get url {:worker-pool httpkit-callback-pool :client (get-httpkit-client user-id)} check-status)))
Remove unused namespace include to make Eastwood happy.
(ns posthere.util.uuid "UUIDs and the heat death of the Universe..." (:require [clojure.string :as s])) (defn uuid "Simple wrapper for Java's UUID" [] (str (java.util.UUID/randomUUID)))
(ns posthere.util.uuid "UUIDs and the heat death of the Universe...") (defn uuid "Simple wrapper for Java's UUID" [] (str (java.util.UUID/randomUUID)))
Document how lifecycle gets replaced in test
(ns {{app-name}}.lifecycles.sample-lifecycle (:require [clojure.core.async :refer [chan sliding-buffer >!!]] [onyx.plugin.core-async :refer [take-segments!]] [onyx.static.planning :refer [find-task]] [{{app-name}}.utils :as u])) ;;;; Lifecycle hook to debug segments by logging them to the console. (defn log-batch [event lifecycle] (doseq [m (map :message (mapcat :leaves (:tree (:onyx.core/results event))))] (prn "Logging segment: " m)) {}) (def log-calls {:lifecycle/after-batch log-batch}) (defn build-lifecycles [] [{:lifecycle/task :read-lines :lifecycle/calls :{{app-name}}.plugins.http-reader/reader-calls :lifecycle/replaceable? true :lifecycle/doc "Lifecycle for reading from a core.async chan"} {:lifecycle/task :write-lines :core.async/id (java.util.UUID/randomUUID) :lifecycle/replaceable? true :lifecycle/calls :onyx.plugin.core-async/writer-calls :lifecycle/doc "Lifecycle for injecting a core.async writer chan"} {:lifecycle/task :write-lines :lifecycle/calls ::log-calls :lifecycle/doc "Lifecycle for printing the output of a task's batch"}])
(ns {{app-name}}.lifecycles.sample-lifecycle (:require [clojure.core.async :refer [chan sliding-buffer >!!]] [onyx.plugin.core-async :refer [take-segments!]] [onyx.static.planning :refer [find-task]] [{{app-name}}.utils :as u])) ;;;; Lifecycle hook to debug segments by logging them to the console. (defn log-batch [event lifecycle] (doseq [m (map :message (mapcat :leaves (:tree (:onyx.core/results event))))] (prn "Logging segment: " m)) {}) (def log-calls {:lifecycle/after-batch log-batch}) (defn build-lifecycles [] [{:lifecycle/task :read-lines :lifecycle/calls :{{app-name}}.plugins.http-reader/reader-calls :lifecycle/replaceable? true :lifecycle/doc "Lifecycle for reading from a core.async chan"} {:lifecycle/task :write-lines :lifecycle/calls :{{app-name}}.utils/out-calls :core.async/id (java.util.UUID/randomUUID) :lifecycle/replaceable? true :lifecycle/doc "Lifecycle for your output task. When using in-memory-lifecycles, this will be replaced"} {:lifecycle/task :write-lines :lifecycle/calls :onyx.plugin.core-async/writer-calls :lifecycle/doc "Lifecycle for injecting a core.async writer chan"} {:lifecycle/task :write-lines :lifecycle/calls ::log-calls :lifecycle/doc "Lifecycle for printing the output of a task's batch"}])
Add ui to select scheme
(ns cruncher.rename (:require [om.next :as om :refer-macros [defui]] [om.dom :as dom :include-macros true] [goog.dom :as gdom] [cruncher.utils.views :as vlib] [cruncher.utils.lib :as lib])) (defui RenamingControls Object (render [this] (dom/div nil (dom/p #js {:className "lead"} "Rename Pokemon") "hm?"))) (def controls (om/factory RenamingControls))
(ns cruncher.rename (:require [om.next :as om :refer-macros [defui]] [om.dom :as dom :include-macros true] [goog.dom :as gdom] [cruncher.utils.views :as vlib] [cruncher.utils.lib :as lib])) (defui SelectSchemes Object (render [this] (let [selected (or (om/get-state this :selected) "rename-scheme-1")] (dom/div nil (dom/div #js {:className "form-group"} (dom/select #js {:className "form-control" :onChange #(println "click") :value selected} (dom/option #js {:value "rename-scheme-1"} "IV% AT/DF/ST") (dom/option #js {:value "rename-scheme-2"} "AT/DF/ST") (dom/option #js {:value "rename-scheme-3"} "IV%"))) (dom/div #js {:className "form-group"}))))) (def select-schemes (om/factory SelectSchemes {})) (defui RenamingControls Object (render [this] (dom/div nil (dom/p #js {:className "lead"} "Renaming") (dom/label #js {:className "control-label"} "Renames selected Pokemon. Not reversible.") (dom/div #js {:className "row"} (dom/div #js {:className "col-md-3"} (select-schemes (om/props this))))))) (def controls (om/factory RenamingControls))
Return the result after waiting
(ns circle.util.retry (:use [arohner.utils :only (inspect)]) (:use [circle.util.except :only (throw-if-not)]) (:use [robert.bruce :only (try-try-again)])) (defn parse-args [args] (if (map? (first args)) {:options (first args) :f (second args) :args (drop 2 args)} {:f (first args) :args (rest args)})) (defn wait-for "Like robert bruce, but waits for arbitrary results rather than just exceptions. Takes all arguments exactly the same as robert bruce. Extra arguments to wait-for may be passed in the robert bruce options: - success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy" {:arglists '([fn] [fn & args] [options fn] [options fn & args])} [& args] (let [{:keys [options f args] :as parsed-args} (parse-args args) success (-> options :success-fn)] (throw-if-not (-> parsed-args :f fn?) "couldn't find fn") (let [f (fn [] (let [result (apply f args)] (if success (throw-if-not (success result) "(success) did not return truthy in time") (throw-if-not result "f did not return truthy in time"))))] (try-try-again options f))))
(ns circle.util.retry (:use [circle.util.except :only (throw-if-not)]) (:use [robert.bruce :only (try-try-again)])) (defn parse-args [args] (if (map? (first args)) {:options (first args) :f (second args) :args (drop 2 args)} {:f (first args) :args (rest args)})) (defn wait-for "Like robert bruce, but waits for arbitrary results rather than just exceptions. Takes all arguments exactly the same as robert bruce. Extra arguments to wait-for may be passed in the robert bruce options: - success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy" {:arglists '([fn] [fn & args] [options fn] [options fn & args])} [& args] (let [{:keys [options f args] :as parsed-args} (parse-args args) success (-> options :success-fn)] (throw-if-not (-> parsed-args :f fn?) "couldn't find fn") (let [f (fn [] (let [result (apply f args)] (if success (throw-if-not (success result) "(success) did not return truthy in time") (throw-if-not result "f did not return truthy in time")) result))] (try-try-again options f))))
Move to streaming 'fork/join' for breseq runs
{ :name "wgseq-phase2", :path "", :graph {:dir {:type "func" :name "get-comparison-files" :args ["#1", "#2" "#3"]} ; eid, comparison-file, :NA here :take {:type "func" :name "strm-take" :args [10]} :bseq {:type "func" :name "breseq-runs"} :aggr {:type "func" :name "aggregate"} :mail {:type "func" :name "mailp2" :args ["#4" ; recipient "Aerobio job status: wgseq phase-2" "Finished"]} ; subject, body intro :edges {:dir [:take] :take [:bseq] :bseq [:aggr] :aggr [:mail]}} ;; instructional data used in /help :description "" }
{ :name "wgseq-phase2", :path "", :graph {:dir {:type "func" :name "get-comparison-files" :args ["#1", "#2" "#3"]} ; eid, comparison-file, :NA here :bseq {:type "func" :name "sfj-breseq-runs"} :mail {:type "func" :name "mailp2" :args ["#4" ; recipient "Aerobio job status: wgseq phase-2" "Finished"]} ; subject, body intro :edges {:dir [:bseq] :bseq [:mail]}} ;; instructional data used in /help :description "Run a full set of breseq runs for experiment '#1' EID, with comparison file '#2' and sending completion msg to recipient '#4'. Uses streaming 'fork/join' breseq runner, which is also able to restart run after last completed run in case of server interruptions." }
Switch hacker-paradise board to less guessable id
(ns faceboard.whitelabel (:require-macros [faceboard.macros.model :refer [transform-app-state]] [faceboard.macros.logging :refer [log log-err log-warn log-info]]) (:require [faceboard.env :as env] [faceboard.model :as model] [faceboard.helpers.utils :as utils])) (def domain-mappings [[#"fb\.local.*" "test-localhost-whitelabel"] ; just a test local host [#".*hackerparadise\.org" "hp"]]) ; http://faceboard.hackerparadise.org (defn domain->boad-id [domain] (if-let [match (utils/find-first #(re-matches (first %) domain) domain-mappings)] (second match))) (defn whitelabel-board [] (domain->boad-id env/domain)) (defn init-hp! [] (transform-app-state (model/set [:ui :filters :active :groups] #{"present"}))) (defn init-test-localhost! [] (log "test localhost whitelabel init")) (defn init! [] (condp = (domain->boad-id env/domain) "test-localhost-whitelabel" (init-test-localhost!) "hp" (init-hp!) nil))
(ns faceboard.whitelabel (:require-macros [faceboard.macros.model :refer [transform-app-state]] [faceboard.macros.logging :refer [log log-err log-warn log-info]]) (:require [faceboard.env :as env] [faceboard.model :as model] [faceboard.helpers.utils :as utils])) (def domain-mappings [[#"fb\.local.*" "test-localhost-whitelabel"] ; just a test local host [#".*hackerparadise\.org" "3a8450f9a0cb45d99c1a"]]) ; http://faceboard.hackerparadise.org (defn domain->boad-id [domain] (if-let [match (utils/find-first #(re-matches (first %) domain) domain-mappings)] (second match))) (defn whitelabel-board [] (domain->boad-id env/domain)) (defn init-hp! [] (transform-app-state (model/set [:ui :filters :active :groups] #{"present"}))) (defn init-test-localhost! [] (log "test localhost whitelabel init")) (defn init! [] (condp = (domain->boad-id env/domain) "test-localhost-whitelabel" (init-test-localhost!) "hp" (init-hp!) nil))
Add name for player and character
(ns yadnd5ecs.core (:require [om.core :as om :include-macros true] [om-tools.dom :as dom :include-macros true] [om-tools.core :refer-macros [defcomponent]])) (enable-console-print!) (def app-state (atom {:text "Hello Chestnut!"})) (defcomponent app-view [app owner] (render [_] (dom/h1 (:text app)))) (defn main [] (om/root app-view app-state {:target (. js/document (getElementById "app"))}))
(ns yadnd5ecs.core (:require [om.core :as om :include-macros true] [om-tools.dom :as dom :include-macros true] [om-tools.core :refer-macros [defcomponent]])) (enable-console-print!) (def app-state (atom {:name {:player "Bob" :character "Bruenor"}})) (defcomponent name-view [name owner] (render [_] (let [{:keys [player character]} name] (dom/span (dom/h1 (str "Name: " player)) (dom/h1 (str "Character: " character)))))) (defcomponent app-view [app owner] (render [_] (dom/div (dom/h1 (str "Hello " (-> app :name :character) (when-let [name (-> app :name :player)] (str " (" name ")")) "!")) (om/build name-view (:name app))))) (defn main [] (om/root app-view app-state {:target (. js/document (getElementById "app"))}))
Remove vestigial reqs from hours-open validation
(ns vip.data-processor.validation.v5.hours-open (:require [korma.core :as korma] [vip.data-processor.db.postgres :as postgres] [vip.data-processor.validation.v5.util :as util])) (defn valid-time-with-zone? [time] (re-matches #"(?:(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]|(?:24:00:00))(?:Z|[+-](?:(?:0[0-9]|1[0-3]):[0-5][0-9]|14:00))" time)) (defn validate-times [{:keys [import-id] :as ctx}] (let [hours-open-path "VipObject.0.HoursOpen.*{1}.Schedule.*{1}.Hours.*{1}" start-times (util/select-path import-id (str hours-open-path ".StartTime.*{1}")) end-times (util/select-path import-id (str hours-open-path ".EndTime.*{1}")) invalid-times #(remove (comp valid-time-with-zone? :value) %) invalid-start-times (invalid-times start-times) invalid-end-times (invalid-times end-times)] (reduce (fn [ctx row] (update-in ctx [:errors :hours-open (-> row :path .getValue) :format] conj (:value row))) ctx (concat invalid-start-times invalid-end-times))))
(ns vip.data-processor.validation.v5.hours-open (:require [vip.data-processor.validation.v5.util :as util])) (defn valid-time-with-zone? [time] (re-matches #"(?:(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]|(?:24:00:00))(?:Z|[+-](?:(?:0[0-9]|1[0-3]):[0-5][0-9]|14:00))" time)) (defn validate-times [{:keys [import-id] :as ctx}] (let [hours-open-path "VipObject.0.HoursOpen.*{1}.Schedule.*{1}.Hours.*{1}" start-times (util/select-path import-id (str hours-open-path ".StartTime.*{1}")) end-times (util/select-path import-id (str hours-open-path ".EndTime.*{1}")) invalid-times #(remove (comp valid-time-with-zone? :value) %) invalid-start-times (invalid-times start-times) invalid-end-times (invalid-times end-times)] (reduce (fn [ctx row] (update-in ctx [:errors :hours-open (-> row :path .getValue) :format] conj (:value row))) ctx (concat invalid-start-times invalid-end-times))))
Increment version number to 2.1.1
(defproject metrics-clojure-ring "2.1.0-SNAPSHOT" :description "Various things gluing together metrics-clojure and ring." :dependencies [[cheshire "5.3.1"] [metrics-clojure "2.0.0"]] :profiles {:dev {:dependencies [[ring "1.2.2"]]}})
(defproject metrics-clojure-ring "2.1.1-SNAPSHOT" :description "Various things gluing together metrics-clojure and ring." :dependencies [[cheshire "5.3.1"] [metrics-clojure "2.0.0"]] :profiles {:dev {:dependencies [[ring "1.2.2"]]}})
Remove unused functions from inline types
(ns graphql-clj.validator.transformations.inline-types "Inline field and parent field types for execution phase" (:require [graphql-clj.visitor :as v] [graphql-clj.spec :as spec] [clojure.spec :as s] [graphql-clj.box :as box])) (defn- of-kind [{:keys [kind required inner-type]} s] (if (:type-name inner-type) (let [base (spec/get-type-node (spec/named-spec s [(:type-name inner-type)]) s)] (select-keys base [:kind :required])) {:kind kind :required required :of-kind (of-kind inner-type s)})) (defn- parent-type [{:keys [spec]}] (if-let [base-spec (s/get-spec spec)] (if (keyword? base-spec) base-spec spec) spec)) (def whitelisted-keys #{:v/parentk :node-type :selection-set :type-name :field-name :name :args-fn :kind :of-kind :required :parent-type-name}) (declare inline-types) (v/defnodevisitor inline-types :post :field [{:keys [field-name parent-type-name spec v/path v/parent] :as n} {:keys [resolver] :as s}] {:node (cond-> (select-keys n whitelisted-keys) parent-type-name (assoc :parent-type-name (box/box->val parent-type-name)) resolver (assoc :resolver-fn (resolver parent-type-name field-name)))}) (def rules [inline-types])
(ns graphql-clj.validator.transformations.inline-types "Inline field and parent field types for execution phase" (:require [graphql-clj.visitor :as v] [graphql-clj.box :as box])) (def whitelisted-keys #{:v/parentk :node-type :selection-set :type-name :field-name :name :args-fn :kind :of-kind :required :parent-type-name}) (declare inline-types) (v/defnodevisitor inline-types :post :field [{:keys [field-name parent-type-name spec v/path v/parent] :as n} {:keys [resolver] :as s}] {:node (cond-> (select-keys n whitelisted-keys) parent-type-name (assoc :parent-type-name (box/box->val parent-type-name)) resolver (assoc :resolver-fn (resolver parent-type-name field-name)))}) (def rules [inline-types])
Add auth to the persistente vector.
(ns uxbox.core (:require-macros [uxbox.util.syntax :refer [define-once]]) (:require [beicon.core :as rx] [cats.labs.lens :as l] [uxbox.state :as st] [uxbox.router :as rt] [uxbox.rstore :as rs] [uxbox.ui :as ui] [uxbox.data.load :as dl])) (enable-console-print!) (defn- main [] (let [lens (l/select-keys [:pages-by-id :shapes-by-id :colors-by-id :projects-by-id]) stream (->> (l/focus-atom lens st/state) (rx/from-atom) (rx/dedupe) (rx/debounce 1000) (rx/tap #(println "[save]")))] (rx/on-value stream #(dl/persist-state %)))) (define-once :setup (println "bootstrap") (st/init) (rt/init) (ui/init) (rs/emit! (dl/load-data)) ;; During development, you can comment the ;; following call for disable temprary the ;; local persistence. (main))
(ns uxbox.core (:require-macros [uxbox.util.syntax :refer [define-once]]) (:require [beicon.core :as rx] [cats.labs.lens :as l] [uxbox.state :as st] [uxbox.router :as rt] [uxbox.rstore :as rs] [uxbox.ui :as ui] [uxbox.data.load :as dl])) (enable-console-print!) (def ^:const ^:private +persistent-keys+ [:auth :pages-by-id :shapes-by-id :colors-by-id :projects-by-id]) (defn- main [] (let [lens (l/select-keys +persistent-keys+) stream (->> (l/focus-atom lens st/state) (rx/from-atom) (rx/dedupe) (rx/debounce 1000) (rx/tap #(println "[save]")))] (rx/on-value stream #(dl/persist-state %)))) (define-once :setup (println "bootstrap") (st/init) (rt/init) (ui/init) (rs/emit! (dl/load-data)) ;; During development, you can comment the ;; following call for disable temprary the ;; local persistence. (main))
Make directory structure in write-Parse.
(ns incise.parsers.html (:require [incise.parsers.helpers :as help] [incise.parsers.core :refer [map->Parse]] [clojure.edn :as edn] [clojure.string :as s] [clojure.java.io :refer [reader]]) (:import [java.io File])) (defn File->Parse [to-html ^File file] (let [file-str (slurp file) parse-meta (edn/read-string file-str) content (to-html (second (s/split file-str #"\}" 2)))] (map->Parse (assoc parse-meta :extension "/index.html" :content content)))) (defn write-Parse [^incise.parsers.core.Parse parse-data] (spit (str "resources/public/" (help/Parse->path parse-data)))) (defn html-parser "Take a function that parses a string into HTML and returns an HTML parser. An HTML parser is a function which takes a file, reads it and writes it out as html to the proper place under public. If it is a page it should appear at the root, if it is a post it will be placed under a directory strucutre based on its date." [to-html] (comp write-Parse (partial File->Parse to-html)))
(ns incise.parsers.html (:require (incise.parsers [helpers :as help] [core :refer [map->Parse]]) [incise.layouts.core :refer [Parse->string]] [clojure.edn :as edn] [clojure.string :as s] [clojure.java.io :refer [reader]]) (:import [java.io File])) (defn File->Parse [to-html ^File file] (let [file-str (slurp file) parse-meta (edn/read-string file-str) content (to-html (second (s/split file-str #"\}" 2)))] (map->Parse (assoc parse-meta :extension "/index.html" :content content)))) (defn write-Parse [^incise.parsers.core.Parse parse-data] (let [file-path (File. (str "resources/public/" (help/Parse->path parse-data)))] (-> file-path (.getParentFile) (.mkdirs)) (spit file-path (Parse->string parse-data)))) (defn html-parser "Take a function that parses a string into HTML and returns an HTML parser. An HTML parser is a function which takes a file, reads it and writes it out as html to the proper place under public. If it is a page it should appear at the root, if it is a post it will be placed under a directory strucutre based on its date." [to-html] (comp write-Parse (partial File->Parse to-html)))
Prepare for next release cycle.
(defproject onyx-app/lein-template "0.13.4.0" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
(defproject onyx-app/lein-template "0.13.4.1-SNAPSHOT" :description "Onyx Leiningen application template" :url "https://github.com/onyx-platform/onyx-template" :license {:name "MIT License" :url "http://choosealicense.com/licenses/mit/#"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :plugins [[lein-set-version "0.4.1"]] :profiles {:dev {:plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]]}} :eval-in-leiningen true)
Prepare for next release cycle.
(defproject org.onyxplatform/onyx-datomic "0.10.0.0-alpha5" :description "Onyx plugin for Datomic" :url "https://github.com/onyx-platform/onyx-datomic" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :dependencies [[org.clojure/clojure "1.8.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.10.0-alpha5"]] :test-selectors {:default (complement :ci) :ci :ci :all (constantly true)} :profiles {:dev {:dependencies [[com.datomic/datomic-free "0.9.5544"] [aero "0.2.0"]] :plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]] :resource-paths ["test-resources/"]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
(defproject org.onyxplatform/onyx-datomic "0.10.0.0-SNAPSHOT" :description "Onyx plugin for Datomic" :url "https://github.com/onyx-platform/onyx-datomic" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :repositories {"snapshots" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false} "releases" {:url "https://clojars.org/repo" :username :env :password :env :sign-releases false}} :dependencies [[org.clojure/clojure "1.8.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.10.0-alpha5"]] :test-selectors {:default (complement :ci) :ci :ci :all (constantly true)} :profiles {:dev {:dependencies [[com.datomic/datomic-free "0.9.5544"] [aero "0.2.0"]] :plugins [[lein-set-version "0.4.1"] [lein-update-dependency "0.1.2"] [lein-pprint "1.1.1"]] :resource-paths ["test-resources/"]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
Test commit from CircleCI box.
(defproject org.onyxplatform/onyx-kafka "0.7.3-SNAPSHOT" :description "Onyx plugin for Kafka" :url "https://github.com/MichaelDrogalis/onyx-kafka" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.7.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.7.3-20150821_215046-g67feccf"] [clj-kafka "0.2.8-0.8.1.1" :exclusions [org.apache.zookeeper/zookeeper zookeeper-clj]] [cheshire "5.4.0"] [zookeeper-clj "0.9.1" :exclusions [io.netty/netty org.apache.zookeeper/zookeeper]]] :profiles {:dev {:dependencies [[midje "1.7.0" :exclusions [commons-codec]]] :plugins [[lein-midje "3.1.3"]]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
(defproject org.onyxplatform/onyx-kafka "0.7.3-SNAPSHOT" :description "Onyx plugin for Kafka" :url "https://github.com/MichaelDrogalis/onyx-kafka" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.7.0"] ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}} [org.onyxplatform/onyx "0.7.3-20150821_215046-g67feccf"] [clj-kafka "0.2.8-0.8.1.1" :exclusions [org.apache.zookeeper/zookeeper zookeeper-clj]] [cheshire "5.4.0"] [zookeeper-clj "0.9.1" :exclusions [io.netty/netty org.apache.zookeeper/zookeeper]]] :profiles {:dev {:dependencies [[midje "1.7.0" :exclusions [commons-codec]]] :plugins [[lein-midje "3.1.3"]]} :circle-ci {:jvm-opts ["-Xmx4g"]}})
Make the target optional for throttle
(ns comic-reader.scrolling (:require [re-frame.core :as rf])) (defn throttle [type key target] (let [target (or target js/window) running (atom false) toggle! #(swap! running not) throttler (fn [] (when (not @running) (toggle!) (js/requestAnimationFrame (fn [] (rf/dispatch [key]) (toggle!)))))] (.addEventListener target type throttler))) (defn setup-scrolling-events! [] (throttle "scroll" :scroll))
(ns comic-reader.scrolling (:require [re-frame.core :as rf])) (defn throttle [type key & [target]] (let [target (or target js/window) running (atom false) toggle! #(swap! running not) throttler (fn [] (when (not @running) (toggle!) (js/requestAnimationFrame (fn [] (rf/dispatch [key]) (toggle!)))))] (.addEventListener target type throttler))) (defn setup-scrolling-events! [] (throttle "scroll" :scroll))
Remove ultra as it gives some nrepl error
{:user {:plugins [;;Try new api quickly using the repl ;;[lein-try "0.4.3"] ;;=> https://github.com/kumarshantanu/lein-localrepo ;;[lein-localrepo "0.5.4"] ;;Convert pom.xml to project.clj ;;[lein-nevam "0.1.2"] ;;A Leiningen plugin for a superior development environment ;;[Introduction Blog Post](https://blog.venanti.us/ultra/) ;;=> https://github.com/venantius/ultra ;;[venantius/ultra "0.5.2"] ;;=> Pretty-print a representation of the project map [lein-pprint "1.2.0"] ;;=> https://github.com/pallet/alembic [com.palletops/lein-shorthand "0.4.0"]] :shorthand {. [alembic.still/distill alembic.still/lein]} :dependencies [[alembic "0.3.2"] [pjstadig/humane-test-output "0.8.3"]] :injections [(require 'pjstadig.humane-test-output) (pjstadig.humane-test-output/activate!)]}}
{:user {:plugins [[lein-localrepo "0.5.4"] ;; https://github.com/kumarshantanu/lein-localrepo [lein-nevam "0.1.2"] ;; Convert pom.xml to project.clj [lein-pprint "1.2.0"]] ;; Pretty-print a representation of the project map :dependencies [[alembic "0.3.2"] [pjstadig/humane-test-output "0.8.3"]] :injections [(require 'pjstadig.humane-test-output) (pjstadig.humane-test-output/activate!)]}}
Add core.async to Clojurescript example
(ns app (:require [ajax.core :refer [GET]] [domina :refer [by-id set-text!]] [domina.css :refer [sel]] [domina.events :refer [listen!]] [lively.core :as lively])) (lively/start "/js/app.js" {:on-reload #(.log js/console "Reloaded!")}) (defn set-result! [result] (set-text! (by-id "result") result)) (defn ping [] (GET "http://localhost:8080/ping" {:handler #(set-result! %)})) (listen! (sel "button") :click #(ping))
(ns app (:require-macros [cljs.core.async.macros :refer [go]]) (:require [ajax.core :refer [GET]] [domina :refer [by-id set-text!]] [domina.css :refer [sel]] [domina.events :refer [listen!]] [cljs.core.async :as async :refer [<! >!]] [lively.core :as lively])) ;(lively/start "/js/app.js" {:on-reload #(.log js/console "Reloaded!")}) (def c (async/chan)) (defn set-result! [result] (set-text! (by-id "result") result)) (defn ping [] (GET "http://localhost:8080/ping" {:handler #(go (>! c %))})) (listen! (sel "button") :click #(ping)) (go (while true (let [result (<! c)] (set-result! result))))
Add pbr as alias to pushback-reader. Best name ever.
(ns useful.io (:use [clojure.java.io :only [reader]]) (:import (java.io Reader PushbackReader))) (defprotocol PushbackFactory (^{:added "1.4"} pushback-reader [x] "Creates a PushbackReader from an object.")) (extend-protocol PushbackFactory PushbackReader (pushback-reader [this] this) Reader (pushback-reader [this] (PushbackReader. this)) Object (pushback-reader [this] (pushback-reader (reader this)))) (let [sentinel (Object.) valid? #(not (identical? % sentinel))] (defn read-seq "Read a lazy sequence of Clojure forms from an input reader." [in] (let [in (pushback-reader in)] (take-while valid? (repeatedly #(read in false sentinel))))))
(ns useful.io (:use [clojure.java.io :only [reader]] [useful.ns :only [defalias]]) (:import (java.io Reader PushbackReader))) (defprotocol PushbackFactory (^{:added "1.4"} pushback-reader [x] "Creates a PushbackReader from an object.")) (extend-protocol PushbackFactory PushbackReader (pushback-reader [this] this) Reader (pushback-reader [this] (PushbackReader. this)) Object (pushback-reader [this] (pushback-reader (reader this)))) (defalias pbr pushback-reader) (let [sentinel (Object.) valid? #(not (identical? % sentinel))] (defn read-seq "Read a lazy sequence of Clojure forms from an input reader." [in] (let [in (pushback-reader in)] (take-while valid? (repeatedly #(read in false sentinel))))))
Change serve image route fn to handle request
(ns silly-image-store.handler (:require [silly-image-store.store :as store] [environ.core :refer [env]] [compojure.core :refer :all] [ring.middleware.json :refer :all] [compojure.handler :as handler] [compojure.route :as route])) (def images-dir (env :base-store-dir)) (defn image-not-found [image] (route/not-found (str "No image '" image "' found"))) ; TODO refactor links stuff (defn list-images [{scheme :scheme, {host "host"} :headers}] (let [image-names (store/list-images images-dir) base-url (str (name scheme) "://" host "/images/") to-json (fn [n] {:name n :link (str base-url n)})] (map to-json image-names))) (defn serve-image [image] (let [image-file (store/load-image images-dir image)] (or image-file (image-not-found image)))) (defroutes app-routes (GET "/images" request list-images) (GET "/images/:image" [image] (serve-image image)) ; TODO handler as list-image (route/resources "/") (route/not-found "Not Found")) (def app (-> (handler/site app-routes) (wrap-json-response)))
(ns silly-image-store.handler (:require [silly-image-store.store :as store] [environ.core :refer [env]] [compojure.core :refer :all] [ring.middleware.json :refer :all] [compojure.handler :as handler] [compojure.route :as route])) (def images-dir (env :base-store-dir)) (defn image-not-found [image] (route/not-found (str "No image '" image "' found"))) ; TODO refactor links stuff (defn- list-images-route [{scheme :scheme, {host "host"} :headers}] (let [image-names (store/list-images images-dir) base-url (str (name scheme) "://" host "/images/") to-json (fn [n] {:name n :link (str base-url n)})] (map to-json image-names))) (defn- serve-image-route [{{image :image} :params}] (let [image-file (store/load-image images-dir image)] (or image-file (image-not-found image)))) (defroutes app-routes (GET "/images" request list-images-route) (GET "/images/:image" request serve-image-route) (route/resources "/") (route/not-found "Not Found")) (def app (-> (handler/site app-routes) (wrap-json-response)))
Fix abort issue due to dependency conflict
;; Copyright © 2014-2017, JUXT LTD. (def VERSION "1.3.0-alpha4") (defproject yada VERSION :description "A complete batteries-included bundle of yada" :license {:name "The MIT License" :url "https://opensource.org/licenses/MIT"} :pedantic? :abort :dependencies [[yada/aleph ~VERSION] [yada/async ~VERSION] [yada/bidi ~VERSION] [yada/core ~VERSION] [yada/json ~VERSION] [yada/json-html ~VERSION] [yada/jwt ~VERSION] [yada/multipart ~VERSION] [yada/oauth2 ~VERSION] [yada/swagger ~VERSION] [yada/transit ~VERSION] [yada/webjars ~VERSION]] :profiles {:test {:dependencies [[org.clojure/clojure "1.8.0"] [org.webjars/bootstrap "3.3.6"]]}})
;; Copyright © 2014-2017, JUXT LTD. (def VERSION "1.3.0-alpha4") (defproject yada VERSION :description "A complete batteries-included bundle of yada" :license {:name "The MIT License" :url "https://opensource.org/licenses/MIT"} :pedantic? :abort :dependencies [[yada/aleph ~VERSION] [yada/async ~VERSION] [yada/bidi ~VERSION] [yada/core ~VERSION] [yada/json ~VERSION] [yada/json-html ~VERSION] [yada/jwt ~VERSION] [yada/multipart ~VERSION] [yada/oauth2 ~VERSION] [yada/swagger ~VERSION :exclusions [clj-time]] [yada/transit ~VERSION] [yada/webjars ~VERSION]] :profiles {:test {:dependencies [[org.clojure/clojure "1.8.0"] [org.webjars/bootstrap "3.3.6"]]}})
Update to new log rotor
(ns com.frereth.server.logging (require [com.postspectacular.rotor :as rotor] [com.stuartsierra.component :as component] [taoensso.timbre :as log :refer (trace debug info warn error fatal spy with-log-level)])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Schema (defrecord Logger [] component/Lifecycle (start [this] (log/set-config! [:appenders :rotor] {:doc "Writes to (:path (:rotor :shared-appender-config)) file and creates optional backups" :min-level :trace :enabled? true :async? false :max-message-per-msecs nil :fn rotor/append}) (log/set-config! [:shared-appender-config :rotor] {:path "logs/app.log" :max-size (* 512 1024) :backlog 5}) (log/warn "FIXME: Log to a database instead") this) (stop [this] this)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Public (defn ctor [_] (->Logger))
(ns com.frereth.server.logging (require [com.stuartsierra.component :as component] [taoensso.timbre :as log :refer (trace debug info warn error fatal spy with-log-level)] [taoensso.timbre.appenders.3rd-party.rotor :as rotor])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Schema (defrecord Logger [] component/Lifecycle (start [this] (log/merge-config! {:appenders {:rotor (rotor/rotor-appender {:path "logs/app.log" :max-size (* 512 1024) :backlog 5})}}) (log/warn "FIXME: Log to a database instead") this) (stop [this] this)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Public (defn ctor [_] (->Logger))