Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
babysnakes committed Aug 1, 2013
2 parents 0f1674e + a8a61c7 commit c206259
Show file tree
Hide file tree
Showing 31 changed files with 836 additions and 766 deletions.
2 changes: 1 addition & 1 deletion .bowerrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"directory" : "vendor",
"json" : "config/component.json"
"json" : "config/bower.json"
}
16 changes: 12 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
distDir: "target/dist",
standaloneJar: "target/ayler-<%= pkg.version %>-standalone.jar",
standaloneJar: "target/production+uberjar/ayler-<%= pkg.version %>-standalone.jar",
distExecutable: "<%= distDir %>/ayler-<%= pkg.version %>",

less: {
Expand Down Expand Up @@ -38,6 +38,7 @@ module.exports = function(grunt) {
files: {
"resources/public/js/dependencies.js": [
"vendor/jquery/jquery.js",
"vendor/underscore/underscore.js",
"vendor/angular/angular.js",
"vendor/bootstrap/docs/assets/js/bootstrap.js",
"vendor/highlight.js/highlight.pack.js"],
Expand All @@ -51,6 +52,7 @@ module.exports = function(grunt) {
// minified versions for production
production: {
src: ["vendor/jquery/jquery.min.js",
"vendor/underscore/underscore-min.js",
"vendor/angular/angular.min.js",
"vendor/bootstrap/docs/assets/js/bootstrap.min.js",
"vendor/highlight.js/highlight.pack.js"],
Expand Down Expand Up @@ -95,7 +97,8 @@ module.exports = function(grunt) {

karma: {
unit: {
configFile: "config/karma.conf.js"
configFile: "config/karma.conf.js",
background: true
}
},

Expand All @@ -110,6 +113,7 @@ module.exports = function(grunt) {
},
deps: {
files: ["vendor/jquery/jquery.js",
"vendor/underscore/underscore.js",
"vendor/angular/angular.js",
"vendor/angular-scenario/angular-scenario.js",
"vendor/bootstrap/docs/assets/js/bootstrap.js",
Expand Down Expand Up @@ -140,7 +144,10 @@ module.exports = function(grunt) {
stderr: true
},
uberjar: {
command: "lein with-profile production do clean, uberjar",
command: [
"export LEIN_SNAPSHOTS_IN_RELEASE=true",
"Lein with-profile production do clean, uberjar"
].join(" && "),
options: {
stdout: true,
stderr: true
Expand Down Expand Up @@ -187,7 +194,7 @@ module.exports = function(grunt) {
}]
},
component: {
src: "config/component.json",
src: "config/bower.json",
overwrite: true,
replacements: [{
from: /("version": ").*(",\s*)/,
Expand Down Expand Up @@ -227,6 +234,7 @@ module.exports = function(grunt) {
"concat:vendorCss",
'concat:development',
'uglify:development',
'karma:unit',
'watch']);
grunt.registerTask('production',
"Generate assets for production.",
Expand Down
14 changes: 13 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Project history
### 0.4.0
Features:

* Added function arguments in the docstring (when applicable).

Fixes:

* Instead of embedding the anti-forgery middleware we use a [custom
fork of it][braf]
* Revised [clojure workflow][workflow].
* Rewrite of *angularjs* code to better use constructs.

### 0.3.0
Features:
Expand Down Expand Up @@ -36,4 +47,5 @@ First release. Features:
* Remote nrepl is configurable only via CLI options

[ring-anti-forgery]: https://github.com/weavejester/ring-anti-forgery

[braf]: https://github.com/babysnakes/ring-anti-forgery
[workflow]: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
62 changes: 52 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,35 @@ features are:
dependencies).

For more information on installing and using this application please
see the [wiki](/babysnakes/ayler/wiki).
see the [wiki][gwiki].

## Development environment setup

### Custom dependencies
We're using a custom fork of [ring-anti-forgery][]. This fork
currently only exists in github and I couldn't find an elegant way for
including github repositories as dependencies when building production
jar, so currently we require an extra step for installing the fork
locally on your repository. Later it'll either get accepted as pull
request or we'll create a custom fork.

Please run the following in order to install it locally:

```sh
# cd /to/some/directory
# git clone git://github.com/babysnakes/ring-anti-forgery.git
# cd ring-anti-forgery
# git checkout db6d0d9
# lein install
# cd .. && rm -rf ring-anti-forgery
```

### External dependencies
This project relies on external applications to manage different parts
of it's life cycle. You'll need the following applications:

* [Nodejs][node] (currently 0.8.x)
* [phantomjs][pjs] (currently 1.8.x)
* [Nodejs][node] (currently 0.10.7)
* [phantomjs][pjs] (currently 1.9.x)

Once you have these installed run the following:

Expand Down Expand Up @@ -59,7 +78,7 @@ life cycle of a project. You can find the full configuration in the
During development it's advisable to run `grunt` on one terminal and
`grung karme:unit` on another.

### Managing versions
### Managing application version
The application version should be configured in `package.json` and not
in the expected `project.clj`. After changing the version in
`package.json` run (see above about *grunt*):
Expand All @@ -68,12 +87,32 @@ in the expected `project.clj`. After changing the version in

and it will replace the version in all required places.

### A note about dependencies
Most dependencies are downloaded from the internet by `leiningen`,
`npm` or `bower`. However some dependencies are not available by these
tools. I created a *vendor* branch which holds dependencies like
these. These dependencies are checked out on top of the current brunch
by running `grunt vendor`.
### Querying outdated dependencies
There are tools to query outdated dependencies (both for assets and
for clojure dependencies).

Clojure outdated dependencies could be queried using the
[lein-outdated][] plugin.

Node outdated packages could be queried in 2 ways:

* Query for updates within the boundaries of your version constraint
(e.g. if you specified ~1.2.0 as version you will not be shown
version 1.3):
* `npm outdated`
* Query for updated regardless of version constraints:
* `npmedge`

And last, for a list of outdated assets just run `bower list`. The
up-to-date version should be specified alongside the existing
version.

### A note about asset dependencies
Most asset dependencies are downloaded from the internet by `npm` or
`bower`. However some dependencies are not available by these tools. I
created a *vendor* branch which holds dependencies like these. These
dependencies are checked out on top of the current brunch by running
`grunt vendor`.

## License
Copyright © 2013 Haim Ashkenazi
Expand All @@ -85,3 +124,6 @@ Distributed under the GPLv3 license.
[nrepl]: https://github.com/clojure/tools.nrepl
[grunt]: http://gruntjs.com
[clojuredocs]: http://www.clojuredocs.org
[gwiki]: https://github.com/babysnakes/ayler/wiki
[ring-anti-forgery]: https://github.com/weavejester/ring-anti-forgery
[lein-outdated]: https://github.com/ato/lein-outdated
11 changes: 11 additions & 0 deletions config/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "ayler",
"version": "0.4.0",
"dependencies": {
"bootstrap": "git://github.com/twitter/bootstrap.git#~2.3.2",
"angular": "git://github.com/angular/bower-angular.git#~1.0.6",
"angular-mocks": "git://github.com/angular/bower-angular-mocks.git#~1.0.6",
"angular-scenario": "git://github.com/angular/bower-angular-scenario.git#~1.0.6",
"underscore": "git://github.com/documentcloud/underscore.git#~1.4.4"
}
}
10 changes: 0 additions & 10 deletions config/component.json

This file was deleted.

1 change: 1 addition & 0 deletions config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ files = [
JASMINE,
JASMINE_ADAPTER,
"vendor/jquery/jquery.js",
"vendor/underscore/underscore.js",
"vendor/angular/angular.js",
"vendor/bootstrap/docs/assets/js/bootstrap.js",
"vendor/angular-mocks/*.js",
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
{
"name": "ayler",
"version": "0.3.0",
"version": "0.4.0",
"description": "Utilities to help during the development of ayler",
"dependencies": {
"bower": "~0.8.5",
"bower": "~0.10.0",
"grunt": "~0.4.1",
"grunt-cli": "~0.1.6",
"grunt-contrib-less": "~0.5.0",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-watch": "~0.3.1",
"grunt-contrib-less": "~0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-watch": "~0.4.4",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-karma": "~0.3.0",
"grunt-karma": "~0.4.0",
"grunt-shell": "~0.2.1",
"grunt-text-replace": "~0.3.2",
"grunt-contrib-copy": "~0.4.1"
},
"devDependencies": {
"npmedge": "~0.1.3"
}
}
24 changes: 12 additions & 12 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
(defproject ayler "0.3.0"
(defproject ayler "0.4.0"
:description "External namespace browswer for clojure projects."
;; :url "http://example.com/FIXME"
:license {:name "GPLv3"
:url "http://www.gnu.org/licenses/"}
:dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/tools.nrepl "0.2.2"]
[org.clojure/tools.nrepl "0.2.3"]
[ring/ring-core "1.1.8"]
[ring/ring-jetty-adapter "1.1.8"]
[compojure "1.1.5"
:exclusions [org.clojure/tools.macro]]
[com.taoensso/timbre "1.5.2"]
[com.taoensso/timbre "2.1.2"]
[org.clojure/tools.cli "0.2.2"]
[ring/ring-json "0.2.0"]
[crypto-random "1.1.0"]]
[ring-anti-forgery "0.3.0-SNAPSHOT"]]

:source-paths ["src/clojure"]
:test-paths ["test/clojure"]

:profiles {:dev
{:dependencies [[ring-mock "0.1.3"]]
:plugins [[lein-pedantic "0.0.5"]]
:jvm-opts ["-Dayler.dev=t"]}}

:main ayler.app
:profiles {:dev {:source-paths ["src/dev"]
:dependencies [[ring-mock "0.1.5"]
[org.clojure/tools.namespace "0.2.3"]
[org.clojure/java.classpath "0.2.0"]]}
:production {:main ayler.app}}

:pedantic :warn
:min-lein-version "2.0.0")
:main ^{:skip-aot true} ayler.app ; avoid issues with tools.namespace.

:min-lein-version "2.2.0")
42 changes: 10 additions & 32 deletions src/clojure/ayler/api.clj
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
(ns ayler.api
"Handles all API calls."
(:require [taoensso.timbre :as timbre]
[ayler.ns-queries :as queries]
[ayler.nrepl-client :as client])
(:use [compojure.core :only (defroutes GET POST)]
[ring.middleware.json :only (wrap-json-response wrap-json-params)]
[ring.util.response :only (response)]
[ring.util.codec :only (url-encode url-decode)]
[ayler.helpers :only (var-route)]))

(defn- convert-to-name-and-url
[col f]
(timbre/trace (str "conver to name and url: " col))
(->> col
sort
(map f)))

(defn- nses-to-name-and-url
"converts the namespace list to a map with :name and encoded :url"
[col]
(convert-to-name-and-url
col
(fn [x] {:name (name x) :url (url-encode (name x))})))

(defn- vars-to-name-and-url
"Converts the list of vars to :name and :url (with full url)"
[namespace, col]
(convert-to-name-and-url
col
(fn [x] {:name (name x) :url (str namespace "/" (url-encode (name x)))})))
(:require [ayler.ns-queries :as queries]
[ayler.nrepl-client :as client]
[compojure.core :refer (defroutes GET POST)]
[ring.middleware.json :refer (wrap-json-response wrap-json-params)]
[ring.util.codec :refer (url-encode url-decode)]
[ring.util.response :refer (response)]
[taoensso.timbre :as timbre]))

(defn- apply-handler-if-successfull
"If the provided response was successfull it applies the provided
Expand All @@ -47,7 +25,7 @@
(defn- loaded-namespaces
[]
(-> (queries/query-loaded-namespaces)
(apply-handler-if-successfull nses-to-name-and-url)))
(apply-handler-if-successfull sort)))

(defn- all-namespaces
[]
Expand All @@ -59,7 +37,7 @@
[namespace]
(-> (url-decode namespace)
queries/query-namespace-publics
(apply-handler-if-successfull (partial vars-to-name-and-url namespace))))
(apply-handler-if-successfull sort)))

(defn- ns-doc
"Returns the docstring of namespace"
Expand Down Expand Up @@ -110,6 +88,6 @@
(POST "/api/disconnect/" _ (response (client/disconnect))))

(def app
(-> (var-route routes)
(-> routes
wrap-json-response
wrap-json-params))
Loading

0 comments on commit c206259

Please sign in to comment.