Skip to content
Browse files

starting to be real

  • Loading branch information...
1 parent 88b70fb commit d6dc42b150f06b54397543ee838e3f47f5851654 @mtravers committed
Showing with 1,709 additions and 14 deletions.
  1. +3 −0 .gitignore
  2. +6 −1 README.md
  3. +55 −10 bin/compile
  4. +3 −3 bin/detect
  5. +2 −0 bin/release
  6. +10 −0 bin/scrap
  7. +14 −0 example.asd
  8. +1,580 −0 lib/quicklisp.lisp
  9. +5 −0 setup/compile.lisp
  10. +23 −0 setup/setup.lisp
  11. +8 −0 src/hello-world.lisp
View
3 .gitignore
@@ -0,0 +1,3 @@
+quicklisp
+*.fasl
+*#
View
7 README.md
@@ -1,6 +1,11 @@
-Heroku buildpack: Hello
+Heroku buildpack: CL
=======================
+Attempt at a buildpack for Common Lisp (using OpenMCL). Work in progress.
+
+
+
+
This is an example [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks).
Usage
View
65 bin/compile
@@ -1,16 +1,61 @@
-#!/bin/sh
+#!/usr/bin/env bash
+# bin/compile <build-dir> <cache-dir>
-indent() {
- sed -u 's/^/ /'
+mktmpdir() {
+ dir=$(mktemp -t node-$1-XXXX)
+ rm -rf $dir
+ mkdir -p $dir
+ echo $dir
}
+function indent() {
+ c='s/^/ /'
+ case $(uname) in
+ Darwin) sed -l "$c";;
+ *) sed -u "$c";;
+ esac
+}
+
+S3_BUCKET="cl-heroku"
+CCL_PACKAGE="http://${S3_BUCKET}.s3.amazonaws.com/ccl-1.7.tgz"
+
+# parse and derive params
+BUILD_DIR=$1
+CACHE_DIR=$2
+CACHE_QUICKLISP_DIR="$CACHE_DIR/quicklisp/"
+BUILD_QUICKLISP_DIR="$BUILD_DIR/quicklisp/"
+
+CCL_DIR="$(mktmpdir ccl)"
+
+# don't we only want to do this if not there?
+echo "-----> Fetching ccl"
+mkdir -p $CCL_DIR && curl $CCL_PACKAGE -s -o - | tar xzf - -C $CCL_DIR
+
+# add to slug
+cp -r $CCL_DIR $BUILD_DIR/ccl
+
+echo echo "ccl installed" | indent
-echo "-----> Found a hello.txt"
+# setting up paths for building
+
+# unpack existing cache
+# nodejs is more elaborate; this ought work
+if [ -d $CACHE_QUICKLISP_DIR ]; then
+
+ cp -r $CACHE_QUICKLISP_DIR $BUILD_QUICKLISP_DIR
-# if hello.txt is empty, abort the build
-if [ ! -s $1/hello.txt ]; then
- echo "hello.txt was empty" | indent
- exit 1
fi
-# replace hello with goodbye in a new file
-cat $1/hello.txt | sed -e "s/[Hh]ello/Goodbye/g" > $1/goodbye.txt
+echo "-----> Installing dependencies with quicklisp"
+
+# run lisp to load quicklisp packages
+ccl/scripts/ccl -l compile.lisp
+
+echo "dependencies installed" | indent
+
+# copy quicklisp back to cache
+if [ -d $CACHE_QUICKLISP_DIR ]; then
+
+ rm -rf $CACHE_QUICKLISP_DIR
+ cp -r $BUILD_QUICKLISP_DIR $CACHE_QUICKLISP_DIR
+
+fi
View
6 bin/detect
@@ -1,8 +1,8 @@
#!/bin/sh
-# this pack is valid for apps with a hello.txt in the root
-if [ -f $1/hello.txt ]; then
- echo "GoodbyeFramework"
+# this pack is valid for apps with a setup.lisp in the root
+if [ -f $1/setup.lisp ]; then
+ echo "CLFramework"
exit 0
else
exit 1
View
2 bin/release
@@ -1,5 +1,7 @@
#!/bin/sh
+
+
cat << EOF
---
addons:
View
10 bin/scrap
@@ -0,0 +1,10 @@
+# get patched aserve
+if [ -d $CACHE_DIR/repos/portableaserve ]; then
+ pushd $CACHE_DIR/repos/portableaserve
+ git pull
+ popd
+else
+ pushd $CACHE_DIR/repos
+ git clone git://github.com/mtravers/portableaserve.git
+ popd
+fi
View
14 example.asd
@@ -0,0 +1,14 @@
+(in-package :asdf)
+
+(defsystem :example
+ :name "example"
+ :description "Example cl-heroku application"
+ :depends-on (:aserve :wuwei)
+ :components
+ ((:static-file "example.asd")
+ (:module :src
+ :serial t
+ :components
+ ((:file "hello-world"))
+ )))
+
View
1,580 lib/quicklisp.lisp
1,580 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
5 setup/compile.lisp
@@ -0,0 +1,5 @@
+(in-package :cl-user)
+
+(load (make-pathname :defaults *load-pathname* :name "setup"))
+
+(ql:quickload *app-name*)
View
23 setup/setup.lisp
@@ -0,0 +1,23 @@
+(in-package :cl-user)
+
+;;; Customize
+
+(defvar *app-name* "example")
+
+;;; Standard
+
+(defvar *app-home* (butlast (pathname-directory *load-pathname*)))
+
+(if (probe-file (make-pathname :directory (append *app-home* '("quicklisp")) :defaults "setup.lisp"))
+ (load (make-pathname :directory (append *app-home* '("quicklisp")) :defaults "setup.lisp"))
+ (progn
+ (load (make-pathname :directory (append *app-home* '("lib")) :defaults "quicklisp.lisp"))
+; (quicklisp-quickstart:install :path (make-pathname :directory (append *app-home* '("quicklisp"))))
+ (funcall (symbol-function (find-symbol "INSTALL" (find-package "QUICKLISP-QUICKSTART")))
+ (make-pathname :directory (append *app-home* '("quicklisp"))))
+ ))
+
+(require :asdf)
+(load (make-pathname :directory *app-home* :name *app-name* :type "asd"))
+
+
View
8 src/hello-world.lisp
@@ -0,0 +1,8 @@
+(in-package :cl-user)
+
+(net.aserve:publish :path "/hello"
+ :function #'(lambda (req ent)
+ (net.aserve:html
+ (:h1 "Hello World")
+ (:princ "You're on heroku (or not)"))))
+

0 comments on commit d6dc42b

Please sign in to comment.
Something went wrong with that request. Please try again.