Skip to content

Commit

Permalink
Merge pull request #2 from flyboarder/master
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
burn2delete committed Dec 4, 2016
2 parents af52f4d + 26996a7 commit e9ede0d
Show file tree
Hide file tree
Showing 18 changed files with 311 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boot.properties
@@ -0,0 +1,2 @@
BOOT_VERSION=2.6.0
BOOT_EMIT_TARGET=no
55 changes: 55 additions & 0 deletions build.boot
@@ -0,0 +1,55 @@
(defn read-file [file] (read-string (slurp file)))
(defn get-deps [] (read-file "./dependencies.edn"))
;(defn get-devdeps [] (read-file "./dev_dependencies.edn"))

(set-env!
:dependencies (get-deps)
:resource-paths #{"src"})

(require
'[adzerk.bootlaces :refer :all]
'[degree9.boot-semver :refer :all]
'[degree9.boot-semgit :refer :all]
'[degree9.boot-semgit.workflow :refer :all]
'[tolitius.boot-check :as check])

(task-options!
pom {:project 'degree9/featherscript
:version (get-version)
:description "Feathersjs wrapper for ClojureScript."
:url "http://github.com/degree9/featherscript"
:scm {:url "http://github.com/degree9/featherscript"}})

(deftask ci-deps
"Force CI to fetch dependencies."
[]
identity)

(deftask tests
"Run code tests."
[]
(comp
(check/with-kibit)
;(check/with-yagni)
(check/with-eastwood)
(check/with-bikeshed)
))

(deftask deploy
"Build project for deployment to clojars."
[]
(comp
(version :minor 'inc :patch 'zero)
(build-jar)
(push-release)))

(deftask develop
"Build project for local development."
[]
(comp
(watch)
(version :no-update true
:minor 'inc
:patch 'zero
:pre-release 'snapshot)
(build-jar)))
12 changes: 12 additions & 0 deletions dependencies.edn
@@ -0,0 +1,12 @@
[[org.clojure/clojure "1.7.0" :scope "provided"]
[org.clojure/clojurescript "1.7.228" :scope "provided"]
[adzerk/boot-cljs "1.7.228-2" :scope "test"]
[adzerk/bootlaces "0.1.13"]
[adzerk/env "0.3.0"]
[cljsjs/feathers "1.8.0-0"]
[cljsjs/jquery "1.9.1-0"]
[cljsjs/socket-io "1.6.0-0" :scope "provided"]
[degree9/boot-semver "1.3.6" :scope "test"]
[degree9/boot-semgit "0.2.1" :scope "test"]
[degree9/boot-npm "0.2.0"]
[tolitius/boot-check "0.1.3" :scope "test"]]
43 changes: 43 additions & 0 deletions src/feathers/app.cljs
@@ -0,0 +1,43 @@
(ns feathers.app
(:refer-clojure :exclude [rest])
(:require [feathers.core :as fs]
[feathers.cors :as cors]
[feathers.configuration :as config]
[feathers.compression :as compression]
[feathers.favicon :as favicon]
[feathers.body-parser :as body-parser]
[feathers.hooks :as hooks]
[feathers.rest :as rest]
[feathers.socketio :as socketio]
[feathers.express :as express]))

(defn feathers! [] (fs/feathers))

(def configuration config/configure)

(def compress compression/use)

(defn cors [app]
(-> app
(express/options "*" (cors/cors))
(cors/use)))

(def favicon favicon/use)

(defn body-parser [app]
(-> app
body-parser/json
(body-parser/urlencoded #js{:extended true})))

(def hooks hooks/configure)

(def rest rest/configure)

(def socketio socketio/configure)

(def api fs/use)

(defn static [feathers path]
(fs/use feathers (fs/static path)))

(def listen fs/listen)
11 changes: 11 additions & 0 deletions src/feathers/body_parser.cljs
@@ -0,0 +1,11 @@
(ns feathers.body-parser
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def body-parser (node/require "body-parser"))

(defn json [app]
(fs/use app (.json body-parser)))

(defn urlencoded [app conf]
(fs/use app (.urlencoded body-parser conf)))
30 changes: 30 additions & 0 deletions src/feathers/boot_feathers.clj
@@ -0,0 +1,30 @@
(ns feathers.boot-feathers
(:require [boot.core :as boot]
[degree9.boot-npm :as npm]))

(boot/deftask feathers
"Download feathers.js npm packages."
[f feathers VAL str "Version for feathers package."
r rest VAL str "Version for feathers-rest package."
s socketio VAL str "Version for feathers-socketio package."
e errors VAL str "Version for feathers-errors package."
m memory VAL str "Version for feathers-memory package."
a authentication VAL str "Version for feathers-authentication package."
c configuration VAL str "Version for feathers-configuration package."
b body-parser VAL str "Version for body-parser package."
o cors VAL str "Version for cors package."
z compression VAL str "Version for compression package."
i serve-favicon VAL str "Version for serve-favicon package."]
(npm/npm :install
{:feathers (:feathers *opts* "latest")
:feathers-rest (:rest *opts* "latest")
:feathers-socketio (:socketio *opts* "latest")
:feathers-errors (:errors *opts* "latest")
:feathers-memory (:memory *opts* "latest")
:feathers-authentication (:authentication *opts* "latest")
:feathers-configuration (:configuration *opts* "latest")
:body-parser (:body-parser *opts* "latest")
:cors (:cors *opts* "latest")
:compression (:compression *opts* "latest")
:serve-favicon (:serve-favicon *opts* "latest")}
:cache-key ::feathers))
34 changes: 34 additions & 0 deletions src/feathers/client.cljs
@@ -0,0 +1,34 @@
(ns feathers.client
(:refer-clojure :exclude [rest])
(:require [cljsjs.feathers]
[cljsjs.jquery]))

(def feathers js/feathers)

(defn configure
[app callback]
(.configure app callback))

(defn rest [app]
(configure app (.jquery (.rest feathers) js/jquery)))

(defn socketio [app socket]
(configure app (.socketio feathers socket)))

(defn hooks [app]
(configure app (.hooks feathers)))

(defn authentication [app conf]
(configure app (.authentication feathers conf)))

(defn service
[app svc]
(.service app svc))

(defn authenticate
([app] (.authenticate app))
([app conf] (.authenticate app (clj->js conf))))

(defn logout
[app]
(.logout app))
8 changes: 8 additions & 0 deletions src/feathers/compression.cljs
@@ -0,0 +1,8 @@
(ns feathers.compression
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def compression (node/require "compression"))

(defn use [app]
(fs/use app (compression)))
8 changes: 8 additions & 0 deletions src/feathers/configuration.cljs
@@ -0,0 +1,8 @@
(ns feathers.configuration
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def configuration (node/require "feathers-configuration"))

(defn configure [app path]
(fs/configure app (configuration path)))
31 changes: 31 additions & 0 deletions src/feathers/core.cljs
@@ -0,0 +1,31 @@
(ns feathers.core
(:require [cljs.nodejs :as node]))

(def feathers (node/require "feathers"))

(defn static [path]
(.static feathers path))

(defn configure
[app callback]
(.configure app callback))

(defn listen
[app & [port]]
(.listen app port))

(defn setup
[app server]
(.setup app server))

(defn use
([app service]
(.use app service))
([app path service]
(.use app path service)))

(defn service
([app path]
(.service app path))
([app path service]
(.service app path service)))
8 changes: 8 additions & 0 deletions src/feathers/cors.cljs
@@ -0,0 +1,8 @@
(ns feathers.cors
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def cors (node/require "cors"))

(defn use [app]
(fs/use app (cors)))
8 changes: 8 additions & 0 deletions src/feathers/express.cljs
@@ -0,0 +1,8 @@
(ns feathers.express
(:require [cljs.nodejs :as node]))

(def express (node/require "express"))

(defn options
([app opts] (.options app opts))
([app path opts] (.options app path opts)))
8 changes: 8 additions & 0 deletions src/feathers/favicon.cljs
@@ -0,0 +1,8 @@
(ns feathers.favicon
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def favicon (node/require "serve-favicon"))

(defn use [app path]
(fs/use app (favicon path)))
8 changes: 8 additions & 0 deletions src/feathers/hooks.cljs
@@ -0,0 +1,8 @@
(ns feathers.hooks
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def hooks (node/require "feathers-hooks"))

(defn configure [app]
(fs/configure app (hooks)))
9 changes: 9 additions & 0 deletions src/feathers/rest.cljs
@@ -0,0 +1,9 @@
(ns feathers.rest
(:refer-clojure :exclude [rest])
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def rest (node/require "feathers-rest"))

(defn configure [app]
(fs/configure app (rest)))
26 changes: 26 additions & 0 deletions src/feathers/services.cljs
@@ -0,0 +1,26 @@
(ns feathers.services
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def service fs/service)

(defn find [service params & [callback]]
(.find service params callback))

(defn get [service id params & [callback]]
(.get service id params callback))

(defn create [service data params & [callback]]
(.create service data params callback))

(defn update [service id data params & [callback]]
(.update service id data params callback))

(defn patch [service id data params & [callback]]
(.patch service id data params callback))

(defn remove [service id params & [callback]]
(.remove service id params callback))

(defn setup [service app path]
(.setup service app path))
8 changes: 8 additions & 0 deletions src/feathers/socketio.cljs
@@ -0,0 +1,8 @@
(ns feathers.socketio
(:require [cljs.nodejs :as node]
[feathers.core :as fs]))

(def socketio (node/require "feathers-socketio"))

(defn configure [app]
(fs/configure app (socketio)))
2 changes: 2 additions & 0 deletions version.properties
@@ -0,0 +1,2 @@
#Thu Jul 14 14:17:53 MDT 2016
VERSION=0.1.0

0 comments on commit e9ede0d

Please sign in to comment.