Skip to content

Commit

Permalink
updated readme for new rockspec format
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Feb 9, 2012
1 parent a5ea71d commit 47a2775
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions README.md
@@ -1,5 +1,4 @@
Heroku buildpack: Lua
=====================
# Heroku buildpack: Lua

This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack)
for Lua apps.
Expand All @@ -8,29 +7,42 @@ It comes bundled with [Lua 5.1][1] and [LuaRocks 2.0.7.1][2].

Read a tutorial at <http://leafo.net/posts/lua_on_heroku.html>.

Usage
-----
## Usage

Create an app with the buildpack:

$ heroku create --stack cedar --buildpack http://github.com/leafo/heroku-buildpack-lua.git

You application must have a special file called `package.lua` to declare your
dependencies. For example:
## Describing Dependencies

-- package.lua
depends {
"xavante",
In order to describe the dependencies of you application you must create a
[rockspec][4] for it.

The first file found that matches `*.rockpsec` in the root directory will be
used. Don't put multiple ones in the root directory otherwise it might get
confused.

The buildpack *only* looks at the dependency information. Meaning you don't
have to follow the entire rockspec specification. Minimally, your rockspec
could look something like this:

-- my_app.rockspec
dependencies = {
"xavante >= 2.2.1",
"http://moonscript.org/rocks/moonscript-dev-1.src.rock",
"cosmo"
}

Each dependency listed is passed onto LuaRocks' `install` command. This means
you can also use urls to your own rockspecs.
This file must exist, even if you have no dependencies. The rockspec is parsed
in [prepare.moon][3].

This file must exist, even if you have no dependencies. It can be empty. The
execution of `package.lua` is done in [prepare.moon][3].
As shown above, if you want to include rockspec or rock files by url you can
place them in the dependencies table. (This is not supported by LuaRocks, only
by this buildpack).

The buildpack installs dependencies to `packages/` and Lua is installed to
## Using Dependencies

The buildpack installs the dependencies to `packages/` and Lua is installed to
`bin/lua`.

Before you can require any of your dependencies, you must update your
Expand All @@ -46,12 +58,13 @@ Before you can require any of your dependencies, you must update your

xavante.run()


If you're running testing locally as well, and `package.init` doesn't exist, do
something like this:

pcall(require, "packages.init")

## Running a Process

To spawn your server create a `Procfile` similar to:

web: bin/lua web.lua $PORT
Expand All @@ -61,4 +74,5 @@ Where `web.lua` is the entry point to your Lua application.
[1]: http://www.lua.org
[2]: http://luarocks.org/
[3]: https://github.com/leafo/heroku-buildpack-lua/blob/master/opt/prepare.moon
[4]: http://luarocks.org/en/Rockspec_format

0 comments on commit 47a2775

Please sign in to comment.