Navigation Menu

Skip to content

Commit

Permalink
Support GROONGA_BASE_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 14, 2014
1 parent 552031b commit e39e054
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
25 changes: 23 additions & 2 deletions README.md
Expand Up @@ -2,15 +2,17 @@

This is a Heroku buildpack of [Rroonga](http://ranguba.org/#about-rroonga).

## Usage:
## Usage

heroku create --buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/groonga/rroonga.tgz

Add `rroonga` entry to your `Gemfile`:

gem "rroonga"

Create `groonga/init.rb` that initializes your Groonga database. You can refer your Groonga database path by `ENV["GROONGA_DATABASE_PATH"]`.
Create `groonga/init.rb` that initializes your Groonga database. You
can refer your Groonga database path by
`ENV["GROONGA_DATABASE_PATH"]`.

Here is a sample `groonga/init.rb`:

Expand Down Expand Up @@ -60,3 +62,22 @@ end
Then push them to Heroku.

git push heroku master

## Advanced usage

This buildpack expects to Groonga database is created at
`ENV["GROONGA_DATABASE_PATH"]` by default. But you can use different
path for your Groonga database. You can use `ENV["GROONGA_BASE_PATH"]`
to determine your Groonga database path. `ENV["GROONGA_BASE_PATH"]`
has a directory path that should be placed Groonga related files.

Example:

```ruby
# groonga/init.rb

require "groonga"

my_custom_database_path = File.join(ENV["GROONGA_BASE_PATH"], "my-database")
Groonga::Database.open(my_custom_database_path)
```
6 changes: 5 additions & 1 deletion bin/compile
Expand Up @@ -35,6 +35,7 @@ def merge_environment_variables(variables)
]
variables[target_path] = all_paths.compact.join(File::PATH_SEPARATOR)
end
variables["GROONGA_BASE_PATH"] = ENV["GROONGA_BASE_PATH"]
variables["GROONGA_DATABASE_PATH"] = ENV["GROONGA_DATABASE_PATH"]
variables
end
Expand Down Expand Up @@ -176,7 +177,10 @@ def setup_ruby_environment_variables(build_dir)
end

arguments = Arguments.new(*ARGV)
groonga_database_path = File.join(arguments.build_dir, "groonga", "database")

groonga_base_path = File.join(arguments.build_dir, "groonga")
ENV["GROONGA_BASE_PATH"] = groonga_base_path
groonga_database_path = File.join(groonga_base_dir, "database")
ENV["GROONGA_DATABASE_PATH"] = groonga_database_path

builder = BuildpackBuilder.new("Groonga", "groonga/groonga", arguments)
Expand Down

0 comments on commit e39e054

Please sign in to comment.