Permalink
Browse files

Whoa! It's heroku-buildpack-emacs now!

  • Loading branch information...
1 parent 7634d65 commit 4e823cd706eb0af3a16a991e2853efe5eb05b1da @technomancy committed Oct 28, 2011
Showing with 54 additions and 43 deletions.
  1. +46 −24 README.md
  2. +5 −9 bin/compile
  3. +2 −3 bin/detect
  4. +1 −7 bin/release
View
@@ -1,34 +1,56 @@
-Heroku buildpack: Hello
-=======================
+# Heroku buildpack: Emacs Lisp
-This is an example [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack).
+This is an Emacs Lisp Heroku buildpack. It is probably only useful
+with [Elnode](http://www.emacswiki.org/emacs/Elnode).
-Usage
------
+## Usage
-Example usage:
+```lisp
+;;; init.el
+(require 'elnode (concat load-file-name "elnode.el"))
- $ ls
- hello.txt
+(defun handler (httpcon)
+ "Demonstration function"
+ (elnode-http-start httpcon "200"
+ '("Content-type" . "text/html")
+ `("Server" . ,(concat "GNU Emacs " emacs-version)))
+ (elnode-http-return httpcon "<html><body><h1>Hello from Emacs!</h1></body></html>"))
- $ heroku create --stack cedar --buildpack http://github.com/heroku/heroku-buildpack-hello.git
+(elnode-start 'handler (string-to-number (or (getenv "PORT") "8080")) "0.0.0.0")
+
+(while t (accept-process-output nil 1))
+```
+
+ # requires heroku gem version 2.11.0+
+ $ heroku create --stack cedar --buildpack http://github.com/heroku/heroku-buildpack-emacs.git
$ git push heroku master
...
-----> Heroku receiving push
-----> Fetching custom buildpack
- -----> HelloFramework app detected
- -----> Found a hello.txt
-
-The buildpack will detect that your app has a `hello.txt` in the root. If this file has contents, it will be copied to `goodbye.txt` with instances of the world `hello` changed to `goodbye`.
-
-Hacking
--------
-
-To use this buildpack, fork it on Github. Push up changes to your fork, then create a test app with `--buildpack <your-github-url>` and push to it.
-
-For example, you can change the displayed name of the buildpack to `GoodbyeFramework`. Open `bin/detect` in your editor, and change `HelloFramework` to `GoodbyeFramework`.
-
-Commit and push the changes to your buildpack to your Github fork, then push your sample app to Heroku to test. You should see:
-
- -----> GoodbyeFramework app detected
+ -----> Emacs Lisp app detected
+ -----> Downloading Emacs 24.0.50.1
+ Downloading Emacs 24 pretest from http://p.hagelb.org/emacs.tar.gz...
+ ...done
+
+The buildpack will detect that your app has an `init.el` in the root
+and download a copy of the Emacs 24 pretest to bundle in your slug.
+The Procfile for Emacs Lisp apps currently needs to untar that copy of
+Emacs before running and symlink it to /tmp/emacs, like this:
+
+ web: tar xzf emacs.tar.gz && ln -s $PWD/emacs /tmp/emacs; emacs/bin/emacs --daemon --load init.el
+
+This is obviously undesired since it means other users could interfere
+with this symlink, so a way to compile Emacs without referring to the
+/tmp directory needs to be discovered. Until then, don't use this
+buildpack for anything you would need to keep secure.
@tomjack
tomjack Aug 3, 2012

Is this actually a problem? I asked Heroku about the use of dir=$(mktemp -t node-$1-XXXX); rm -rf $dir in the nodejs buildpack, they said it isn't a problem since the stuff is running inside an LXC container — i.e. "other users" could only refer to collaborators.

@technomancy
technomancy Aug 6, 2012 Owner

You're right; I wasn't aware of the level of isolation at the time I wrote this.

+
+The current Emacs tarball is compiled from the pretest of version 24
+with this invocation:
+
+ $ ./configure --without-x --without-sound --without-xpm \
+ --without-jpeg --without-tiff --without-gif --without-png \
+ --without-rsvg --without-xml2 --without-imagemagick --without-xft \
+ --without-toolkit-scroll-bars --without-gconf --without-dbus \
+ --without-gsettings --without-selinux --without-gnutls --without-gpm \
+ --without-makeinfo --without-compress-info --prefix=/tmp/emacs
View
@@ -4,13 +4,9 @@ indent() {
sed -u 's/^/ /'
}
-echo "-----> Found a hello.txt"
+echo "-----> Found an init.el file."
-# 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
+# TODO: cache this
+echo "Downloading Emacs 24 pretest from http://p.hagelb.org/emacs.tar.gz..." | indent
+curl -s -o $1/emacs.tar.gz http://p.hagelb.org/emacs.tar.gz
+echo "...done" | indent
View
@@ -1,8 +1,7 @@
#!/bin/sh
-# this pack is valid for apps with a hello.txt in the root
-if [ -f $1/hello.txt ]; then
- echo "HelloFramework"
+if [ -f $1/init.el ]; then
+ echo "Emacs Lisp"
exit 0
else
exit 1
View
@@ -1,11 +1,5 @@
#!/bin/sh
cat << EOF
----
-addons:
- - shared-database:5mb
-config_vars:
- PATH: bin:/usr/bin:/bin
-default_process_types:
- hello: cat hello.txt
+--- {}
EOF

0 comments on commit 4e823cd

Please sign in to comment.