Kouhei Sutou
null+****@clear*****
Sat Jun 14 22:34:53 JST 2014
Kouhei Sutou 2014-06-14 22:34:53 +0900 (Sat, 14 Jun 2014) New Revision: e39e0549006b20e497253a39038a271918414bfb https://github.com/groonga/heroku-buildpack-rroonga/commit/e39e0549006b20e497253a39038a271918414bfb Message: Support GROONGA_BASE_PATH Modified files: README.md bin/compile Modified: README.md (+23 -2) =================================================================== --- README.md 2014-05-25 18:24:37 +0900 (dcd6eb5) +++ README.md 2014-06-14 22:34:53 +0900 (d84eb9e) @@ -2,7 +2,7 @@ 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 @@ -10,7 +10,9 @@ 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`: @@ -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) +``` Modified: bin/compile (+5 -1) =================================================================== --- bin/compile 2014-05-25 18:24:37 +0900 (75b2cea) +++ bin/compile 2014-06-14 22:34:53 +0900 (fe74de8) @@ -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 @@ -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) -------------- next part -------------- HTML����������������������������... 下载