Better elixir example in README

This commit is contained in:
Carlos Martín Nieto
2013-06-05 01:46:01 +02:00
parent 9f82af2ac3
commit 1df7939d4c

View File

@@ -20,6 +20,7 @@ in it.
$ git clone git://github.com/carlosmn/geef.git $ git clone git://github.com/carlosmn/geef.git
$ cd geef $ cd geef
$ make $ make
$ mix # if you want to build the elixir modules
The API looks basically like this: The API looks basically like this:
@@ -32,15 +33,24 @@ Workdir = geef_repo:workdir(Repo).
Elixir Elixir
====== ======
Some effort is made to let elixir programmers use the library in a There are wrappers for elixir which make use of some elixir-specific
more OO fashion. As an example, you can resolve a reference by calling things, like `Repository.open!`, or `Reference.resolve!`.
a `resolve` method on it.
```elixir ```elixir
{ :ok, original_ref } = :geef_ref.lookup(repo, refname) alias Geef.Repository
{ :ok, resolved_ref } = original_ref.resolve() alias Geef.Reference
repo = Repository.open!(".")
ref = Reference.lookup!(repo. "HEAD") |> Reference.resolve!
``` ```
Of course, you could also do
```elixir
ref = Repository.open! "." |> Reference.lookup! "HEAD" |> Reference.resolve!
```
but then you would leak the repository process.
CONTRIBUTING CONTRIBUTING
============== ==============